It is currently Sat Feb 17, 2018 11:52 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Volume tester
PostPosted: Sun Mar 01, 2009 8:47 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19627
Location: NE Indiana, USA (NTSC)
Unlike some other audio chips, the NES APU has five independent DACs and a non-linear mixer, making channel balance non-trivial. Emulators handle it differently, particularly in the balance between the square and noise components of the loss sound in Tetramino Concentration Room. (Nestopia, for one, makes the noise way too loud.)

I've developed a rom for testing the balance among channel volumes on an NES or emulator. Package includes source code, iNES binary (for NROM-128), and Ogg Vorbis recordings from an NES+PowerPak and recent versions of three popular emulators.

Download source, binary, and recordings (2.09 MiB)

TIP: When recording music from an NES's AV output, set the background color to sub-black ($0D) and turn off rendering. I've tested it on an NES, and it cut out nearly all 15.7 kHz noise. You'll still get a 60 Hz buzz from circuitry in the PPU turning on at the start of line 241 and off at the start of line 261 (or vice versa), which the NES recording faithfully replicates.


Attachments:
volume_tests.zip [2.09 MiB]
Downloaded 10 times


Last edited by tepples on Wed Nov 22, 2017 6:04 pm, edited 2 times in total.
Added mirror
Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 01, 2009 8:37 pm 
Offline

Joined: Tue Feb 03, 2009 7:27 pm
Posts: 2
Interesting. I've taken some recent interest in channel nonlinearity, more with respect to playing samples through the DMC DAC, because the effect of the mixing as most emulators implement it is enough to cause some audible distortion in your audio if you don't compensate for it.

Somewhat relatedly, has anyone attempted to measure nonlinearity in the DMC DAC before the channel mixing occurs? I've made some crude attempts which I've written up at http://ahefner.livejournal.com/12368.html but they aren't conclusive. I don't really know what I'm doing, and won't be satisfied until I get around to measuring directly from the pin on the 2A03 rather than the audio outputs. I'd like to refine the curve I've come up with for preparing samples for playback on the NES.

I'll have to put together new versions of my test rom that makes certain to turn the screen off as you describe.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 07, 2009 10:20 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19627
Location: NE Indiana, USA (NTSC)
Some findings:

Square waves aren't affected much by the nonlinear mixer. They're the same amplitude on the NES regardless of what value I hold $4011 at, and the tones with two squares in unison are about twice the amplitude as the same as the samples with one square.

Imagine a sound chip that adds four channels linearly, with all channels contributing the same units. (I believe the GBA behaves this way.) Then a triangle wave (whose pattern is 0123456789ABCDEFFEDCBA9876543210) would have the same amplitude (and one-third the power) as a level 15 square wave. But in fact, an NES triangle wave at $4011=$00 has the same amplitude as two level 12 square waves put together.

Let me explain why the triangle wave still sounds quieter than two level 12 square waves. One reason relates to power. The "power" of a waveform at any given moment is proportional to its amplitude squared; the "RMS power" is the integral of the power over a short time. A triangle wave T with the same amplitude as square wave S has one-third the power of S, but 1.73*T has the same power as S. This is one reason why a triangle wave sounds "quieter" than a square wave. Another reason is that triangle waves have quiet overtones and are usually used for low notes on the NES, meaning their power is concentrated in the low frequencies. Some cheap speakers have less response in these low frequencies, as does the human auditory system, whose response peaks around 3 to 4 kHz and drops by 10 to 15 dB from 500 to 100 Hz.

Contrary to NT2's built-in player, the triangle wave doesn't click when its linear/length counter is turned on ($81) or off ($00).

The amplitude of the triangle, noise, and $4011 tones with $4011=$60 near the maximum value of $4011 is about half of their amplitude with $4011=$00.

The amplitude of noise at that frequency is difficult to measure because so much of its energy is above 22 kHz, the limit of consumer sound cards, but the power of the looped noise sample in this recording is 6 dB below that of the similarly pitched square wave. I should make a different ROM with different noise "pitches" for comparison.

The amplitude of a timed-code 1 kHz square wave tone on $4011 with nominal amplitude 30 is about 2/3 that of a triangle wave tone.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 5 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