Sunday is a great day for audio tests…

What a fruitful day, yesterday was. Lots to report. First, AamirM here are the zip files:
The last one has the rom. I took pics so you know what settings were used for which wave record file.

First, volume changing. Each volume mechanism sets the reference voltage and they accumulate (weather digitally or analog, I’m not sure. But it doesn’t particularly matter at this point) for the amp on the final output. The problem occurs when you have a large change in volume (up or down), the total negative voltage point drops and takes a bit to normalize back into place. For normal channels, this isn’t such a big deal. Usually, on a normal channel output – you have a sudden change of sound introduced from turning on a channel. So the sudden change of the of having a DC offset introduced into the signal and drift back, isn’t really noticeable. If it was, sound emulation would sound completely different. Instead of slightly.

The bad part about this, is when you have nothing outputting on a channel and you change the volume reg. Say for DDA. You get a spike with no accompanying audio/waveform/etc. Just a pop by itself. That’s undesirable. So, if you’re writing your own music/sound engine – don’t change the volume level of the DDA channel if you’re not outputting anything. Just leave it as is.

Second, writing to the data port while a channel is playing. This has some really interesting results. The current sample being output is replaced with the new sample. Nothing is ‘mixed’ or such. But more importantly, the channel buffer is updated! The waveform pointer is not updated though. Come to find out, a few games actually use this. All three of the Fire Pro Wrestling games do this. And so does Devil’s Crush.

They do it at a slow rate (like 60hz or less). Devil’s Crush does it even slower. The way they use it, it pseudo-randomly changes the timbre of the channel. On the first FPW game, they go overboard and it sounds terrible. But by the third game in the series, it’s more functional. What surprises me about FPW, is that they keep ‘corrupting’ the channel buffer while playing new notes. They don’t bother to reset it for each note in a track/song. Nor do they use 7khz rate with a divider/counter. You could get some really interesting sounds that way.

Third, DDA. Changing the volume on a DDA channel will cause the last sample written to be re-outputted. Changing a channel from normal->DDA->normal, will reset the channels waveform pointer. If you keep the volume active/included in that change, the channel won’t ‘turn off’ and you won’t get a spike. Alternatively, you can also write $40+vol to a channel and then $80+vol to reset it too. Both methods will reset the channel waveform pointer without turning off the channel. Though, I need to look at $40+vol and writing to the sample buffer to see what the effects might be. It’s not a normal mode to have the channel in.

Fourth, removing the spike. The change in volume has a spike in polarity corresponding to the direction of the change. By using another channel, going in the opposite direction, you can cancel out the spike (well, nearly cancel it out. It becomes very tiny). This might seem wasteful. And you’d be right. Except for one small detail. You could now in theory use the channel’s buffer as a mini DMA buffer. That means higher than 7khz output with little cpu resource. Make it high enough, and you can interleave samples of two waveforms. The high rate will cause the samples to ‘mix’ to the human ear (old Amiga trick to get 8 channels of audio). Thus, getting back the wasted channel 😉


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: