
%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "readme"
%%% End: 

\subsection{Playing sound with Sequencer MIDI}

If your soundcard driver supports a sequencer, you may set the environment
variable "SCUMMVM\_MIDI" to your sequencer device - e.g., /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.


\subsubsection{Playing sound with ALSA sequencer}

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 howto 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 
\begin{verbatim}
     aconnect -o -l
\end{verbatim}
This should give output similar to:
\begin{verbatim}
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 '
\end{verbatim}
%
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:
\begin{verbatim}
  sbiload -p 65:0 /etc/std.o3 /etc/drums.o3
\end{verbatim}
%
If you have a WaveTable capable sound card, you have to load a sbk or sf2
soundfont using the sfxload software\\
Example:
\begin{verbatim}
  sfxload /path/to/8mbgmsfx.sf2
\end{verbatim}
%
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 noticable 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:
\begin{verbatim}
  timidity -iAqqq -B2,8 -Os1S -s 44100 &
\end{verbatim}
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):
\begin{verbatim}
  fluidsynth -m alsa_seq /path/to/8mbgmsfx.sf2
\end{verbatim}
%
Once either TiMidity or FluidSynth are running, use
\begin{verbatim}
      aconnect -o -l
\end{verbatim}
as described earlier in this section.
