Last week I wrote a little program that runs through every combination of AUDC0 and AUDF0. It plays 7 seconds of AUDC0=0, AUDF0=0; then 7 seconds of AUDC0=1, AUDF0=0; then 7 seconds of AUDC0=2, AUDF0=0; etc. After it goes up through AUDC0=15, it starts over again with AUDC=0, but with AUDF0=1; then with AUDF0=2; etc. I chose 7 seconds because I wanted to make sure each sound frequency had a chance to repeat a few times, even with the lower frequencies. It just so happened that it takes about 1 hour to cycle through all of the AUDC0/AUDF0 combinations. AUDV0 is set to a fixed value of 15 the whole time. I know it's pointless to play AUDC0=0 and AUDC0=11 this way, and that some AUDC0 settings yield the same results as each other (e.g., AUDC0=4 and AUDC0=5), but I really wanted to go through all the possible combinations, and I figured the occasional periods of silence would be useful when I recorded the output and analyzed it.
So the other night I put the program on my Krokodile Cartridge, hooked up my Atari 2600 to my VCR, then to my DVD recorder, and recorded the program's output on a DVD at the highest quality (1 hour). Then I used the Any Audio Converter program to convert the DVD's soundtrack to WAV files, and started using the WavePad Sound Editor program to examine the WAV files. Unfortunately, the WAV files came out to be sampled at 48000 Hz, which doesn't jive very well with the TIA's base audio frequency of about 31400 Hz, so that makes it tricky to examine the higher frequencies. Still, I've been able to use the lower frequencies to check the higher frequencies. For example, AUDC0=1 and AUDF0=0 is tough to analyze by itself, but I can look at AUDC0=1 and AUDF0=1, then AUDF0=2, then AUDF0=3, etc., to see how the waveform gets longer, and then the bit pattern of the waveform becomes easier to see.
I haven't finished my analysis, but right away I started freaking out about what I'm seeing. For example, where I expected to see pulse waveforms, instead I'm seeing something that's more like a cross between a sawtooth waveform and a pulse waveform. In other words, it jumps up to a peak, but then starts decreasing like a sawtooth wave, then jumps down to a valley, then starts climbing back up like an inverse sawtooth, then jumps back up again. I started to worry that there might be something seriously amiss with the way I'd gone about recording, converting, and analyzing the sounds, but then I realized it makes perfect sense. After all, a steady stream of 1s is silent, since there's no oscillation going on. So if you're alternating between 1s and 0s, but each value lasts for more than one occurrence (e.g., 1111000011110000 etc.), the change from 1 to 0 or 0 to 1 results in a peak (1) or valley (0), but then as the same value continues, the amplitude starts to move toward the center, where it would flatline if it continued long enough. So 10101010 jumps up and down as expected, but 1111000011110000 jumps up, then starts to flatline, then jumps down, then starts to flatline, etc., resulting in a waveform that looks like the following:
AUDC0=6, AUDF0=5
And the longer the value stays the same, the more the waveform will flatline between each peak and valley:
AUDC0=6, AUDF0=12
AUDC0=6, AUDF0=19
Another thing I'm noticing is that the waveforms don't always follow the bit pattern I was expecting. AUDC0=1 (the 4-bit LFSR) is the best example. Apparently the TIASOUND.C code said that the pattern is 111100010011010. But then Adam Wozniak said that it's actually 000011101100101 (i.e., that the 1s and 0s should be reversed). I'd been relying on Adam's old [stella] posts, because he took actual samples and eventually figured out the logic for the more obscure waveforms. But what I'm seeing is that TIASOUND.C was actually correct-- it's 111100010011010.
I'm also seeing that AUDC0=6 and AUDC0=10 are sometimes inverted-- these are the 31-bit waveforms that are supposed to have 13 highs followed by 18 lows. Sometimes it's actually 18 highs and 13 lows. I suppose the sounds sound the same either way, but I still think it's interesting that the "duty cycle" isn't consistent.
I've started working on a document that summarizes my understanding of TIA sound, and I'll post it when I'm done. I've been making some assumptions, and I don't know whether they're correct or not, but it seems like they should be. For example, my attempts to decipher the TIA schematics showed that the TIA generates an asymmetrical pattern of A-phi-1 and A-phi-2 pulses for each scan line. When I posted about that in [stella] a year or two ago, Eric Ball mentioned that he'd also noticed this, and had written about it in his AtariAge blog. At first I was sort of obsessed with how that might sound, but I've since concluded (or assumed) that the A-phi-2 clocks are the important ones-- or rather, the transitions from A-phi-1 to A-phi-2-- which yields a 28-29 waveform that divides the scan line as nearly in half as is possible using 57 counts per scan line. So I'm asuming that when you have a waveform bit pattern like 111100010011010 (the 4-bit LFSR with AUDF0 set to 0), each bit lasts for either 28 or 29 counts, rather than lasting for the exact same duration.
Anyway, I'm finding all of this to be very interesting (otherwise my current obsession wouldn't have lasted for very long before the next "shiny object" captured my attention!). One thing I'm getting out of this is that when David Crane mentioned using the "triangle" or "sawtooth" wave when he was programming Pitfall (I forget what he actually said), he might not have been speaking in error, or confusing Pitfall with Pitfall II as I'd originally assumed.
Michael














