Developers on the Game Boy Advance platform have often complained of clicks in their programs' audio output. These clicks tend to arise when the programmer chooses a sample rate such that the number of samples played per frame is not a whole number. There exist only a few "nice" sample rates on the GBA that will result in clickless playback when switching sample buffers in vblank; this tool searches for them.
In computer engineering, the term "divider" refers to a circuit that generates one output pulse for every n input pulses, where n denotes a positive integer called the divisor. A "fixed divider" has a fixed divisor; a "programmable divider" has a means for other devices to control the divisor within a given range.
First, I'll give a model of a typical audio playback system's variable rate DAC (digital to analog converter).
Nintendo designed the Game Boy Advance system's PCM channels with master clock rate 16777216 Hz and fetch width 16 samples. The GBA also has four programmable clock dividers, one of which the PCM hardware uses to determine the sample period. Some game engines use a second programmable divider for the frame divider, but I find this a bit too unpredictable in practice given that the video and the rest of the game engine run off the video hardware's vblank divider, which runs at 280896*n master clock cycles, where n denotes a positive integer representing the number of video frames corresponding to the length of one block of audio samples.
The script in this page generates periods (and corresponding buffer sizes and sample rates) such that an integral number of fetches occur within one frame. First make sure you're on a relatively recent web browser that supports the HTML DOM (such as IE 6 or Mozilla), and turn on scripting. Then fill in this form, click Update, and read good rates from the table.
Period (cycles) |
Buffer length (bytes) |
Sample rate (hertz) |
---|---|---|
© 2000–2019 Damian Yerrick. Some rights reserved: except where otherwise indicated, this site is free content, licensed under your choice of Creative Commons Attribution-ShareAlike 2.5 or GNU Free Documentation License 1.2. Terms apply.