A SoundFont .sf2
file is a file that contains many samples of different instruments playing different notes, enabling Libnyquist to render finally each instrument sound in the MIDI song. SoundFonts are available on the web, but the quality and size varies a lot, and they may have licensing issues (because of the copyright of the different samples), they may be designed for different styles of music (classical, jazz, pop...), and they may target different sets of instruments as well. As a general rule, most MIDI files are targeted to use the 128 sounds of General MIDI standard (GM), so use a SoundFont that does conform to this standard. You probably want to try the Fluid R3 GM (141 MB uncompressed) as a starter pack, which is a very good general purpose SoundFont (and fully MIT licensed).
SoundFont files are large and often compressed in .zip
, .tar.gz
or .sfArk
formats. .sfArk
files can be unpacked with sfark tool. For now, libnyquist supports .pat
(GUS) soundfonts only, which can be converted from .sf2
files with the unsf tool.
Back to the library, the compiler directive PAT_CONFIG_FILE
tells libsoundwave what soundfont file is hardcoded by default (defaults to pat/timidity.cfg
, but might be FluidR3_GM2/FluidR3_GM2-2.cfg
, or any other valid path during compilation). Additionally, there is a runtime check for the environment variable MMPAT_PATH_TO_CFG
, which contains the path to the config file. For more info please check this source file