lidnariq wrote:
Is there any chance he runs the audio and its filter at 1.8MHz instead of 21.5MHz? Otherwise, yes, you're right that it doesn't make sense.
I really don't think so. I asked him probably three times now and I get the same answer. I don't want to keep bugging him. Also, if he was using the 1.79MHz clock that would just make the Nyquist even less (i.e. 1.79M/256 = 7kHz).
Here are excerpts from the #nesdev IRC channel.
---
Once upon a time in #nesdev...
Code:
<jwdonal> hey kev, what type of filter do you have on your NES' audio output
<@kevtris> I have a 256th order lowpass FIR filter
<jwdonal> is that in the FPGA or in the codec itself?
<@kevtris> result audio is very good and sounds like a real NES then for looped noise and such
<@kevtris> in the FPGA
<@kevtris> I have an external DAC of course, stereo 24 bits
<@kevtris> running at 83.9KHz
<jwdonal> are the coefficients stored as mantissa/exponent format?
<@kevtris> fixed point
<@kevtris> fixed point is how all math works on my FPGAs
<@kevtris> I made a lowpass filter, for around 20KHz cutoff
<@kevtris> my audio's 1/256th the rate of the 21MHz clock
<@kevtris> And I take a sample every 256 iterations of the filter
<@kevtris> I run it at 21.47727MHz so I get a 83.9KHz or so sample rate on the output
<@kevtris> which is what my DAC runs at
<@kevtris> so it's all integrated
<@kevtris> I only used 1 multiplier
Note that I think Kev actually meant a 255th order low-pass filter with 256 taps - people very often get order and tap-number confused. But either way, it's not a big deal.
---
And on some other day on #nesdev...
Code:
<jwdonal> hey kev, what sampling frequency did you say you were using for your NES' low-pass filter (i.e. the frequency at which the samples are entering the filters running sample set)?
<@kevtris> 21.472272/256
<@kevtris> 83KHz
<jwdonal> so if you are downsampling the output of the APU to 83kHz doesn't that mean that all frequencies above the Nyquist (i.e. 83k/2) will get aliased back into the audible range?
<jwdonal> cause the noise channel goes up to 447kHz...
<@kevtris> no it means they are cut out
<@kevtris> my audio is generated in real time, and has no sample rate
<@kevtris> just like a real NES
<@kevtris> it is then filtered, which that has a sample frequency of 21.47727MHz
<@kevtris> and then the output is 83KHz to the DAC
<@kevtris> cutoff's like 20KHz
<@kevtris> on the filter proper
<@kevtris> everything above is cut off
<@kevtris> so it's a lowpass
<jwdonal> ok, i def understand that. i was just thinking that down-sampling causes aliasing, but you're saying not.
<jwdonal> i'm curious what you mean by "generated in real time and has no sample rate". you just mean that the samples are generated as the APU creates them, yes?
<trap15> jwdonal: yes
<trap15> sorta
<trap15> basically, the output is always being made
From what I understand about filters and the Nyquist-Shannon theorem, Kevtris' reponse to my aliasing question (i.e. "<@kevtris> no it means they are cut out") is incorrect. Unless Kevtris has somehow disproven the Nyquist-Shannon theorem. Lol.
But anyway, from the above I gather that Kevtris is shifting in samples at the 83kHz frequency and then running the FIR's multiply-accumulate at 256x that rate. This makes sense since he is only using 1 multiplier and because he must calculate the filtered result for the current 256-sample set before the next sample is shifted in. What he is doing all makes sense but with the noise channel frequency going far past 41.9kHz it just shouldn't work!
---
I really don't want to have to ask Kevtris about this again. I have to be just mis-understanding something simple. Or it might be possible that Kevtris did this stuff so long ago that he has just forgotten exactly how it worked. Whatever the case, it's driving me up the wall. All I want to know is that I'm not crazy - someone care to confirm?