Ongoing Research and Development for Plogue's 'retro digital' products: chipsounds, chipspeech and chipcrusher .... and various retro computing stuff.
Thursday, April 1, 2010
Next Bidule version has something special....
You will be able to reproduce pretty much any type of LFSR based noises and tones. From simple Atari TIA tones to the more complex Noise waveform of the SID, as documented by Marko Makela and Asger Alstrup, in an interactive way.
Friday, March 26, 2010
SID waveform captures
Well well well, I knew that the 6581 and the 8580/6582 generated different combined waveforms, but I didn't know that not only each single chip generates slightly different bits from each other, but you also wont get twice the exact same waveform on two separate playbacks on a single chip.
This is a binary diff of two OSC3 sampling runs of a combined waveform on a 6581 CBM (r3) chip:
Thanks for kevtris again for the tip (but no thanks in a way, since I had to spend lots of evenings to make the code to generate these data files on a real c64 lol.)
I took care in recording the normal triangular and saw waveforms in each session for comparisons, and they match across all chips.
You can basically think of the SID chip as a 4096 (4kb) sized wavetable synthesizer with each entry being 12bits in precision, only instead of actually indexing a table (which would have been too long to do with the tight schedule given to Yannes when working at MOS), each index in the table is given to a function that generates output "samples" ; A simple counter in the case of the SAW, a comparator for the Pulse+PW, etc. Only later did Yannes/Ensoniq actually implement this as a real wavetable in the DOC chip used in the ESQ-1.
The combined waveforms are still a matter of study as to how they are generated, (see the work of Antti Lankila) . After recording a huge bunch of very different ones however I cant help but feel that
there is no "perfect" way to go at this. As each SID will generate something different, why not add some non-deterministic aspects into the generation?
In the mean time we can reasonably emulate the combined waveforms of the SID (which are really a odd mixture of bits in the analog world) by indexing a pre recorded table such as the one I've captured using the SID's 3rd oscillator "read" functionality. As you know the C64 is an 8 bit machine so we only can read a approximation of the real result (8 most significant bits out of the 'real' 12) but it doesn't really matter, since even at 8bits, we can prove that no two reads are the same, so who cares really if we lose 4bits of precision. Those data files for those combined waveforms will be included in my new emu code and you will be able to choose the version of the chip you want. That way you could simulate a wide range of different "runs".
Note1: the waveforms are $11,$21,(...)$81,
frequency=1, CIA timer=$FFF
Note2: I don't know what is "wrong" with that r2's P_T waveform. seems like its phase starts halfway compared to R3,R4 and 6582... I'm waiting for other R2's from Ebay so I'll retry when I get them.
Note3: The 6582's noise captures are all in phase, but not with my 6581 recordings... weird
more notes to come...
Monday, March 15, 2010
SID 6581R3 ADSR tables, up close.
In the center of any SID emulation there is the bare waveform generation, and a very accurate explanation of how the this works internally has been published through an interview with its creator, which can be read here. Fascinating read for any geek head!
However some very important details are missing, including the exact maths behind the main ADSR clocking but also its pseudo exponential decay/release stages.
It was time to have a look at the SID's DIE itself!
This is exaclty what kevtris and Lord Nightmare have done here
The SID chip has two obvious ROM based lookup tables on the DIE, for each voice. Here is the bigger one, as described in kevtris's blog entry:
I basically just cropped parts of the picture of the chip, which is available here, and placed the bit values on top of it.
However the blog post doesnt mention, nor explain the purpose of the second table, which I assumed was one of the "exp" tables, as mentionned in the Yannes Interview:
Yannes: "In order to more closely model the exponential decay of sounds, another look-up table on the output of the Envelope Generator would sequentially divide the clock to the Envelope Generator by two at specific counts in the Decay and Release cycles. This created a piece-wise linear approximation of an exponential. I was particularly happy how well this worked considering the simplicity of the circuitry.".
The SID patent's figure 10 mentions the following dividers are used: 30,16,4,2,1 . Hum not quite divide by two heh? 32,16,8,4,2,1 would have been more logical!
So lets try to decode the exact table on the DIE...
Well I didnt have a big clue myself, as reading bits of a DIE is all new to me, but after discussing with Lord Nightmare and kevtris, it appears this is also a LFSR counting trick, this time with a 5bit long LFSR and taps on bits 2 and 4:
Here is that table in plain ascii:
Kevtris explained that the left hand part is a "Selector" of sorts, since there is only one bit active on each line/column. The second part seems to contain inverted pairs of bits..... hmm puzzling...
Using similar code to what they provided, this time for the second table, and only taking the 'B' bits as LSB:
the results in exptable is 8,30,4,16,2, (which mostly matches the numbers in SID patent, except for the missing 8... and the weird order.
Ok so we know that at some points in the decay of the envelope, the clock divider changes... what does that mean exaclty and what are those "points"????
Heres what we can try:
We know the SID chip has two readable registers which are tied to the 3rd voice: One for the 8bit ENV value ($D41C) and the other for the 8 most significant bits of the waveform generator (which is 12 bits internally) at $D41B
So by setting the 3rd SID Oscillator's release at longest rate ($F), and by hooking up a CIA Timer to callback at each $7a13 cycles (which comes from the phase2 counter lenght for release 'F' according to kevtris/LN), we can, in theory, get a synchronized sampling of the envelope and store the results for analysis. As im lasy and that seeing is believing, I just programmed to display the values on the screen while the note decays.
Here is a live capture of that code running on a BreadBox c64 stuffed with a 6581R4AR:
If you know your Screen Codes, you can see that the envelope goes from 255 to 0, and that some values start to repeat at certain points...
The chars to look for are:
So while I can now go on with my emu code, knowing what happens, I'm still clueless on WHERE/HOW this comparison happens on the DIE. So if you have a clue, or spot anything wrong in my logic, please add a comment!
However some very important details are missing, including the exact maths behind the main ADSR clocking but also its pseudo exponential decay/release stages.
It was time to have a look at the SID's DIE itself!
This is exaclty what kevtris and Lord Nightmare have done here
The SID chip has two obvious ROM based lookup tables on the DIE, for each voice. Here is the bigger one, as described in kevtris's blog entry:
I basically just cropped parts of the picture of the chip, which is available here, and placed the bit values on top of it.
However the blog post doesnt mention, nor explain the purpose of the second table, which I assumed was one of the "exp" tables, as mentionned in the Yannes Interview:
Yannes: "In order to more closely model the exponential decay of sounds, another look-up table on the output of the Envelope Generator would sequentially divide the clock to the Envelope Generator by two at specific counts in the Decay and Release cycles. This created a piece-wise linear approximation of an exponential. I was particularly happy how well this worked considering the simplicity of the circuitry.".
The SID patent's figure 10 mentions the following dividers are used: 30,16,4,2,1 . Hum not quite divide by two heh? 32,16,8,4,2,1 would have been more logical!
So lets try to decode the exact table on the DIE...
Well I didnt have a big clue myself, as reading bits of a DIE is all new to me, but after discussing with Lord Nightmare and kevtris, it appears this is also a LFSR counting trick, this time with a 5bit long LFSR and taps on bits 2 and 4:
Here is that table in plain ascii:
SSSSS A B A B A B A B A B 00100 0 1 0 1 1 0 0 1 0 1 00001 0 1 0 1 0 1 0 1 1 0 01000 0 1 1 0 1 0 1 0 0 1 00010 1 0 1 0 1 0 0 1 1 0 10000 1 0 1 0 0 1 0 1 0 1
Kevtris explained that the left hand part is a "Selector" of sorts, since there is only one bit active on each line/column. The second part seems to contain inverted pairs of bits..... hmm puzzling...
Using similar code to what they provided, this time for the second table, and only taking the 'B' bits as LSB:
const unsigned short exp_lfsr[5] = {
0x1B, 0x0F, 0x11 , 0x08 ,0x1C
};
for (size_t i=0;i<5;i++){
unsigned int LFSR=0x1F;
size_t c=0;
while(1){
if (LFSR == exp_lfsr[i]){
exptable[i]= c;
break;
}
else{
c++;
LFSR = ((LFSR << 1) | (((LFSR >> 2)
^ (LFSR >> 4)) & 1)) & 0x1F;
}
}
}
the results in exptable is 8,30,4,16,2, (which mostly matches the numbers in SID patent, except for the missing 8... and the weird order.
Ok so we know that at some points in the decay of the envelope, the clock divider changes... what does that mean exaclty and what are those "points"????
Heres what we can try:
We know the SID chip has two readable registers which are tied to the 3rd voice: One for the 8bit ENV value ($D41C) and the other for the 8 most significant bits of the waveform generator (which is 12 bits internally) at $D41B
So by setting the 3rd SID Oscillator's release at longest rate ($F), and by hooking up a CIA Timer to callback at each $7a13 cycles (which comes from the phase2 counter lenght for release 'F' according to kevtris/LN), we can, in theory, get a synchronized sampling of the envelope and store the results for analysis. As im lasy and that seeing is believing, I just programmed to display the values on the screen while the note decays.
Here is a live capture of that code running on a BreadBox c64 stuffed with a 6581R4AR:
If you know your Screen Codes, you can see that the envelope goes from 255 to 0, and that some values start to repeat at certain points...
The chars to look for are:
"|": (93) switches to 2 waits before a drop "6": (54) switches to 4 waits before a drop "Z": (26) switches to 8 waits before a drop "N": (14) switches to 16 waits before a drop (Thanks Frank!) "F": (06) switches to 30 waits before a drop
So while I can now go on with my emu code, knowing what happens, I'm still clueless on WHERE/HOW this comparison happens on the DIE. So if you have a clue, or spot anything wrong in my logic, please add a comment!
Sunday, March 14, 2010
MESS 0.137 is out!
Hi
I'm proud to announce my little personal contribution to the best emulator project in the world.
Since a bit after chipsounds 1.0 was released, I started contributing some of my recent research to the open source 'MESS' project on the sound front. My contributions are "without strings attached" as I feel that the research in MAME/MESS is crucial to the good preservation of the history of computing. Besides, the accumulated knowledge in there will surely outlive me :)
"0.137
New System Drivers Supported:
-----------------------------
- Casio PV-1000 [Wilbert Pol, plgDavid]
(...)
System Driver Changes:
----------------------
- [SCV] Implemented upd177c audio. [plgDavid]"
The SCV audio still needs work, so that's not the last effort I will put into it. I've also tweaked the Arcadia 2001 audio code and made it much closer to the real thing. I also plan on revisiting a few other "drivers", when I get the chance, namely the VIC-20.
The MAME/MESS Teams members are very passionate and knowledgeable. I want to take the moment to greet Wilbert Pol, kevtris and Lord Nightmare especially, and to thank them for their time and near infinite knowledge.
Get it NOW
I'm proud to announce my little personal contribution to the best emulator project in the world.
Since a bit after chipsounds 1.0 was released, I started contributing some of my recent research to the open source 'MESS' project on the sound front. My contributions are "without strings attached" as I feel that the research in MAME/MESS is crucial to the good preservation of the history of computing. Besides, the accumulated knowledge in there will surely outlive me :)
"0.137
New System Drivers Supported:
-----------------------------
- Casio PV-1000 [Wilbert Pol, plgDavid]
(...)
System Driver Changes:
----------------------
- [SCV] Implemented upd177c audio. [plgDavid]"
The SCV audio still needs work, so that's not the last effort I will put into it. I've also tweaked the Arcadia 2001 audio code and made it much closer to the real thing. I also plan on revisiting a few other "drivers", when I get the chance, namely the VIC-20.
The MAME/MESS Teams members are very passionate and knowledgeable. I want to take the moment to greet Wilbert Pol, kevtris and Lord Nightmare especially, and to thank them for their time and near infinite knowledge.
Get it NOW
Thursday, February 25, 2010
The SID's non-monotonic DAC
That picture is from a 6581R4AR. A Simple ADSR glide on a 50/50 Pulse set at highest freq.
This is going to be fun to emulate....
http://masteringelectronicsdesign.com/an-adc-and-dac-differential-non-linearity-dnl/
Monday, February 1, 2010
Ultimate 2532(or 2352) PROM MegaCart!!! ... kinda
While visiting my favorite local Electronics Surplus Store I came across this odd 24 pin fake IC to IC cable, which gave me a cool idea. One very common (and boring) tasks in my line of work is doing adapters to run ROMs (custom and whatnot) on the real hardware for analysis. This setup makes it pretty easy (and solderless) to try stuff around, especially difference in CPU<->BUS<->ROM handshaking signals like !CS !CE, !E whatever, and also configuration of adress lines.
Systems that typically use such 24pin ROMs include
VIC-20
ATARI 2600
MPT-03 - Arcadia 2001 clone(pictured)
Odyssey2
This particular breadbreadboard setup allows me to quickly "audition" up to 16 different 4KB Arcadia ROMs using DIP switches.
Thursday, January 21, 2010
Sunday, January 17, 2010
Analyse.. don't Destroy (a Casio PV-1000)
I'm not a console collector nut, I'm a audio chip collector nut. There are countless game consoles and computers out there that I dont care much about because they all contain the same chips. (AY-3-8910 is nice, but you can only have so many of them).
What I'm looking to acquire at this point are the most obscure ones which contain custom/unique sound generating chips. You've heard about the CASIO PV-1000 before?
Don't worry, only the most die hard console collectors did. And they would die for it too. There are very very few such consoles out there and I got mine a bit by chance, and it was an impulse buy.
At 300$ (ebay), you just can't afford to ruin it can you? (I'm not a movie producer). And I look forward to its resell value once im done with it. Thats where the challenge comes in... how do I take a device that comes with just a NTSC-J RF adapter and get good enough audio results with it? (the RF channels on North american and Japan dont match... dont try)
The closest I got to getting a picture/sound from the default unit as is was to use a ANALOG/DIGITAL USB TV tuner, which had by chance a NTSC-J mode:
Not that bad, but, the audio was horrendous, and really not usable for my tests. However I've hacked nearly all my consoles in order to have separate composite video/audio from RCA jacks, so on top of some test equipement, i've got a few hunches on how to solve this cleanly.
the RF box is tied to the main motherboard in a very clean way:
A few minutes with my multimeter, from top to bottom:
1)9VDC (current for the amplifiers in the RF sections i assume)
2)GND
3)Composite Video Out.. YAY!
4)GND (same as 2)
5)Audio Out... w00t!
Connecting Aligator jumpers to truncated ends of a RCA and to the pins 3,4 and 5 did provide me with a temporary solution, but surely isnt very practical for a longer term analysis.
Oups, where did the RF box go? (in a safe place in case I resell it and the buyer really is after lots of pain and suffering).
Much better.
From the outside:
Enjoy the OK quality outputs:
What I'm looking to acquire at this point are the most obscure ones which contain custom/unique sound generating chips. You've heard about the CASIO PV-1000 before?
Don't worry, only the most die hard console collectors did. And they would die for it too. There are very very few such consoles out there and I got mine a bit by chance, and it was an impulse buy.
At 300$ (ebay), you just can't afford to ruin it can you? (I'm not a movie producer). And I look forward to its resell value once im done with it. Thats where the challenge comes in... how do I take a device that comes with just a NTSC-J RF adapter and get good enough audio results with it? (the RF channels on North american and Japan dont match... dont try)
The closest I got to getting a picture/sound from the default unit as is was to use a ANALOG/DIGITAL USB TV tuner, which had by chance a NTSC-J mode:
the RF box is tied to the main motherboard in a very clean way:
A few minutes with my multimeter, from top to bottom:
1)9VDC (current for the amplifiers in the RF sections i assume)
2)GND
3)Composite Video Out.. YAY!
4)GND (same as 2)
5)Audio Out... w00t!
Connecting Aligator jumpers to truncated ends of a RCA and to the pins 3,4 and 5 did provide me with a temporary solution, but surely isnt very practical for a longer term analysis.
Oups, where did the RF box go? (in a safe place in case I resell it and the buyer really is after lots of pain and suffering).
From the outside:
Enjoy the OK quality outputs:
Saturday, January 9, 2010
Meet my new friend the logic analyser!
Its time to step my game up. So I've decided to acquire the immese value for money Saleae Logic Analyser. This baby will allow me to analyse and record a bunch of stuff that really cant be handled with a sound card and an oscilloscope alone. (namely serial digital audio prior to being sent to DACs)
As a test to see if everything works, and that i can get sufficient time resolution on this, ive done a simple setup which consists in a 4Mhz clock and a Hex inverter (74LS04). I done my recording test using 24Mhz on my MacBookPro's USB2 port. And im quite happy with the results. Not bad for 15 minutes of unboxing the thing!
As a test to see if everything works, and that i can get sufficient time resolution on this, ive done a simple setup which consists in a 4Mhz clock and a Hex inverter (74LS04). I done my recording test using 24Mhz on my MacBookPro's USB2 port. And im quite happy with the results. Not bad for 15 minutes of unboxing the thing!
Monday, November 30, 2009
These are not the chips you're looking for
[EDIT dec7th 2009] the wikipedia page has been corrected!Thanks!
According to wikipedia there is a VRC6 chip inside a North American Nigel Mansell "World Challenge" cartridge. Well no, there isn't. And there's no such thing as "World Challenge" either, only "World Championship" same difference.
Looks like Ill have to dig up the big bucks for a Japanese Castlevania 3 cart.
According to wikipedia there is a VRC6 chip inside a North American Nigel Mansell "World Challenge" cartridge. Well no, there isn't. And there's no such thing as "World Challenge" either, only "World Championship" same difference.
Looks like Ill have to dig up the big bucks for a Japanese Castlevania 3 cart.
Monday, November 9, 2009
TED: The 100$ noise pattern

00000000110010000100010111111101010011100
11000111111000001011010101101111101111000
10000001001111001110110011111001011101011
00101011110100011000010100000111000110101
11000011110110110100001101110111001001000
11101001100110100100110110001010101000100
101001011 (low frequency version: audio)
Working C16's and plus/4 are HARD to come by,
and people need to pay the price for a working
MOS8501 CPU and a MOS8360 TED chip.
I needed a real machine to analyze the TED noise pattern
(and pitch ranges) for a future version of chipsound,
so I won a working plus/4 on ebay, which cost me 100$
(with shipping) to Montreal, not that bad actually.
The TED will be included in an update for completism more
than anything, because the only thing that's unique about it
is its noise pattern. Otherwise its a very simple VDC
unit that generates 2 voices. Many plus4 users actually hook
up SIDs to the machine, or just use the chip as a DAC,
which is the case for demos such as this one
Confirmed VICE plus4 emu generates the same pattern,
so all is good.
(100$/255bits = 39cent/bit)
But is it cute??
Hum, nah, im not cleaning that GUNK to find out!
Wednesday, October 28, 2009
Full AY emu prototype
Well I've talked about this before, but I'll say it again.
Designing a synthesizer that claims full chip authenticity and playability at the same time is the toughest challenge I'm faced with.
It hard to give access to powerful sound tweaking possibilities available on some chips when the synth paradigm you are basing your whole design on is of the standard
[voice0 + voice1 + voice2 + (...) + voiceN = mix]
variety
Look at this signal path for instance:

It becomes clear that something like this doesn't fit that particular mold.
The AY has five generators: 3 tones, 1 noise, and 1 envelope.
It also has three independent audio output pins, that are mixed in the analog world differently in all the AY-based systems.
Now each of the output has its own tone generator, but it can also be mixed with the lone noise pattern (either, or combined with a binary AND). On top of that each output can have its volume changed independently (16 log steps), or be amp-modulated by the LONE Envelope generator. (more in the spec)
Anyone who's messed with an AY knows that the fun comes from mixing the env/tone+noise in certain ways which can make unique drones/beats that any IDM/Experimental student would enjoy.
But you can't currently do these in chipsounds v1.0 due to voice paradigm its based on. From recent user questions on the AY matter, it surprised me how programming a straight chip emu sounds like a hard task.
But in reality, in comparison to trying to make it fit in ARIA/SFZ, making a separate module that purely emulates the chip in bit perfect manner (and with all its limitations) is really not the challenge it appears to be.
The AY is a relatively simple digital state machine
Here is a snapshot of my current prototype (made using Bidule's C++ SDK):

And the type of drones you can dynamically make by moving the sliders here:
Example A
Example B
Its currently unclear if/how this will be integrated in chipsounds, or given for free for Bidule users. Please stay tuned!
Designing a synthesizer that claims full chip authenticity and playability at the same time is the toughest challenge I'm faced with.
It hard to give access to powerful sound tweaking possibilities available on some chips when the synth paradigm you are basing your whole design on is of the standard
[voice0 + voice1 + voice2 + (...) + voiceN = mix]
variety
Look at this signal path for instance:

It becomes clear that something like this doesn't fit that particular mold.
The AY has five generators: 3 tones, 1 noise, and 1 envelope.
It also has three independent audio output pins, that are mixed in the analog world differently in all the AY-based systems.
Now each of the output has its own tone generator, but it can also be mixed with the lone noise pattern (either, or combined with a binary AND). On top of that each output can have its volume changed independently (16 log steps), or be amp-modulated by the LONE Envelope generator. (more in the spec)
Anyone who's messed with an AY knows that the fun comes from mixing the env/tone+noise in certain ways which can make unique drones/beats that any IDM/Experimental student would enjoy.
But you can't currently do these in chipsounds v1.0 due to voice paradigm its based on. From recent user questions on the AY matter, it surprised me how programming a straight chip emu sounds like a hard task.
But in reality, in comparison to trying to make it fit in ARIA/SFZ, making a separate module that purely emulates the chip in bit perfect manner (and with all its limitations) is really not the challenge it appears to be.
The AY is a relatively simple digital state machine
Here is a snapshot of my current prototype (made using Bidule's C++ SDK):

And the type of drones you can dynamically make by moving the sliders here:
Example A
Example B
Its currently unclear if/how this will be integrated in chipsounds, or given for free for Bidule users. Please stay tuned!
Subscribe to:
Posts (Atom)


















