pouët.net

Go to bottom

Paula interrupts

category: code [glöplog]
With a PWM DAC it's easy to interleave samples from each channel and let the filter do the mixing. Much, much simpler than adding the samples in binary before the DAC, or mixing analog output from two DACs. So yes, as a PWM DAC is used it would make sense to interleave samples.
Quote:
So yes, as a PWM DAC is used it would make sense to interleave samples.


Not so fast. :) There's nothing suggesting a "PWM DAC" is used, what happens is that the digital signal is modulated before the DAC. Also consider the following text in the HRM (emphasis mine):

Quote:
If the sampling rate is set much higher than the normal maximum sampling
rate (approximately 29 KHz), the two samples in the buffer register will
be repeated. If the filter on the Amiga is bypassed and the volume is
set to the maximum
($40), this feature can be used to make modulated
carriers up to 1.79 MHz. The modulation is placed in the memory map, with
plus values in the even bytes and minus values in the odd bytes.


Note that it requires full volume so as not to be disturbed by the volume PWM mechanism. Making a modulated carrier as suggested wouldn't be possible if channels were interleaved or a PWM DAC was used.
added on the 2015-07-03 18:54:21 by absence absence
Funny thing is that the fact that the volume goes from 0 to 64 (and not 63 as one would think) strongly hinted towards PWM for the volume from the get go. Just take one global 6bit counter and per voice, do a compare with the volume register and modulate the output sample with the result. Very cheap to implement in hardware; one comparator plus 8 AND gates is almost nothing.

Also, why 6 bist of volume? Simple: Given ~3.5MHz of Paula clock and 6bits of counter the frequency of the "volume carrier" is at about 55Khz. Now apply some signal knowledge and a couple of trigonometric identities and you'll see that all the additional frequencies generated by the ring modulation between the two signals will well be above human hearing limits. One bit more and you'd get a lot of weird hissing in high frequency sounds. :)

(yes, this was unasked spewing of facts. sorry. i felt like it. :)
added on the 2015-07-03 20:22:46 by kb_ kb_
kb: Your TinyMod blog post inspired me to pester Toni about doing the measurements in the first place. :)
added on the 2015-07-03 21:23:34 by absence absence
great stuff, people ... this is waay deeper than I wanted to know, but made some very interesting reading nonetheless. i might have to completely rewrite my volume code now (although I already know that I probably won't be able to hear any difference :)
added on the 2015-07-03 22:25:03 by juice juice
Quote:
all the additional frequencies generated by the ring modulation between the two signals will well be above human hearing limits


Due to overtones caused by sample & hold interpolation, the audio contains frequencies all the way up to half the Paula frequency before volume modulation, which is more than enough for modulation noise be audible with a 55 khz carrier. IIRC the effect is easiest to hear at volume $20, but subtle enough that it isn't worth bothering with IMHO.
added on the 2015-07-04 01:04:51 by absence absence

login

Go to top