Allows you to play various game music formats, including:

AY - ZX Spectrum/Amstrad CPC
GBS - Nintendo Game Boy
GYM - Sega Genesis/Mega Drive
HES - NEC TurboGrafx-16/PC Engine
KSS - MSX Home Computer/other Z80 systems (doesn't support FM sound)
NSF/NSFE - Nintendo NES/Famicom (with VRC 6, Namco 106, and FME-7 sound)
SAP - Atari systems using POKEY sound chip
SPC - Super Nintendo/Super Famicom
VGM/VGZ - Sega Master System/Mark III, Sega Genesis/Mega Drive,BBC Micro

The externals use the game-music-emu library, which can be found here: https://bitbucket.org/mpyne/game-music-emu/wiki/Home

[gme~] has 2 outlets for left and right audio channels, while [gmes~] is a multi-channel variant that has 16 outlets for 8 voices, times 2 for stereo.
[gmes~] only works for certain emulator types that have implemented a special class called Classic_Emu. These types include AY, GBS, HES, KSS, NSF, SAP, and sometimes VGM. You can try loading other formats into [gmes~] but most likely all you'll get is a very sped-up version of the song and the voices will not be separated into their individual channels. Under Linux, [gmes~] doesn't appear to work even for those file types.
Luckily, there's a workaround which involves creating multiple instances of [gme~] and dedicating each one to a specific voice/channel. I've included an example of how that works in the zip file.

Methods

  • [ info ( - Post game and song info, and track number in the case of multi-track formats
    • this currently does not include .rsn files, though I plan to make that possible in the future. Since .rsn is essentially a .rar file, you'll need to first extract the .spc's and open them individually.
  • [ path ( - Post the file's full path
  • [ read $1 ( - Reads the path of a file
    • To get gme~ to play music, start by reading in a file, then send either a bang or a number indicating a specific track.
  • [ goto $1 ( - Seeks to a time in the track in milliseconds
    • Still very buggy. It works well for some formats and not so well for others. My guess is it has something to do with emulators that implement Classic_Emu.
  • [ tempo $1 ( - Sets the tempo
    • 0.5 is half speed, while 2 is double. It caps at 4, though I might eventually remove or increase the cap if it's safe to do so.
  • [ track $1 ( - Sets the track without playing it
    • sending a float to gme~ will cause that track number to start playing if a file has been loaded.
  • [ mute $1 ... ( - Mutes the channels specified.
    • can be either one value or a list of values.
  • [ solo $1 ... ( - Mutes all channels except the ones specified.
    • it toggles between solo and unmute-all if it's the same channel(s) being solo'd.
  • [ mask ($1) ( - Sets the muting mask directly, or posts its current state if no argument is given.
    • muting actually works by reading an integer and interpreting each bit as an on/off switch for a channel.
    • -1 mutes all channels, 0 unmutes all channels, 5 would mute the 1st and 3nd channels since 5 in binary is 0101.
  • [ stop ( - Stops playback.
    • start playback again by sending a bang or "play" message, or a float value
  • [ play | bang ( - Starts playback or pauses/unpauses when playback has already started, or restarts playback if it has been stopped.
    • "play" is just an alias for bang in the event that it needs to be interpreted as its own unique message.

Creation args

Both externals optionally take a list of numbers, indicating the channels that should be played, while the rest get muted. If there are no creation arguments, all channels will play normally.

Note: included in the zip are libgme.* files. These files, depending on which OS you're running, might need to accompany the externals. In the case of Windows, libgme.dll almost definitely needs to accompany gme(s)~.dll
Also, gme can read m3u's, but not directly. When you read a file like .nsf, gme will look for a file that has the exact same name but with the extension m3u, then use that file to determine track names and in which order the tracks are to be played.

gme.zip