The Famicom's and the NES's Audio Path

Discuss hardware-related topics, such as development cartridges, CopyNES, PowerPak, EPROMs, or whatever.

Moderator: Moderators

Great Hierophant
Posts: 780
Joined: Tue Nov 23, 2004 9:35 pm

The Famicom's and the NES's Audio Path

Post by Great Hierophant »

I always thought the Famicom's audio path was rather odd, at least how it related to special chips. But today, after looking at the Famicom's schematics I finally figured it out. After the 2A03's internal five channel audio is outputted and mixed (any input from the second controller's built-in microphone is added at this point), it goes to the cartridge connector pin #45. If there is extra sound hardware in the cartridge the sound will be mixed with the NES's internal sound, then be outputted from pin #46 to the audio output and thence to the speakers. If there is no sound hardware on the cartridge, then the cartridge will connect pins #45 and #46 together, making a loop that goes straight to the audio output without further ado.

On the NES, the addition of the unused expansion port complicates matters somewhat. The NES's audio is routed straight to an RCA jack and the RF circuitry. Pin #3 is audio input. This allows sound produced on a cartridge to be mixed with the NES's sound. In contrast to the Famicom, which mixed expansion sounds in the cartridge, the NES must mix the sounds inside the console itself. All you have to do is get pin the Famicom cartridge's pin #46 to pin #3 of the expansion connector.
drk421
Posts: 329
Joined: Sun Nov 14, 2004 11:24 am
Contact:

Post by drk421 »

I solved this problem a different way.
Inside the NES there is junction point where audio from the input of the 2A03 is mixed with the input of the bottom connect, its easy to spot because there are 3 22K resistors lined up.
I used an unused pin (typically) of the NES edge connector (pin 18), passed it from pin 46 of the famicom (audio out), through a 4.7uF non-polar cap and a 100K resistor to raise the impedance, into one of the 22k resistors (audio junction).
It works great, Akumajo Densetsu sounds great, as does the FDS (another story).

I'll tryand get pictures.
User avatar
uXe
Posts: 27
Joined: Sun Nov 25, 2012 5:28 am
Location: Adelaide, Australia

Re: The Famicom's and the NES's Audio Path

Post by uXe »

Apologies for resurrecting an old thread, but it seemed the most appropriate place to ask my question...

What signal / voltage level is expected at that 22K resistor, coming in from the NES expansion port?

I would like to directly attach a 0-5V PWM signal from a microcontroller, but my feeling is that is going to overload or distort the input, and will probably need some extra circuitry in place?
User avatar
uXe
Posts: 27
Joined: Sun Nov 25, 2012 5:28 am
Location: Adelaide, Australia

Re: The Famicom's and the NES's Audio Path

Post by uXe »

OK, some more digging, there aren't 3 x 22K resistors - actually 2 x 20K and 1 x 12K.

Looking at schematics, 'Audio In' (pin 3 on the Expansion Port) feeds into R9 (20K resistor) before the 'amplifier' circuit... so definitely seems like putting 5V into a circuit that expects something much smaller, needing amplification, is a bad idea.

Would adding in a 47K resistor for a total of 67K resistance (as seems to be the standard for audio coming from a PowerPak) be enough to safely input the 5V signal?
dscn0510.jpg
NESAudio.gif
NESAudio.gif (4.15 KiB) Viewed 11487 times
schem4.jpg
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: The Famicom's and the NES's Audio Path

Post by lidnariq »

It's hard to give you a straight answer without directly measuring the voltages on CPU pins 1/2.

You can be confident, however, that if you choose the same voltage range as CPU pin 1, due to the 20kΩ resistor from the expansion port, it'll be the same voltage (loudness) after all three signals are mixed together.

If you want to use a 5Vpp source, and CPU pin 1 is less than 5 Vpp, then you should be able to effectively match the volume by setting the currents to match—e.g. if Vpp(one pulse wave at maximum volume) is 1V, and you want your output to be the same volume, then adding 80k in series should make the volumes match. (80k+20k=100k ; 100k/20k = 5 = 5V/1V)
User avatar
uXe
Posts: 27
Joined: Sun Nov 25, 2012 5:28 am
Location: Adelaide, Australia

Re: The Famicom's and the NES's Audio Path

Post by uXe »

lidnariq wrote:It's hard to give you a straight answer without directly measuring the voltages on CPU pins 1/2.
Absolutely. Your reply was very helpful though, thanks!

Dug out my PropScope and the NES today and took some measurements from those CPU pins. Showed a voltage range of around 0.3V (ranging from around -0.226V to +68.9mV).

So I should be aiming to attenuate that 5V signal down to around 0.3V then?
0.png
PS. Testing was done using the 'test2-mmc3.nes' ROM from https://ahefner.livejournal.com/12368.html - pulse set to full volume:
test2-mmc3-0.png
test2-mmc3-0.png (2.24 KiB) Viewed 11419 times
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: The Famicom's and the NES's Audio Path

Post by lidnariq »

uXe wrote:So I should be aiming to attenuate that 5V signal down to around 0.3V then?
Depends on how many different audio signals your microcontroller is generating.

If you're just generating a single pulse wave, and you want that pulse wave to be the same volume at maximum as the NES's pulse waves, which are 0.3V, then yes; this attenuation could be achieved by putting an extra ≈313kΩ in series with R9. On the other hand, if you're mixing 4 waves, and you want all of them to be the same volume, you'd want to add ≈63kΩ.

But ... I have to admit I'm a little surprised it's only 0.3V. I'm also really surprised the voltage went negative: that's supposed to be a unipolar pull-up DAC inside the CPU (with an external 100Ω pulldown resistor)—nothing should be creating negative voltages here.
User avatar
uXe
Posts: 27
Joined: Sun Nov 25, 2012 5:28 am
Location: Adelaide, Australia

Re: The Famicom's and the NES's Audio Path

Post by uXe »

lidnariq wrote:But ... I have to admit I'm a little surprised it's only 0.3V. I'm also really surprised the voltage went negative: that's supposed to be a unipolar pull-up DAC inside the CPU (with an external 100Ω pulldown resistor)—nothing should be creating negative voltages here.
I read something about negative current here:

http://nesdev.com/2A03%20technical%20reference.txt

+-----------+
| 4-bit DAC |
+-----------+
"This is just a standard 4-bit DAC with 16 steps of output voltage
resolution, and is used by all 4 sound channels. On the 2A03, rectangle wave
1 & 2 are mixed together, and are available via pin 1. Triangle & noise are
available on pin 2.

These analog outputs require a negative current source, to attain linear
symmetry on the various output voltage levels generated by the channel(s)
(moreover, to get the sound to be audible). Instead of current sources, the
NES uses external 100 ohm pull-down resistors."

Was reading another thread earlier that may help indirectly explain too, that this negative DC offset out of the CPU pins is corrected in the mixing / amplification circuit:

https://forums.nesdev.com/viewtopic.php ... 32#p131160

Would be great if somebody else could confirm my readings on their own NES though.
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: The Famicom's and the NES's Audio Path

Post by lidnariq »

I have an oscilloscope, but unfortunately nothing resembling a useful test cart. (I still just have the ridiculous m218 cart I made)

Taking a random game and looking at pin 1, I see voltages approximately around 0.3V(max) and 0V(min)... so I guess the range is accurate.

(Did you set your 'scope to AC coupled? Or failed to connect ground? Not important, tho.)
User avatar
uXe
Posts: 27
Joined: Sun Nov 25, 2012 5:28 am
Location: Adelaide, Australia

Re: The Famicom's and the NES's Audio Path

Post by uXe »

Had to look up Mapper 218 - love it! :D

Good to at least have confirmation of the 0.3V - thanks again for all of your input on this!
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: The Famicom's and the NES's Audio Path

Post by tepples »

lidnariq wrote:I have an oscilloscope, but unfortunately nothing resembling a useful test cart. (I still just have the ridiculous m218 cart I made)
I have an assembler. What would you like to see in a mixing test cart designed for mapper 218?
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: The Famicom's and the NES's Audio Path

Post by lidnariq »

If you're offering your time...

There's two separate measurements to be made. Pin 1, for the pulse waves, is simpler. There doesn't seem to be any realistic bandwidth constraints, so just picking the maximum frequency, a 3/4 duty cycle, and letting me adjust the volume for each of the two channels independently, would be good enough.

Pin 2 is a little hairier because the triangle wave can't be set to a fixed value — at least not without trying tying CPU pin 30 to CPU A3. It doesn't seem wrong to just ignore it and just set the pulse wave volume and DPCM DAC. Although maybe some cleverness can ease measurements of the triangle wave as well?

... huh, to describe the actual problem is to put it in scope.
User avatar
rainwarrior
Posts: 8731
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: The Famicom's and the NES's Audio Path

Post by rainwarrior »

lidnariq wrote:the triangle wave can't be set to a fixed value
You can advance its position by a fixed amount, though. If you're willing to take 32 measurements you could put it into every phase? (Or with live/interactive measurement you really could just set the phase how you want this way.)
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: The Famicom's and the NES's Audio Path

Post by tepples »

I forget: Does the Reset button do anything to triangle phase? Or should this be included in the test ROM?
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: The Famicom's and the NES's Audio Path

Post by lidnariq »

The triangle phase, tri_c0 through tri_c4, is cleared on reset. For example, check visual2a03 t13993.
Post Reply