SDL Mixer X

SDL Mixer X - SDL Mixer EXtended (SDL2_mixer_ext) - a fork from SDL mixer version 2.0 which an extension for Simple DirectMedia Layer (SDL) library which giving a complex audio functions, mainly for sound mixing.

This part appending to SDL additional functions which are giving able to play more sound and music formats.

SDL Mixer X used in the PGE Project as part of default audio engine and also included by Wohlstand and Kevsoft into the LunaLUA to replace the MCI audio engine to take able play more music formats inside SMBX. SMBX-38A also uses SDL Mixer X since 1.4.2 version. Because that built on VisualBasic 6, VB6 Wrapper has been made. Assembly with VB6 binding support (SDL2MixerVB.dll) has statically linked SDL2 library, but with Audio-only support, other SDL subsystems are not binded yet.

Because original SDL Mixer has some issues, Wohlstand has been forked it to resolve them and also implement a new features to it.

Music Formats
SDL Mixer X have support for playback for next formats which can be played in the music stream:

Standard music formats

WAV 	Microsoft PCM, Uncompressed audio (hardcoded) VOC 	Creative Labs Audio File (hardcoded) MP3 	MPEG-2 Layer 3, Lossy data compressed audio (libMAD) OGG 	OGG Vorbis, Lossy data compressed audio (libOGG) FLAC 	Free Lossless Audio Codec, Loss-less compressed (libFLAC) MIDI 	Music Instrument Digital Interface, commands list (libADLMIDI, Timidity (hardcoded), Fluidsynth (Usually not built with SDL Mixer X, but possible to use it) ) IMF      Id-Software Music File (will work only if ADLMIDI MIDI device will be toggled). Supported IMF-files which are has length chunk in begin and uses 700Hz of the ticks rate. (Tip: If your IMF-files are playing with wrong tempo or rejecting as invalid files, you have to use this utility to convert frequency and automatically add length chunk into file begin).

Game music emulators formats

All Game Music Emulators formats are provided with GME library.

Note: There are not supported in official (at libsdl.org) builds of SDL2_mixer but support was implemented in the modified version of this library which usually includes with LunaLUA and with PGE Project package.

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

Tracker music formats

All tracker music formats are provided with libModPlug library.

669 	Composer 669, Unis 669 AMF 	DSMI Advanced Module Format AMF 	ASYLUM Music Format V1.0 APUN 	APlayer DSM 	DSIK internal format FAR 	Farandole Composer GDM 	General DigiMusic IT 	Impulse Tracker IMF 	Imago Orpheus (MikMod-based assembly only. ModPlug results better sound quality, but it doesn't supports this format) MOD 	15 and 31 instruments MED 	OctaMED MTM 	MultiTracker Module editor OKT 	Amiga Oktalyzer S3M 	Scream Tracker 3 STM 	Scream Tracker STX 	Scream Tracker Music Interface Kit ULT 	UltraTracker UNI 	MikMod XM 	FastTracker 2

SFX Formats
SDL Mixer X have a support for playback for next sound effects which can be preloaded into memory played in difference channels with mixing:

WAV 	Microsoft PCM, Uncompressed audio VOC 	Creative Labs Audio File OGG 	OGG Vorbis, Lossy data compressed audio FLAC 	Free Lossless Audio Codec, Loss-less compressed MP3 	MPEG-2 Layer 3, Lossy data compressed audio (Note: before update since February 2 2016 MP3 chunks are not supported!)

Differences and improvements in comparison to original SDL Mixer

 * Added much more music formats (Such a game music emulators)
 * Added support of the loop points in the OGG files (via LOOPSTART and LOOPEND (or LOOPLENGHT) meta-tags)
 * In the Modplug module enabled internal loops (tracker musics with internal loops are will be looped rightly)
 * Added ability to append custom config path for Timidity synthesizer
 * Forked version now has ADLMIDI midi sequences together with Native MIDI, Timidity and Fluidsynth. ADLMIDI is OPL-Synth Emulation based MIDI player.
 * Added new API functions
 * Ability to redefine Timidity patches path. So, patches folders are can be stored in any place!
 * Added functions to retrieve some meta-tags: Title, Artist, Album, Copyright
 * Added ADLMIDI Extra functions: Change bank ID, enable/disable high-level tremolo, enable/disable high-level vibrato, enable/disable scalable modulation
 * Own re-sampling implementation which avoids glitches caused with inaccurate re-sampler implementation from SDL.
 * Added support of extra arguments in the tail of the file path, passed into Mix_LoadMUS function.

Path arguments
SDL Mixer X has support of additional path arguments in the Mix_LoadMUS function to allow changing of some decoding properties.

Game music emulators formats

Alone argument - integer from 0 to n - a number of the track from multi-track file formats like NSF, NSFE, HES, GBS, etc.

Example: mymusic.nsf|21

MIDI

Accepts list of letter-marked integer arguments separated by semicolons.

Example: mymusic.mid|s0;b62;t0;v0;a0;m0; All arguments are optional. Last argument must be closed with semicolon.
 * s - Synthesizer type:
 * 0 - ADLMIDI, emulated OPL3 synthesizer with loop tags support. Working by Default. (Recorded examples to listen are presented here)
 * 1 - Timidity, requires patches bank in the "timidity" folder in the application path (can be customized with "MIX_Timidity_addToPathList(const char*path)" function called before library initialization) **
 * 2 - Native MIDI, uses default operating system MIDI interface. Not supports loop tags.***
 * b - (ADLMIDI) Set bank ID (look for available banks list into PGE MusPlay application to preview them). Default is 58.
 * t - (ADLMIDI) Deep tremolo (1 or 0), increase amplitude of tremolo effect for instruments which are using tremolo OPL flag. Default 1.
 * v - (ADLMIDI) Deep vibrato (1 or 0), increase amplitude of vibrato effect for instruments which are using vibrato OPL flag. Default 1.
 * a - (ADLMIDI) Enables AdLIB drums mode (1 or 0), enables legacy OPL2 drums mode. Default 0.
 * m - (ADLMIDI) Enables scalable modulation (1 or 0), Allows dynamic scaling of the modulator result with volume. Default 0.

** Note for Timidity: If you wish it works, you must have one of banks in GUS format which you can take here or in any other place around Internet.

*** Note for Native MIDI: Pausing is not works with Native MIDI on Windows. Fade-IN/OUT and volume manipulation on Windows with "Microsoft GS Wavetable synthesizer" driver may cause global mixer volume changing which can cause confusion. To avoid this effect, you can install a custom MIDI sequencer (for example software Yamaha XG, Virtual Sound Convas, Virtual OPL3 Driver (Not works on WinXP, MIDI device switch tool has been included), or plug a hardware MIDI synthesizer if you have it).

Preview examples of difference between ADLMIDI flags

Issues
Here is a list of known issues of SDL Mixer v2.0 library:
 * Fade-IN in some cases is not working correctly, but Fade-Out working perfectly [Fixed]
 * Official build of SMPEG library can't play MP3 on Windows and Linux system, but on some Mac OS computers it working fine. To fix this issue need a rebuild of SDL_mixer library with using of libMAD library. (libMAD is GPL-licenced [not LGPL], and if you will build (or use pre-built with libMAD) SDL Mixer X in your project, you should license it with GPL too!).
 * Wrongly working real-time re-sampling of music files to get fit into united audio stream. For example, musics with sample rate less than sample rate of stream will cause soft breakthroughs of playback. But if musics have a sample rate more than sample rate of stream will cause noisy playback. (for example, musics with 32000 Hz will be played with breakthroughs in the 44100 Hz stream, but in the same stream musics with 48000 Hz will be played noisy and buggy). To escape this issue you should re-sample your music file manually to get correct playback in the defined sample rate of stream. [Fixed]

Links

 * Official documentation of SDL Mixer library API
 * Source code of a forked SDL Mixer version by Wohlstand (SDL Mixer X) (Building with qmake && make from Qt 5).