GBA Sound Registers

AdressNameFunction
0x04000060REG_SOUND1CNT_LSound 1 Sweep control
0x04000062REG_SOUND1CNT_HSound 1 Length, wave duty and envelope control
0x04000064REG_SOUND1CNT_XSound 1 Frequency, reset and loop control
0x04000068REG_SOUND2CNT_LSound 2 Lenght, wave duty and envelope control
0x0400006CREG_SOUND2CNT_HSound 2 Frequency, reset and loop control
0x04000070REG_SOUND3CNT_LSound 3 Enable and wave ram bank control
0x04000072REG_SOUND3CNT_HSound 3 Sound lenght and output level control
0x04000074REG_SOUND3CNT_XSound 3 Frequency, reset and loop control
0x04000078REG_SOUND4CNT_LSound 4 Length, output level and envelope control
0x0400007CREG_SOUND4CNT_HSound 4 Noise parameters, reset and loop control
0x04000080REG_SOUNDCNT_LSound 1-4 Output level and Stereo control
0x04000082REG_SOUNDCNT_HDirect Sound control and Sound 1-4 output ratio
0x04000084REG_SOUNDCNT_XMaster sound enable and Sound 1-4 play status
0x04000088REG_SOUNDBIASSound bias and Amplitude resolution control
0x04000090REG_WAVE_RAM0_LSound 3 samples 0-3
0x04000092REG_WAVE_RAM0_HSound 3 samples 4-7
0x04000094REG_WAVE_RAM1_LSound 3 samples 8-11
0x04000096REG_WAVE_RAM1_HSound 3 samples 12-15
0x04000098REG_WAVE_RAM2_LSound 3 samples 16-19
0x0400009AREG_WAVE_RAM2_HSound 3 samples 20-23
0x0400009CREG_WAVE_RAM3_LSound 3 samples 23-27
0x0400009EREG_WAVE_RAM3_HSound 3 samples 28-31
0x040000A0REG_FIFO_A_LDirect Sound channel A samples 0-1
0x040000A2REG_FIFO_A_HDirect Sound channel A samples 2-3
0x040000A4REG_FIFO_B_LDirect Sound channel B samples 0-1
0x040000A6REG_FIFO_B_HDirect Sound channel B samples 2-3

DMG Sound Output Control

OffsetName
0x080REG_SOUNDCNT_L
Bit(s)EffectAccess
2-0DMG Left VolumeRW
3Vin to Left on/off (?)
6-4DMG Right VolumeRW
7Vin to Right on/off (?)
8DMG Sound 1 to left outputRW
9DMG Sound 2 to left outputRW
ADMG Sound 3 to left outputRW
BDMG Sound 4 to left outputRW
CDMG Sound 1 to right outputRW
DDMG Sound 2 to right outputRW
EDMG Sound 3 to right outputRW
FDMG Sound 4 to right outputRW

Notes

  1. This register controls only the DMG output amplifiers and have no effects on the individual sound channels processing, or Direct Sound channels volume.
  2. Vin Left/Right were used on the original gameboy to enable gamepaks to provide their own sound source. It is currently unknown if this function is still supported and working on the GBA.

Direct Sound Output Control Register

OffsetName
0x082REG_SOUNDCNT_H
Bit(s)EffectAccess
1-0Output sound ratio for chan. 1-4 (0=25%,1=50%,2=100%)RW
2Direct sound A output ratio (0=50%, 1=100%)RW
3Direct sound B output ratio (0=50%, 1=100%)RW
7-4Unused
8Direct sound A to right outputRW
9Direct sound A to left outputRW
ADirect sound A Sampling rate timer (timer 0 or 1)RW
BDirect sound A FIFO resetRW
CDirect sound B to right outputRW
DDirect sound B to left outputRW
EDirect sound B Sampling rate timer (timer 0 or 1)RW
FDirect sound B FIFO resetRW

Notes

  1. Output ratios control the output volume. Use when DMG channels or Direct Sound plays too loud relative to each other.
  2. Direct Sound is a dual 8-bit DAC fed by data located in two FIFOs. FIFOs can be loaded manually or automatically in DMA mode when set appropriately. The DMA mode uses the timers specified in bits A and E as the sampling frequency reference. A single timer can be used for both DirectSound A&B. However, 2 DMA channels (1&2) must be used to output two different sounds simultaneously on both channels. Also, DMA channel start mode must be set to 11 to instruct it to repeat on FIFO-empty requests.

Master Sound Output Control/Status

OffsetName
0x084REG_SOUNDCNT_X
Bit(s)EffectAccess
0DMG Sound 1 statusR
1DMG Sound 2 statusR
2DMG Sound 3 statusR
3DMG Sound 4 statusR
6-4Unused
7All sound circuit enable (0=off, 1=on)RW
F-8Unused

Notes

  1. Bits 0-3 are set when their respective sound channels are playing and are resetted when sound has stopped. Note that contrary to some other sources and most emulators, these bits are read-only and do not need to be set to enable the sound channels.
  2. Bit 7 turns on or off the entire sound circuit (DMG and Direct Sound). Keep this bit cleared as often as possible in order to save battery power. Some sources states that it allows batteries to last up to 10% longer.

Sound Bias

OffsetName
0x088REG_SOUNDBIAS
Bit(s)EffectAccess
9-0DC offset bias valueRW
D-AUnused
F-EPWM resampling resolution where:
00=9bit at 32768 Hz
01= 8bit at 65536 Hz
10=7bit at 131072 Hz
11= 6bit at 262144 Hz
RW

Notes

  1. The BIAS setting is used to offset the sound output and bring it back into a signed range. When the BIOS starts up, it runs a timing loop where it slowly raises the BIAS voltage from 0 to 512. This setting should not be changed. At best, the sound will become distorted. At worst the amplifier inside the GBA could be damaged. When accessing bits FE, a read-modify-write is required.
  2. The default value for bits FE is 00. Most if not all games, uses 01 for this setting. More research is being done on this register.

DirectSound FIFO A

OffsetName
0x0A0-0x0A2REG_FIFO_A

0x0A0

Bit(s)EffectAccess
7-08-Bit sample 0W
F-88-Bit sample 1W

0x0A2

Bit(s)EffectAccess
7-08-Bit sample 2W
F-88-Bit sample 3W

Notes

  1. These registers contains the samples required for Direct Sound channel A output.
  2. Reading from this register yields unpredictable results.

DirectSound FIFO B

OffsetName
0x0A4-0x0A6REG_FIFO_B

0x0A4

Bit(s)EffectAccess
7-08-Bit sample 0W
F-88-Bit sample 1W

0x0A6

Bit(s)EffectAccess
7-08-Bit sample 2W
F-88-Bit sample 3W

Notes

  1. These registers contains the samples required for Direct Sound channel B output.
  2. Reading from this register yields unpredictable results.

DMG Channel 1 Sweep control

OffsetName
0x60REG_SOUND1CNT_L
Bit(s)EffectAccess
2-0Sweep shiftsRW
3Sweep increase/decrease:
0=Addition(frequency increases)
1=Subtraction (frequency decreases)
RW
6-4Sweep time:
000: Sweep function is off
001: Ts=1 / 128Khz (7.8 ms)
010: Ts=2 / 128Khz (15.6 ms)
011: Ts=3 / 128Khz (23.4 ms)
100: Ts=4 / 128Khz (31.3 ms)
101: Ts=5 / 128Khz (39.1 ms)
110: Ts=6 / 128Khz (46.9 ms)
111: Ts=7 / 128Khz (54.7 ms)
RW
F-7Unused

Notes

  1. The sound channel 1 produces a square wave with envelope and frequency sweep functions.
  2. This register controls the frequency sweep function. Sweep shifts bits controls the amount of change in frequency (either increase or decrease) at each change. The wave's new period is given by: \( T = T \pm \frac{T}{2^n} \) where n is the sweep shifts value.
  3. Sweep time is the delay between sweep shifts. After each delay, frequency changes repeatedly.
  4. When decrementing, if the frequency value gets smaller than zero, the previous value is retained. When incrementing, if the frequency gets greater than the maximum frequency (131Khz or 2048 for the register value) the sound stops.
  5. When the sweep function is not required, set the sweep time to zero and set the increase/decrease bit to 1.
  6. When Initializing the sound (REG_SOUND1CNT_X bit F=1) using sweeps, re-initialize the sound after 8 clocks or more. Otherwise the sound may stop.

DMG Channel 1 Length, Wave Duty and Envelope Control

OffsetName
0x062REG_SOUND1CNT_H
Bit(s)EffectAccess
5-0Sound lengthW
7-6Wave duty cycle:
00=12.5%
01=25%
10=50%
11=75%
RW
A-8Envelope step timeRW
BEnvelope mode:
0=Envelope decreases
1=Envelope increases
RW
F-CInitial envelope valueRW

Notes

  1. The sound length is an 6 bit value obtained from the following formula: Sound length= (64-register value)*(1/256) seconds.
  2. After the sound length has been changed, the sound channel must be resetted via bit F of REG_SOUND1CNT_X (when using timed mode).
  3. Wave duty cycle control the percentage of the ON state of the square wave.
  4. The envelope step time is the delay between successive envelope increase or decrease. It is given by the following formula: T=register value*(1/64) seconds.
  5. Envelope mode control if the envelope is to increase or decrease in volume over time.
  6. The initial volume of the envelope is controlled by bit F-C. 1111 produces the maximum volume and 0000 mutes the sound.

DMG Channel 1 Frequency, Reset and Loop Control

OffsetName
0x064REG_SOUND1CNT_X
Bit(s)EffectAccess
A-0Sound frequencyW
D-BUnused
ETimed mode:
0=continuous, 1=timed
RW
FSound ResetW

Notes

  1. Frequency can be calculated from the following formula: F(hz)=4194304/(32*(2048-register value)). The minimum frequency is 64Hz and the maximum is 131Khz.
  2. When Bit E (Timed mode) is set to 0, sound 1 is played continuously regardless of the length data in REG_SOUND1CNT_H. When set to 1, sound is played for that specified length and after that, bit 0 of REG_SOUNDCNT_X is reset.
  3. When bit F is set to 1, the envelope is resetted to its initial value and sound restarts at the specified frequency.
  4. Frequency can always be changed without resetting the sound. However, when in continuous mode, alway set the sound lenght to zero after changing the frequency. Otherwise, the sound may stop.

DMG Channel 2 Length, Wave Duty and Envelope Control

OffsetName
0x068REG_SOUND2CNT_L
Bit(s)EffectAccess
5-0Sound lengthW
7-6Wave duty cycle:
00=12.5%
01=25%
10=50%
11=75%
RW
A-8Envelope step timeRW
BEnvelope mode:
0=Envelope decreases
1=Envelope increases
RW
F-CInitial envelope valueRW

Notes

  1. The sound length is an 6 bit value obtained from the following formula: Sound length= (64-register value)*(1/256) seconds.
  2. After the sound length has been changed, the sound channel must be resetted via bit F of REG_SOUND2CNT_H (when using timed mode).
  3. Wave duty cycle control the percentage of the ON state of the square wave.
  4. The envelope step time is the delay between successive envelope increase or decrease. It is given by the following formula: T=register value*(1/64) seconds.
  5. Envelope mode control if the envelope is to increase or decrease in volume over time.
  6. The initial volume of the envelope is controlled by bit F-C. 1111 produces the maximum volume and 0000 mutes the sound.

DMG Channel 2 Frequency, Reset and Loop Control

OffsetName
0x06CREG_SOUND2CNT_H
Bit(s)EffectAccess
A-0Sound frequencyW
D-BUnused
ETimed mode:
0=continuous, 1=timed
RW
FSound ResetW

Notes

  1. Frequency can be calculated from the following formula: F(Hz)=4194304/(32*(2048-register value)). The minimum frequency is 64Hz and the maximum is 131Khz.
  2. When Bit E (Timed mode) is set to 0, sound 2 is played continuously regardless of the length data in REG_SOUND2CNT_L. When set to 1, sound is played for that specified length and after that, bit 1 of REG_SOUNDCNT_X is reset.
  3. When bit F is set to 1, the envelope is resetted to its initial value and sound restarts at the specified frequency.
  4. Frequency can always be changed without resetting the sound. However, when in continuous mode, alway set the sound lenght to zero after changing the frequency. Otherwise, the sound may stop.

DMG Channel 3 Enable and Wave RAM Bank Control

OffsetName
0x070REG_SOUND3CNT_L
Bit(s)EffectAccess
4-0Unused
5Bank Mode (0=2x32, 1=1x64)RW
6Bank Select (Non set bank is written to)RW
7Sound Channel 3 output enableRW
F-8Unused

Notes

  1. The sound channel 3 is a circuit that can produce an arbitrary wave pattern. Samples are 4 bit, 8 samples per word, and are located in Wave Ram registers from 0x400090 to 0x40009F.
  2. In the Gameboy Advance, the Wave Ram is banked, providing the ability to play a 64 samples pattern or to select between two 32 samples patterns (Bit 5). Sound channel 3 always produces some audio artifacts (distortion) when sound is initialized. Fortunately, switching banks does not require re-initialisation during playback, thus allowing for dynamic reloading of the Wave Ram without generating any distortion.
  3. Bit 6 controls which bank is active for playing/reloading. If set to 0, samples are played from bank 0 and writing to the Wave Ram will store the data in Bank 1 and vice-versa.
  4. When bit 7 is set and Initial flag (Bit 15) from REG_SOUND3CNT_X is set, the wave pattern starts to play.
  5. Both banks of Wave Ram are filled with zero upon initialization of the Gameboy, Bank 0 being selected. So writing to bank 0 implies setting bit 6 to 1 before loading Wave Ram then set it back to 0 to play it. Most emulator currently ignore banks.

DMG Channel 3 Sound Length and Output Level Control

OffsetName
0x072REG_SOUND3CNT_H
Bit(s)EffectAccess
7-0Sound lengthW
C-8Unused
F-DOuput volume ratio:
000=Mute
001=100%
100=75%
010=50%
011=25%
RW

Notes

  1. The sound length is an 8 bit value obtained from the following formula: Register=Note length(in seconds)*256, hence a 1 second maximum and a 3.9 millisecond minimum sound duration.
  2. After the sound length has be changed, the sound channel must be resetted via bit F of REG_SOUND3CNT_H (when using timed mode).

DMG Channel 3 Frequency, Reset and Loop Control

OffsetName
0x074REG_SOUND3CNT_X
Bit(s)EffectAccess
A-0Sound frequencyW
D-BUnused
ETimed mode:
0=continuous, 1=timed
RW
FSound ResetW

Notes

  1. Frequency can be calculated from the following formula: F(Hz)=4194304/(32*(2048-register value)). The minimum frequency is 64Hz and the maximum is 131Khz.
  2. When Bit E (Timed mode) is set to 0, sound 3 is played continuously regardless of the length data in REG_SOUND3CNT_H. When set to 1, sound is played for that specified length and after that, bit 2 of REG_SOUNDCNT_X is reset.
  3. When bit F is set to 1, sound resets and restarts at the specified frequency. Frequency and sound reset must be performed in a single write since both are write only.
  4. Note that in continuous mode, frequency can be changed without resetting the sound channel. However, when in continuous mode, alway set the sound lenght to zero after changing the frequency. Otherwise, the sound may stop.

DMG Channel 3 Wave RAM Registers

OffsetName
0x090-0x09FREG_WAVERAM0-3
Bit(s)EffectAccess
3-04-bit sample 0RW
7-44-bit sample 1RW
B-84-bit sample 2RW
F-C4-bit sample 3RW

Notes

  1. Wave ram spans four 32 bit registers.
  2. Take into account that ARM store 32bit words in little-indian format. So if you load REG_WAVERAM0=0x01234567, in reality, the sample played will be 6-7-4-5-2-3-0-1.

DMG Channel 4 Length, Output Level and Envelope Control

OffsetName
0x78REG_SOUND4CNT_L
Bit(s)EffectAccess
5-0Sound lengthW
7-6Unused
A-8Envelope step timeRW
BEnvelope mode:
0=Envelope decreases
1=Envelope increases
RW
F-CInitial envelope valueRW

Notes

  1. The sound length is an 6 bit value obtained from the following formula: Sound length= (64-register value)*(1/256) seconds.
  2. After the sound length has been changed, the sound channel must be resetted via bit F of REG_SOUND4CNT_H (when using timed mode).
  3. The envelope step time is the delay between successive envelope increase or decrease. It is given by the following formula: T=register value*(1/64) seconds.
  4. Envelope mode control if the envelope is to increase or decrease in volume over time.
  5. The initial volume of the envelope is controlled by bit F-C. 1111 produces the maximum volume and 0000 mutes the sound.

DMG Channel 4 Noise Parameters, Reset and Loop Control

OffsetName
0x07CREG_SOUND4CNT_H
Bit(s)EffectAccess
2-0Clock divider frequency (with f=4.194304 Mhz/8)
000: f*2
001: f
010: f/2
011: f/3
100: f/4
101: f/5
110: f/6
111: f/7
RW
3Counter stages:
0=15 stages, 1=7 stages
RW
7-4Counter Pre-Stepper frequency (with Q=clock divider's output frequency):
0000: Q/2
0001: Q/2^2
0010: Q/2^3
0011: Q/2^4
....
1101: Q/2^14
1110: Not used
1111: Not used
RW
D-8Unused
ETimed mode:
0=continuous, 1=timed
RW
FSound ResetW

Notes

  1. Channel 4 produces pseudo-noise generated by a polynomial counter. It is based on a 7/15 stages linear-feedback shift register (LFSR). LFSR counts in a pseudo-random order where each state is generated once and only once during the whole count sequence. The sound is produced by the least significant bit's output stage.
  2. A Clock divider controlled by bits 0-2 divides the CPU frequency. Its output is then fed into the counter's pre-scaler (controlled by bits 4-7) which divides further more the frequency.
  3. The Counter stages controls the period of the polynomial counter. It is given by (2^n)-1 where n=number of stages. So for n=7, the pseudo-noise period lasts 63 input clocks. After that, the counter restarts the same count sequence.
  4. When Bit E (Timed mode) is set to 0, sound 4 is played continuously regardless of the length data in REG_SOUND4CNT_L. When set to 1, sound is played for that specified length and after that, bit 3 of REG_SOUNDCNT_X is reset.
  5. When bit F is set to 1, Envelope is set to initial value, the LFSR count sequence is resetted and the sound restarts.
  6. Note that in continuous mode, all parameters can be changed but sound need to be resetted when modifying the envelope initial volume or the clock divider for changes to take effects.

Acronyms used

AcronymMeaning
DACDigital-to-Analog Converters
DMADirect Memory Access
DMGThe original gameboy (Dot Matrix Game)
FIFOFirst-In-First-Out