The Nintendo DS hardware has 16 audio channels that support 16-bit audio (PCM16) at a sample rate of 32,768 Hz. However, the mixer limits the output to 10 bits (-200h
to 1FFh
). From GBATEK:
When configured to max volume (and left-most or right-most panning), each channel can span the full 10bit output range (-200h..1FFh) on one speaker, as well as the full 16bit input range (-8000h..7FFFh) on one capture unit.
The document goes on to explain that this is done by the mixer applying the master volume biases:
After applying the master volume, the signed left/right audio signals are in range -200h..+1FFh
[...]
sampling frequency after mixing with PWM modulation is 32.768 kHz with an amplitude resolution of 10 bits.
The memory register at 4000500h
has a bit which can disable the master volume:
4000500h - NDS7 - SOUNDCNT - Sound Control Register (R/W)
Bit0-6 Master Volume (0..127=silent..loud)
Bit7 Not used (always zero)
Bit8-9 Left Output from (0=Left Mixer, 1=Ch1, 2=Ch3, 3=Ch1+Ch3)
Bit10-11 Right Output from (0=Right Mixer, 1=Ch1, 2=Ch3, 3=Ch1+Ch3)
Bit12 Output Ch1 to Mixer (0=Yes, 1=No) (both Left/Right)
Bit13 Output Ch3 to Mixer (0=Yes, 1=No) (both Left/Right)
Bit14 Not used (always zero)
Bit15 Master Enable (0=Disable, 1=Enable)
Bit16-31 Not used (always zero)
Is it possible to utilize bit 15 (Master Enable) to get around this limitation?
If not, is there any other way?
Note that the bit-widths at each step of the mixing are described in the following table, and the above description makes me wonder if the clipping step can be skipped by disabling Master Enable:
Channel/Mixer Bit-Widths
Step Bits Min Max
0 Incoming PCM16 Data 16.0 -8000h +7FFFh
1 Volume Divider (div 1..16) 16.4 -8000h +7FFFh
2 Volume Factor (mul N/128) 16.11 -8000h +7FFFh
3 Panning (mul N/128) 16.18 -8000h +7FFFh
4 Rounding Down (strip 10bit) 16.8 -8000h +7FFFh
5 Mixer (add channel 0..15) 20.8 -80000h +7FFF0h
6 Master Volume (mul N/128/64) 14.21 -2000h +1FF0h
7 Strip fraction 14.0 -2000h +1FF0h
8 Add Bias (0..3FFh, def=200h) 15.0 -2000h+0 +1FF0h+3FFh
9 Clip (min/max 0h..3FFh) 10.0 0 +3FFh
I'm aware that the DSi does full 16-bit PCM at 48 kHz, but I'm interested in the models that lacked overkill sound hardware.