Volume tests for NES

_____________________________________________________________________
Background

The NES has four tone generator channels and one digital sample
playback channel:

1. Rectangular pulse ("square") wave
2. Another square wave
3. 32-step triangle wave
4. Binary noise generated by a linear feedback shift register
5. Delta pulse code modulation; also allows writes of raw LPCM to
   the counter for use as a generic 7-bit DAC

Unlike systems such as the GBA, which digitally add all channels
before passing them to a DAC, the NES has a separate DAC for each
channel and mixes them analog.  Nonlinearities in this mixing can
cause one channel to affect the volume of another channel.

The NES uses an unsigned DAC, meaning that each channel can generate
only positive signal values.  Such a DAC generates a lot of DC, and
the NES has a high-pass filter on its audio output to block the DC.
Different emulators use different time constants on their DC filters,
which human listeners generally can't perceive.  So you can't just
measure the maximum voltage; you have to measure the difference
between the high and low values.

Different emulators use different amounts of headroom in the 16-bit
range, depending on what Famicom expansion audio chips are present.
So you have to compare relative volumes, not absolute volumes.

_____________________________________________________________________
The test pattern

This program demonstrates the channel balance among implementations
of the NES architecture.  

The pattern consists of a set of 12 tones, as close to 1000 Hz as
the NES allows:
1. Channel 1, 1/8 duty
2. Channel 1, 1/4 duty
3. Channel 1, 1/2 duty
4. Channel 1, 3/4 duty
5. Channels 1 and 2, 1/8 duty
6. Channels 1 and 2, 1/4 duty
7. Channels 1 and 2, 1/2 duty
8. Channels 1 and 2, 3/4 duty
9. Channel 3
10. Channel 4, long LFSR period
11. Channel 4, short LFSR period
12. Channel 5, amplitude 30

When the user presses A on controller 1, the pattern plays three
times, with channel 5 held steady at 0, 48, and 96.  The high point
of tone 12 each time is 30 units above the level for that time,
that is, 30, 78, and 126 respectively.

_____________________________________________________________________
Recordings

The files in the 'recordings' folder are recordings of volumes.nes
run in various environments.  They were recorded at 44100 Hz and then
encoded using OggDropXPd 1.90 (libvorbis 1.2.0) at -q 7.00.

* nes-001.ogg: Nintendo Entertainment System (NTSC U/C) with PowerPak
* nestopia.ogg: Nestopia 1.40
* nintendulator.ogg: Nintendulator snapshot 2009-02-28
* fceux.ogg: FCEUX 2.0.4-interim 2008-11-24

_____________________________________________________________________
Legal

Copyright (c) 2009 Damian Yerrick

The program and manual are under the following license:

  This work is provided 'as-is', without any express or implied
  warranty. In no event will the authors be held liable for any
  damages arising from the use of this work.

  Permission is granted to anyone to use this work for any
  purpose, including commercial applications, and to alter it and
  redistribute it freely, subject to the following restrictions:

   1. The origin of this work must not be misrepresented; you
      must not claim that you wrote the original work. If you use
      this work in a product, an acknowledgment in the product
      documentation would be appreciated but is not required.
   2. Altered source versions must be plainly marked as such,
      and must not be misrepresented as being the original work.
   3. This notice may not be removed or altered from any
      source distribution.

  The term "source" refers to the preferred form of a work for making
  changes to it. 

