5

I have Timidity++ installed with FluidSynth soundfonts. How do I make Timidity play back any MIDI, mapping all instruments to a sine wave instrument (patch 81, bank 2, according to General MIDI Level 2)?

I've tried, e.g., this in the Timidity config file:

map gm2 0 19 2 81

But it didn't use the sine wave instrument for the particular MIDI file I was playing back (bank 0, patch 19 = "church organ" instrument in that particular file).

2 Answers 2

3

Hmm, I cannot get map to do anything, so without diving through the source code, who knows. However! If you have a soundfont file, the bank and number configuration entries appear to do the trick via the following in ~/share/timidity/timidity.cfg:

dir /home/jdoe/share/timidity/inst
bank 0
0 %font tabla_drums.sf2 0 0
1 %font tabla_drums.sf2 0 0
...
127 %font tabla_drums.sf2 0 0

Where the /home/jdoe/share/timitidy/inst directory contains for this example a tabla_drums.sf2 SoundFont file. This maps test MIDI files to use the tabla drums via:

% timidity --config-file=~/share/timidity/timidity.cfg foo.midi

However, via the lspatch.pl script under the timidity source tree, and the sf_list script of the MIDI::SoundFont perl module, I can find no bank 2 patch 81 patterns nor soundfont entries, so I'm not sure what would provide it, as it does not appear to be present in timidity 2.13.2 nor via the GeneralUser_GS_1.43-FluidSynth soundfont... (if there is a pattern file with a sine wave, then the number configuration would run something like 0 blah.pat and so forth for all the patch numbers.)

Another option would be to edit the MIDI and alter any patch_change events to use a particular instrument, but that's more work, and there may also be bank select events that also need filtering.

1

Building upon thrig's answer:

Download Sine Wave.sf2 and put it in /usr/share/sounds/sf2/ (or wherever your soundfont directory is). Add to timidity.cfg (or the corresponding file it sources with trysource):

81 %font "Sine Wave.sf2" 2 81 amp=100 pan=0

From the timidity.cfg manpage:

number %font file bank prog [key] [options]
number %sample file [options]

Specifies that the MIDI program number in the current tone bank or drum set should be played using the patch file. If file is SoundFont, the specific instrument with bank, prog, and key is taken out by the format of number %font. If file is linear AIFF or WAV sample data, the MIDI program number is specified by the format of number %sample.

If you'd like to re-map:

map MapID1 from-bank from-prog to-bank to-prog

The existing tone is assigned as a tone of GS/XG each map. gm2, sc55, sc88, sc88pro, sc8850, xg and xgsfx64 can be specified to be MapID1.

add

map gm2 0 19 2 81

to timidity.cfg, too.

However, I tried this, and timidity still played the original midi with the Square Lead (bank 0, patch 81), not Sine Wave (bank 2, patch 81), instrument.


Also, Musescore can edit MIDIs and easily change the voice to "Sine Wave". See: "using custom SoundFonts in MuseScore".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.