Skip to content
Vitaly Novichkov edited this page Oct 3, 2023 · 16 revisions

game-music-emu

game-music-emu is a collection of audio emulators for assorted video game console hardware. It was originally developed by Blargg and used as the basis for several other software products before being converted into a library. It was then fixed to build on additional platforms and is used to support audio plugins for other libraries, such as GStreamer and FFmpeg.

Latest Release

The latest release is version 0.6.3, which includes a couple of years' worth of feature changes and bugfixes.

The next version will including minor API changes and thus be a 0.7.x release.

Source

The last released tarball (for version 0.6.3) is available from the Releases page.

  • Michael Pyne, 2020-02-24

Building game-music-emu

You'll need at least CMake version 2.6.

Then you'll need to do something like this: (note these are Linux/UNIX instructions. Although CMake should work on Mac OS X and Windows I don't have those systems available to test, and you can always still build it yourself like you could before :P):

#!sh
$ tar xjvf game-music-emu-0.6.3.tar.bz2
$ cd game-music-emu-0.6.3
$ mkdir build
$ cd build
$ cmake ../ -DCMAKE_INSTALL_PREFIX=/usr/local # See below for more options
$ make && sudo make install

  • The cmake ../ part is to run CMake, passing the parent directory (../) as the source directory.
  • -D for CMake begins a definition, so -DCMAKE_INSTALL_PREFIX=/usr/local sets the CMAKE_INSTALL_PREFIX (where CMake installs to) to /usr/local. You can change this to be anywhere you'd like to install game-music-emu.
  • Compiling in only certain game music emulators is supported. By default, all available types are compiled in. You can remove a type by passing -DUSE_GME_type=FALSE on the command line when running CMake. Make sure to pass more than one if you have more than one type to remove. The valid options are listed below:

Emulator types

Emulator type CMake option
Spectrum ZX -DUSE_GME_AY=0
Game Boy -DUSE_GME_GBS=0
Sega Genesis -DUSE_GME_GYM=0
NEC PC Engine / TurboGrafx-16 -DUSE_GME_HES=0
MSX / Other Z80 -DUSE_GME_KSS=0
NES -DUSE_GME_NSF=0
NES Extended support -DUSE_GME_NSFE=0
Atari SAP -DUSE_GME_SAP=0
SNES -DUSE_GME_SPC=0
Sega VGM/VGZ -DUSE_GME_VGM=0

Note that some emulator code is shared. For instance the audio processing code used by Spectrum ZX happened to also be used by PC Engine, so if you select PC Engine and disable Spectrum ZX, you may notice a bit of code still being used, but this is not an error.

Other CMake flags

Feature CMake option
SPC isolated echo buffer -DGME_SPC_ISOLATED_ECHO_BUFFER=ON (off by default)
MAME YM2612 emulator (VGM/VGZ) (GPL licensed) -DGME_YM2612_EMU=MAME
GENS YM2612 emulator (VGM/VGZ) -DGME_YM2612_EMU=GENS
"Nuked" YM2612 emulator (VGM/VGZ) -DGME_YM2612_EMU=Nuked
Build framework instead of a dylib (macOS only) -DBUILD_FRAMEWORK=ON (off by default)
Enable undefined behavior runtime error checker -DENABLE_UBSAN=OFF (on by default)
Build static library -DBUILD_SHARED_LIBS=OFF (on by default)

Detecting conditionally compiled emulators

If you're a developer using libgme the only public API is the one defined in gme/gme.h

This API includes a gme_type_list() function, which you must call at runtime. It returns a NULL-terminated list of available types (alternately, you can simply try to play a file and allow libgme to fail if it doesn't support it).

Testing

To test the library, you can use the included (and very simple) GUI player application (which requires libSDL) in the player/ directory. It is not built by default, but you can cd to the game-music-emu/build/player directory and run make from there after you've already run CMake.

From there just run ./player /path/to/file on any supported file type.

Bindings

There are unofficial Rust-based bindings to game-music-emu. See https://github.com/JayPavlina/Game-Music-Emu-Rust

Contact

If you have issues building you can contact Michael Pyne at mpyne at kde org. I know a bit about emulation but absolutely nothing about the actual internals of how any of the emulator cores operate, so you'll still need to ask blargg or someone else if you have troubles with the actual operation of the emulators. But fair warning, no one else seems to still be around.

Old Location

game-music-emu moved to Bitbucket in 2015 since the old Google Code repository was closed down. Blargg (the original author) no longer has time to maintain the code, so it's being kept on life support by Michael Pyne. If you're interested in continuing development or maintenance please get in touch, though I will continue to provide security and other minor fixes as I can in the meantime.

Clone this wiki locally