Update of "pysf"
Not logged in

Artifact ID: b3e36f920486a0de7f36846c54649a095f0c5afd
Page Name:pysf
Date: 2013-07-20 16:49:41
Original User: fossil
Parent: bafab6026dc4b732824d3517f5926e5cc86d9b81


The pysf utility is a way to create and edit SoundFont 2 files at the command line. It does this using XML configuration files and basic audio files (strict sub-set of .wav and .aif).

Each SoundFont2 file has one or more presets, each preset containing one or more preset zones, each preset zone mapping to an instrument, each instrument containing one or more instrument zones, each instrument zone mapping to a wavetable.

The pysf utility is released into the public domain.

My email address is bencollver at gmail.com

Many terms will be defined in the SoundFont 2 Standard.


Download the latest development version.

Usage and Examples

Usage: pysf.py [conversion] [infile] [outfile]
    conversion := --sf2xml | --xml2sf
    conversion := --aif2xml | --xml2aif
    conversion := --wav2xml | --xml2wav

pysf.py --sf2xml old.sf2 conf.xml
Create conf.xml based on old.sf2. Will also create conf%d.wav for included audio samples
pysf.py --xml2sf conf.xml new.sf2
Create new.sf2 based on conf.xml
xmllint --noout --schema pysf.xsd conf.xml
Validate conf.xml using xmllint utility from libxml.

Brief explaination of configuration tags


ISNGmandatory, optimal target sound engine
INAMmandatory, name of sound bank
ICRDfile creation date
IPRDtarget product
ISFTsoftware used to create/modify the file
IFILcontains major and minor version of spec.
majorMajor version of soundfont specfication used.
minorMinor version of soundfont specfication used.
instrumentsmandatory, instrument list
instrumentmandatory, instrument section
presetsmandatory, preset list
presetmandatory, preset section
wavetablesmandatory, wavetable list
wavetablemandatory, wavetable section
zones mandatory, zone list for instrument or preset section
zonemandatory, zone section
id mandatory, id for instrument or wavetable, referenced by other sections
name mandatory, descriptive name for instrument, preset, or wavetable
keyRangerange of MIDI notes for zone
velRangerange of MIDI velocities for zone
overridingRootKeybase MIDI note for zone
wavetableIdwavetable used by instrument zone
instrumentIdinstrument used by preset zone
delayVolEnv time in seconds for delay section of volume envelope
attackVolEnv time in seconds for attack section of volume envelope
holdVolEnv time in seconds for hold section of volume envelope
decayVolEnv time in seconds for decay section of volume envelope
releaseVolEnv time in seconds for release section of volume envelope
sustainVolEnv volume decrease in centibels for decay section
keynumToVolEnvHold degree, in timecents per KeyNumber units, to which the hold time is decreased. The value of KeyNumber units is found by the difference between the MIDI note number and 60.
exclusiveClass new notes will silence currently playing notes if the instruments are in the same exclusiveClass
gensgeneric generator operator list in zone
gengeneric generator operator
comment comment describing generator, not used by pysf
hexAmounthexadecimal unsigned word argument
operdecimal generator operator number
file mandatory, name of aif or wav file used by wavetable
looploop begin and end point for wavetable
pitchMIDI note that the wavetable was recorded at
pitchcorrpitch correction in cents for wavetable
channel select channel for instrument and/or from stereo audio file
linklink to other wavetable in a stereo instrument

24-bit sample width wavetables

To use 24-bit sample width wavetables, you must set ifil to major 2, minor 4. If you use 24-bit wavetables, then all wavetables used must be 24-bit. You can use audacity to convert between 24-bit and other sample widths.

Theoretically, old software should be able to play 24-bit soundfonts at lower quality by simply ignoring the sm24 chunk. However, some programs will refuse to use 24-bit soundfonts. Timidity and fluidsynth do not support 24-bit soundfonts, and apparently neither does quicktime. Therefore, this feature is not well tested in pysf.

Stereo wavetables

To use a stereo .wav file for a mono wavetable, use the channel tag to select a channel. If the wavetable is linked, then the channel tag also determines whether the wavetable is the left or the right channel in a stereo instrument. A stereo instrument requires two linked wavetables. Use link tags to link wavetables. Example:


A stereo instrument also requires a zone for each channel. Example:



Log in as anonymous to change this page or add a new bug ticket.