User Manual/Appendix: Music and sound
Some games (such as Sam & Max Hit the Road) only contain music in the form of MIDI data. At one time, this prevented music for these games from working on platforms that do not support MIDI, or soundcards that do not provide MIDI drivers (e.g. many soundcards will not play MIDI under Linux). ScummVM can now emulate MIDI mode using AdLib, FluidSynth MIDI or MT-32 emulation modes: on most operating systems and for most games, ScummVM will by default use AdLib emulation for music playback. However, if you are capable of using native MIDI, we recommend using one of the Native MIDI drivers below for best sound and performance. This may require manual configuration on some systems.
|null||Null output: don't play any music|
|adlib||Internal AdLib emulation (default)|
|fluidsynth||FluidSynth MIDI emulation|
|mt32||Internal MT-32 emulation|
|pcjr||Internal PCjr emulation (only usable in SCUMM games)|
|pcspk||Internal PC Speaker emulation|
|towns||Internal FM-TOWNS YM2612 emulation (only usable in SCUMM FM-TOWNS games)|
|CAMD||Amiga MIDI (Commodore Amiga MIDI Driver - Amiga only).|
|windows||Windows MIDI (Windows only). Uses built-in sequencer|
|core||CoreAudio sound (Mac OS X only)|
|coremidi||CoreMIDI sound (Mac OS X only). Use only if you have a hardware MIDI synthesizer|
|alsa||Output using ALSA sequencer device (Unix only)|
|seq||Use /dev/sequencer for MIDI (Unix only)|
|timidity||Connect to TiMidity++ MIDI server|
You can either select a sound driver using the Launcher, or run ScummVM with the the '-e' option (see Command line options), for example:
scummvm -eadlib monkey2
By default an AdLib card will be emulated and ScummVM will output the music as sampled waves. This is the default mode for most games, and offers the best compatibility between machines and games. Up to version 0.13.1 only one emulator was available (the MAME OPL emulator). After version 0.13.1 the DOSBox OPL emulator has been added. However this emulator is still experimental.
FluidSynth MIDI emulation
If ScummVM was build with libfluidsynth support it will be able to play MIDI music through the FluidSynth driver. You will have to specify a SoundFont to use, however. Since the default output volume from FluidSynth can be fairly low, ScummVM will set the gain by default to get a stronger signal. This can be further adjusted using the --midi-gain command-line option, or the "midi_gain" config file setting.
The setting can take any value from 0 through 1000, with the default being 100. (This corresponds to FluidSynth's gain settings of 0.0 through 10.0, which are presumably measured in decibel.)
NOTE: The processor requirements for FluidSynth can be fairly high in some cases. A fast CPU is recommended.
Some games which contain MIDI music data also have improved tracks designed for the MT-32 sound module. ScummVM can now emulate this device, however you must provide original MT-32 ROMs to make it work:
MT32_PCM.ROM - IC21 (512KB) MT32_CONTROL.ROM - IC26 (32KB) and IC27 (32KB), interleaved byte-wise
Place these ROM's in the game directory, in your extrapath, or in the directory where your ScummVM executable resides.
You don't need to specify --native-mt32 with this driver, as it automatically gets turned on.
NOTE: The processor requirements for the emulator are quite high; a fast CPU is strongly recommended.
Native MIDI drivers
Use the appropriate -e<mode> command line option from the list above to select your preferred MIDI device. For example, if you wish to use the Windows MIDI driver, use the -ewindows option.
Sequencer MIDI (Unix only)
If your soundcard driver supports a sequencer, you may set the environment variable "SCUMMVM_MIDI" to your sequencer device -- for example, to /dev/sequencer
If you have problems with not hearing audio in this configuration, it is possible you will need to set the "SCUMMVM_MIDIPORT" variable to 1 or 2. This selects the port on the selected sequencer to use. Then start scummvm with the -eseq parameter. This should work on several cards, and may offer better performance and quality than AdLib emulation. However, for those systems where sequencer support does not work, you can always fall back on AdLib emulation.
ALSA sequencer (Unix only)
If you have installed the ALSA driver with the sequencer support, then set the environment variable SCUMMVM_PORT or the config file parameter alsa_port to your sequencer port. The default is "65:0".
Here is a little how-to on how to use the ALSA sequencer with your soundcard. In all cases, to have a list of all the sequencer ports you have, try the command
aconnect -o -l
This should give output similar to:
client 64: 'External MIDI 0' [type=kernel] 0 'MIDI 0-0 ' client 65: 'Emu10k1 WaveTable' [type=kernel] 0 'Emu10k1 Port 0 ' 1 'Emu10k1 Port 1 ' 2 'Emu10k1 Port 2 ' 3 'Emu10k1 Port 3 ' client 128: 'Client-128' [type=user] 0 'TiMidity port 0 ' 1 'TiMidity port 1 '
This means the external MIDI output of the sound card is located on the port 64:0, four WaveTable MIDI outputs in 65:0, 65:1, 65:2 and 65:3, and two TiMidity ports, located at 128:0 and 128:1.
If you have a FM-chip on your card, like the SB16, then you have to load the SoundFonts using the sbiload software. Example:
sbiload -p 65:0 /etc/std.o3 /etc/drums.o3
If you have a WaveTable capable sound card, you have to load a sbk or sf2 SoundFont using the sfxload software. Example:
If you don't have a MIDI capable soundcard, there are two options: FluidSynth and TiMidity. We recommend FluidSynth, as on many systems TiMidity will 'lag' behind music. This is very noticeable in iMUSE-enabled games, which use fast and dynamic music transitions. Running TiMidity as root will allow it to setup real time priority, which may reduce music lag.
Asking TiMidity to become an ALSA sequencer:
timidity -iAqqq -B2,8 -Os1S -s 44100 &
(If you get distorted output with this setting, you can try dropping the -B2,8 or changing the value.)
Asking FluidSynth to become an ALSA sequencer (using SoundFonts):
fluidsynth -m alsa_seq /path/to/8mbgmsfx.sf2
Once either TiMidity or FluidSynth are running, use the 'aconnect -o -l' command as described earlier in this section.
Using TiMidity++ MIDI server
If you system lacks any MIDI sequencer, but you still want better MIDI quality than default AdLib emulation can offer, you can try TiMidity++ MIDI server. See http://timidity.sourceforge.net/ for download and install instructions.
First, you need to start a daemon:
timidity -ir 7777
Now you can start scummvm and try selection TiMidity music output. By default, it will connect to localhost:7777, but you can change host/port by defining "TIMIDITY_HOST" environment variable.
Using compressed audio files
Output sample rate
The output sample rate tells ScummVM how many sound samples to play per channel per second. There is much that could be said on this subject, but most of it is beyond the scope of this document. The short version is that for most games 22050 Hz is ﬁne, but in some cases 44100 Hz is preferable. On extremely low-end systems you may want to use 11025 Hz, but it’s unlikely that you will have to worry about that.
To elaborate, most of the sounds that ScummVM has to play were sampled at either 22050 Hz or 11025 Hz. Using a higher sample rate will not magically improve the quality of these sounds, thus 22050 Hz is ﬁne.
Some games use CD audio. If you use compressed ﬁles for this, they are probably sampled at 44100 Hz, so for these games that may be a better choice of sample rate.
When using the AdLib, FM Towns, PC Speaker or IBM PCjr music drivers, ScummVM is responsible for generating the samples. Usually 22050 Hz will be plenty for these, but there is at least one piece of AdLib music in Beneath a Steel Sky that will sound a lot better at 44100 Hz.
Using frequencies in between is not recommended. For one thing, your sound card may not support it. In theory, ScummVM should fall back on a sensible frequency in that case, but don’t count on it. More importantly, ScummVM has to resample all sounds to its output frequency. This is much easier to do well if the output frequency is a multiple of the original frequency.