Re: Band-limited AY emulation
- From: W Marsh <wayneDOTmarshATgmailDOTcom@decipher>
- Date: Fri, 23 Dec 2005 00:52:07 +0000
A936@xxxxxxxxxxx wrote:
W Marsh wrote:
* The AY emulator itself generates two outputs for each sound channel - a buffer containing the state of the "wave", either high or low, and another buffer containing the volume levels. The sound is then rendered into an output buffer using band-limited steps at change points in the high/low buffer, and modulated with the volume level buffer. I think this is essentially the approach used with this library: http://www.slack.net/~ant/libs/#Blip_Buffer. A nasty problem with this occurs when the channel volume registers are manipulated at a high speed, as then THOSE frequencies become high enough to cause aliasing. Perhaps this could be corrected by also using a band-limited step for the volume envelopes, and making sure not to create a terrible aliasing monster when everything is modulated together (less bandwidth for each output 'signal', perhaps).
I agree with the direction you're headed in. The right kind of signal shaping should mimic what the hardware does.
I would suggest computing the total output as a result of all wave/volume effects on all channels and add them up to get the total volume the ay chip is actually outputting. Have the new value stored in NEWVAL, say, and the previous value in PREVAL. Then output the bandlimited step response modulated by the difference (NEWVAL-PREVAL).
This makes sense to me.
The bandlimited step response should mimic the Spectrum's audio output circuitry. The output circuitry is probably effectively a cascade of two low pass filters (one for the RC components and one for the speaker). Compute a unit step response for such a cascade filter and this should be the bandlimited step response you can use.
That also makes sense. I wonder if the information about these components is available anywhere. I don't really know anything about electronics - would the filter essentially be a capacitor arrangement? I can imagine that there are existing DSP techniques used to model this sort of thing that I could find. I will have a look if this ever gets beyond the musing stage.
Have a "steady state output value" for the output of the AY module, say AYOUT. When a changed volume occurs, the AY module indexes through the bandlimited step response at the sample rate, adding the step response to AYOUT to get the resulting output waveform. At the end of the step resonse, the transient bandlimited step response will have settled at its final value. Add that final value to AYOUT and terminate the bandlimited step response for the volume change that occurred some time earlier. Your sample rate and frequency of AY chip volume changes will determine how many indices are travelling through the recorded bandlimited step response at any one time.
Ah, yep - this is a clearer way of saying what I was confusingly trying to explain earlier. I'm glad you've described it this way - much clearer, and good to hear it coming from somebody who knows what he's talking about!
I think you should still be oversampling and applying an output low pass filter well away from the 11khz or so bw that the Spectrum hw has.
Hm, I see. I worry that after all of the effort, this potentially more accurate emulation would end up sounding nearly the same.
Mainly a vote of confidence in your idea as this is pretty much what you suggested :))
Thanks, you've convinced me that this would probably work. I wonder if it's actually worthwhile though. I think I need to get my hands on a second hand Speccy and compare existing AY emulators (perhaps they're quite adequate anyway), and generate some preliminary audio tests myself.
.
- References:
- Band-limited AY emulation
- From: W Marsh
- Re: Band-limited AY emulation
- From: A936
- Band-limited AY emulation
- Prev by Date: Re: Trying to locate ramsoft mgt +D disk archive
- Next by Date: Re: The Commodore 64 rules!
- Previous by thread: Re: Band-limited AY emulation
- Next by thread: Trying to locate ramsoft mgt +D disk archive
- Index(es):
Relevant Pages
|