Understanding audio output better

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
gravelstudios
Posts: 103
Joined: Mon Mar 13, 2017 5:21 pm
Contact:

Understanding audio output better

Post by gravelstudios » Wed Mar 31, 2021 4:22 am

I'm very confused about the exact nature of the audio signal coming out of each channel's DAC and out of the NES itself.

based on the wiki page for the mixer, the assumption is that the signal coming from each channel is between 0.0 and 1.0. You'd expect a normal audio signal to be in the range of -1.0 to 1.0. does the DAC for each channel only produce a 'positive' signal? the descriptions for each of the channels does make it sound that way (0-15 for pulse triangle & noise, 0-127 for DMC). this would result in audio output essentially with positive DC bias. I read some more and found that DC bias can be removed from a signal with a high pass filter, and the wiki does state that the NES uses several high pass filters, so I'd assume the NES's actual audio output is more normalized to a -1 to 1 range. Is that correct?

With all of that in mind, how should this be approached in emulation. my routines for generating pulse and triangle waves generate output in the range of -1 to 1, but as I'm working on Noise and DMC, I'm finding that's more complicated. would it make more sense to make the outputs of each channel only range 0 - 1, and then combine them, and then try to normalize the output at that point?

Thanks for your help. If I owned an oscilloscope, I'd just plug it into my NES's audio output and try to figure it out for myself.

lidnariq
Posts: 10463
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Understanding audio output better

Post by lidnariq » Wed Mar 31, 2021 11:35 am

gravelstudios wrote:
Wed Mar 31, 2021 4:22 am
based on the wiki page for the mixer, the assumption is that the signal coming from each channel is between 0.0 and 1.0. You'd expect a normal audio signal to be in the range of -1.0 to 1.0. does the DAC for each channel only produce a 'positive' signal?
Correct. This is true of a lot of older audio hardware, not just the NES. The technology to make an audio signal with no DC bias without using highpass filter ("AC coupling") wasn't particularly affordable (it requires another power supply) and it's not a high enough quality source to justify the extra cost.
I'd assume the NES's actual audio output is more normalized to a -1 to 1 range. Is that correct?
If by "normalized" you mean "highpass filter", sure. (There's no dynamic adjustment of gain)

User avatar
gravelstudios
Posts: 103
Joined: Mon Mar 13, 2017 5:21 pm
Contact:

Re: Understanding audio output better

Post by gravelstudios » Wed Mar 31, 2021 12:27 pm

Thanks lidnariq! this is very helpful info.

Post Reply