It is currently Mon Nov 12, 2018 11:11 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Thu Mar 12, 2009 6:50 pm 
Offline

Joined: Fri Jul 29, 2005 3:40 pm
Posts: 345
Location: near chicago
is the cut off frequency for the high pass and low pass of the nes known ? if so, is the gain or frequency response known ?

i am familiar with digital signal processing from school, had an intro to it, but have not looked at it in a while.

i am still working on getting sound working in my emu. i know blargg wrote blip but wanted to see how much i could do on my own to learn. might infact do what that does, but would like to learn it :)

matt


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 12, 2009 7:47 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7714
Location: Seattle
Image
http://nesdev.com/NESAudio.gif

Although we have to model it in discrete time in our computers, the NES generates the audio at ~1.8MHz and goes through a mostly-but-not-completely linear output stage as you can see in that image.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 12, 2009 8:14 pm 
Offline

Joined: Fri Jul 29, 2005 3:40 pm
Posts: 345
Location: near chicago
i have seen that. i guess i wasnt sure what exactly come out of pin1 and pin2. i didnt know if anyone had the numbers. my electronics skills are not that good and not sure i would be able to determine the cut frequencies of that or the gains. i know there is a non linear mixing equation on the wiki and other sound docs, i assume that includes the internal and external mixing on the nes.

thanks
matt


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 12, 2009 11:04 pm 
Offline
User avatar

Joined: Mon Sep 27, 2004 2:13 pm
Posts: 1668
I see a bunch of low pass filters, there's:

-one made by the 220pF cap before the inverting amp and the audio output Z
-same cap making a low pass filter with the interting amp's feedback resistor (47K & 220pF)
-capacitor feedback on the inverting amp making an integrator/active LPF?
-one made by the series inductor and the following cap (39uH & .01uF)
-one made on the output (150R & 47pF)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 13, 2009 7:01 am 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
The raw internal output from the 2A03 on the two pins is very likely unfiltered. The non-linear mixing doesn't do any filtering either. So it's all after that, as kyuusaku detailed above.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 13, 2009 7:26 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20760
Location: NE Indiana, USA (NTSC)
I've made recordings of 1 kHz square waves and noise played through the NTSC frontloader's RCA audio jack, if those help any.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 13, 2009 8:52 am 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
The problem is that this also includes your sampler's low-pass (and high-pass) filtering. Making recordings of the raw 2A03 output pins AND the RCA output would allow them to be compared to find out the filtering done, though I never could figure out how to quantify it well. I think one uses an impulse to determine this, i.e. a pulse as short as possible, that still results in significant amplitude. An impulse contains all frequencies of equal amplitude, so running it through a spectrum analyzer (Fourier Transform) shows any filtering that was done to it, as well as any phase shifts.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 13, 2009 11:20 am 
Offline

Joined: Fri Jul 29, 2005 3:40 pm
Posts: 345
Location: near chicago
is there a high pass filter in there too ?

right now i am dumping audio to a file and looking at it in audacity. its unfiltered at the moment and have been filtering in audacity. i was just wondering what the low and high frequency is, and rolloff.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 13, 2009 11:41 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20760
Location: NE Indiana, USA (NTSC)
mattmatteh wrote:
is there a high pass filter in there too ?

I'm pretty sure the NES has a high-pass filter of some sort on its RCA audio output. I saw a high-pass characteristic in the recordings I mentioned, and it's probably not entirely the PC because the sound card (an SB Ensoniq AudioPCI) has picked up rumble as low as 5 Hz from my desk mic.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 13, 2009 12:33 pm 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
The 1 uF capacitor just after the mixer and the 10 uF capacitor just before the audio output should do some high-pass filtering.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 13, 2009 1:10 pm 
Offline
User avatar

Joined: Mon Sep 27, 2004 2:13 pm
Posts: 1668
Perhaps instead of using the APU's output, it would be easier to lift the mixing resistors and use a computer's line out?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 13, 2009 2:18 pm 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
Then you get the filtering the computer's line out has. :)

I think the NES can generate good impulses with frequency content well above 20 kHz, we just need to be able to do something useful with the result. I had tried this a while back but never got anything useful. I think another issue is that the more into the PC's low-pass rolloff you go, the less you can determine the rolloff of the NES filter; when you reach the PC's cutoff, you obviously can't determine anything about the NES. Here's a recording of the raw output from the 2A03 (left channel), and the RCA (right channel):, with levels adjusted so the second wider pulses have the same initial delta

nes_raw_rca.wav

I don't have very good analysis tools, so perhaps someone else can compare the two to determine the filtering occurring between them, which would be what the NES output amplifier circuit does.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 13, 2009 4:07 pm 
Offline

Joined: Tue Mar 03, 2009 3:56 pm
Posts: 316
blargg I can analyze the sound but it would be useful if the recordings of each type were a bit longer.. like a second or more of white noise coming from each output?

also if you could record at a high sample rate it will show how high up the response goes


I checked out tepples recordings and the white noise appears to be pretty flat all the way up and past 20kHz in the NES-001.ogg file (which i assume is an acutal nes)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 14, 2009 9:42 am 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
I'm not sure I can get white noise. I do now see that an impulse isn't that great for determining high-pass, but for low-pass it's good; perhaps the step response will be best for determining high-pass. I re-recorded some that were in like phase (where the impulse falls relative to the sampler affects things). Black is the raw output from the 2A03 (and thus shows the low-pass of my PC's sampler), red is the RCA, and blue is with a one-pole filter with coefficient ~0.816 applied to the raw, which closely approximates the RCA. The frequency scale is linear from 0 to 22050 Hz (my sampler won't do any higher, sorry).

Image

The filter that seems to approximate low-pass characteristics is just out[i]=(in[i]-out[i-1])*0.815686.

EDIT: And for high-pass, using out[i]=out[i-1]*k+in[i]-in[i-1] twice, with k=0.996039 and k=0.999835 seems to approximate it well (step response, red is NES RCA, blue is raw run through above filter):

Image

Perhaps someone can confirm that these two constants match the R-C high-pass filters in the schematic.

EDIT: And of course the above iterative filter equations are run at a 44100 Hz sampling rate; other rates would use different coefficients.


Last edited by blargg on Sun Mar 15, 2009 11:38 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 15, 2009 10:30 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7714
Location: Seattle
blargg wrote:
Perhaps someone can confirm that these two constants match the R-C high-pass filters in the schematic.


The k=.999835 HP is a time constant of 1700us, and it corresponds to the very last output stage -- the 150ohm resistor and 10uF cap (corner freq=90Hz).

The k=.996039 HP is a time constant of 360us, I haven't yet found what it corresponds to. (corner freq=442Hz)
(edit: This might correspond to the 47k on the resistor through the inductor and the .011uF of capacitors, or the .011uF of capacitors and the 270ohm resistor after the BJT with its resistance amplified by the BJT (appx a factor of 200).)

The k=.815686 LP is a time constant of 11us, the 47kohm and 220pF lowpass around the inverter-used-as-an-amplifier (corner freq=14kHz).

(The time constant for the LC seems to be faaaaar above audible frequencies, time constant=654ns -> corner freq=243kHz)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: Google Adsense [Bot], zeroone and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group