Blargg's Audio Libraries

Home | News | Info | Code | Misc | Contact

These libraries perform audio synthesis and are based on an efficient band-limited sound algorithm that provides good sound quality in several game music players and NES emulators.

The libraries are written in portable C++ (some provide a C interface as well) and licensed under the GNU Lesser General Public License (LGPL). They should work well even with older C++ compilers and have been compiled on many platforms: Windows, Linux for several architectures, Mac OS X, Mac OS Classic, MorphOS (Amiga), PlayStation Portable, GP2X, and Nintendo DS. An archive of previous releases is available in case the latest version doesn't work. Post to the discussion forum for help or to give feedback.


Game_Music_Emu

Game_Music_Emu emulates game music in several popular file formats:

FormatSystem
AYZX Spectrum, Amstrad CPC
GBSNintendo Game Boy
GYMSega Genesis, Mega Drive
HESNEC TurboGrafx-16, PC Engine
KSSMSX Home Computer, other Z80 systems (doesn't support FM sound)
NSF, NSFENintendo NES, Famicom (with VRC 6, Namco 106, and FME-7 sound)
SAPAtari systems using POKEY sound chip
SPCSuper Nintendo, Super Famicom
VGM, VGZSega Master System, Mark III, Sega Genesis, Mega Drive, BBC Micro

Game_Music_Emu works in C and C++ and has been made very easy to use. Sound is generated using high-quality yet efficient band-limited synthesis. Substantial documentation and examples are provided, including a mini player using SDL. Modular design gives flexibility and allows easy elimination of unused features and music formats.

Game_Music_Emu-0.5.2.zip (C and C++)

  • Tons of changes and improvements
  • New file formats: AY, HES, KSS, SAP, NSFE
  • All-new comprehensive C interface (also usable from C++). Simplifies many things, especially file loading, and brings everything together in one header file (gme.h).
  • Information tags and track names and times can be accessed for all game music formats
  • New features supported by all emulators: end of track fading, automatic silence detection, adjustable song tempo, seek to new time in track
  • Updated mini player example to support track names and times, echo, tempo, and channel muting, and added visual waveform display
  • Added BLIP_BUFFER_FAST flag to blargg_config.h to use a lower quality bandlimited synthesis in "classic" emulators, which might help performance on ancient processors
  • Improved performance a bit for x86 platforms
  • Eliminated all warnings when compiling with the gcc 4.0 compiler and many on Microsoft Visual C++

Patches

This library is used in: foo_gep (Foobar2000), Game Music Box (Mac Classic/OS X), Audio Overload (Windows, Linux, OS X), Audacious Media Player (Linux), Fox Audio Player (Linux, Windows), Geronto.player (Amiga), OldPlay (GP2X), ZsnexBox (Xbox), Modo (PSP)


Blip_Buffer

Blip_Buffer implements an efficient band-limited sound buffer for high-quality emulation of sound chips. After setting the source clock rate and output sample rate, sound waves are made by specifying the time points where amplitude changes occur. Samples can be read from the buffer at any time. It also supports adjustable low-pass filtering (treble) and high-pass filtering/DC removal (bass).

Blip_Buffer-0.4.0.zip (C++)

  • Rewrote demos to have optional live playback with waveform display, using SDL
  • Improved sound quality due to new 32-bit internal sample buffer and better filter implementation
  • Added examples of how to efficiently read samples as floating-point, and unsigned 16-bit and 8-bit
  • Trimmed library down to just two source files
  • Improved documentation

This library is used in: Mednafen, FamiTracker (Windows), and the sound libraries on this page


Nes_Snd_Emu

Nintendo NES 2A03 APU sound chip emulator.

Nes_Snd_Emu-0.1.7.zip (C++)

  • Added simplified version of APU to make it easy to get started
  • Added Konami VRC6 and Namco 106 sound chip emulators
  • Added support for APU's non-linear output
  • Added demo of using SDL sound, along with helpful Sound_Queue
  • Improved documentation
  • Redid state snapshot support

This library is used in: Nemulator (Windows), aNESe (Windows), Reminesce (Windows), Game_Music_Emu (above)


Gb_Snd_Emu

Game Boy PAPU sound chip emulator.

Gb_Snd_Emu-0.1.4.zip (C++)

  • Added simplified version of APU and demo using SDL sound to make it easy to get started
  • Added Kode54's accuracy fixes for GBC differences
  • Implemented workaround for MSVC++ 6 compiler limitations, allowing it to work again
  • Added sample clamping to Blip_Buffer::read_samples(), allowing higher volume with little distortion

This library is used in: Mednafen, VBA-M (Windows, Linux), Game_Music_Emu (above)


Sms_Snd_Emu

Sega Master System SN76489 PSG sound chip emulator. Supports Game Gear stereo channel assignment register.

Sms_Snd_Emu-0.1.1.zip (C++)

  • Moved VGM player functionality to Game_Music_Emu library
  • Changed noise oscillator to handle a period of 0 so it will work in a Genesis emulator
  • Updated to Blip_Buffer 0.3.0
  • Various improvements and optimizations

snes_spc

Super Nintendo (SNES) SPC-700 APU emulator and S-DSP emulators. Includes full APU emulator with save state support and SPC music file dumping. Also includes two S-DSP emulators that can be used on their own: one highly accurate, the other three times faster. The DSP emulators are based on past research by others and hundreds of hours of recent research by me. The accurate DSP passes over a hundred strenuous timing and behavior validation tests that were also run on the SNES. As far as I know, it's the first DSP emulator with cycle accuracy, properly emulating every DSP register and memory access at the exact SPC cycle it occurs at, whereas previous DSP emulators emulated these only to the nearest sample (which occurs every 32 clocks).

snes_spc-0.9.0.zip (C and C++)

  • First public release
  • Next release of Game_Music_Emu will use this library internally for SPC playback

This library is used in: bsnes, ZSNES