Tech News
← Back to articles

Game Boy Advance Audio Interpolation

read original related products more articles

This post describes an audio enhancement that a Game Boy Advance emulator can implement to reduce audio aliasing and noise, at a fairly high level.

To start with, here’s a comparison from Metroid: Zero Mission as an example of what this can do:

Much cleaner! The second recording does sound a little more muffled, but I’ll take that over the horrible audio aliasing in the first recording.

There are some alternative approaches to improving GBA audio that produce higher-quality results, such as NanoBoyAdvance’s excellent MP2K HQ feature, but the interpolation approach is notable in that it works with any GBA game (though quality can vary by game). MP2K HQ for example only works with games that use the MP2K audio driver (aka M4A aka Sappy), which is many games but not every game.

This approach is not particularly novel - VBA-M has supported enhanced audio interpolation for a very long time. I believe the implementation details are a bit different though.

The previous post goes into more detail on how the GBA audio hardware works, but to summarize the part that’s most relevant for improving audio interpolation:

The GBA audio hardware outputs the final mixed audio samples using PWM at 1 of 4 possible sampling frequencies ranging from 32768 Hz to 262144 Hz. The vast majority of GBA games use 65536 Hz, though occasionally you’ll see 32768 Hz (e.g. Castlevania: Circle of the Moon).

The GBA resamples from each audio channel’s frequency to the PWM sampling frequency by applying nearest neighbor interpolation, i.e. just outputting the channel’s current sample. This causes extremely noticeable audio aliasing in the final audio output, particularly when games use very low sample rates with the 2 PCM channels, which many games unfortunately do - sample rates in the 10000-14000 Hz range are very common (e.g. the Metroid example above is 13379 Hz).

The core idea behind enhancing interpolation is fairly simple: what if, instead of accurately emulating how the GBA PWM hardware works, the emulator uses its own interpolation algorithm to resample from audio channels’ sample rates directly to the emulator’s audio output sample rate?

The first step is figuring out the source sample rate to resample from.

... continue reading