GeoMaestro

-- Back --

Using GeoMaestro with TiMidity

TiMidity as associated synth
Defining patchmaps based on TiMidity's configuration files



TiMidity is a very good soft synth and wave renderer, freely available here as part of the GNU project.

This part of the manual will only be useful to you if you intend to use TiMidity as the main synth associated to GeoMaestro.



TiMidity as associated synth


At least for Windows, TiMidity can not directly read a MIDI port; it only reads MIDI files. So hearing a KeyKit phrase rendered by TiMidity involves writing the phrase to a file, and then asking TiMidity to read it. In GeoMaestro, you can set the global variable HearWithTimidity to 1 in order to make this process happen automatically whenever you click on the GUI [hear] button. The notes will not be send to Midi Out in this case.

Another global variable is RenderAsWave: when set to 1, clicking on [hear] will make TiMidity render the Midi phrase as an audio file. The value of HearWithTimidity is then ignored (it is not set to 0, though).

One last variable is EditRenderedWave: it will only take effect if RenderAsWave is 1. When set to one, it opens an audio editor on the rendered wave.

These three variables can be set in the initialisations.k file, or on the fly at the console.

In order to have these features work properly, you need to give the correct values to the following parameters (all of them in initialisations.k); here are the default settings (which have no interest by themselves, they're simply mine):

TIMIDITYpathA = "C:\\timidity\\timidity-con.exe "
... is the full path to the TiMidity executable (for audio)
TIMIDITYpathF = "c:\\timidity\\timpp2100q.exe "
... is the full path to the TiMidity executable (for wave rendering)
TIMIDITYflagsA = ""
... can contains TiMidity's options for rendering to audio port
TIMIDITYflagsF = " -int  -A60 -s44100 -Ow -o "+TEMPWAVEFILE+" "
... are TiMidity's options for audio file rendering (here it means we're creating a *.wav file)
TEMPTIMIDITYFILE = "C:\\audio\\KeyKit6.6b\\MIDI\\temp.mid"
... is the temporary Midi file written when [hear] is clicked
TEMPWAVEFILE = "\""+"C:\\audio\\KeyKit6.6b\\MIDI\\temp.wav"+"\""
... is the temporary audio file used if RenderAsWave is on

also ,we have:
WAVEEDITpath = "C:\\cool\\COOL96.EXE "
EDITWAVECOMMAND = WAVEEDITpath+TEMPWAVEFILE
... which are the command used to call an audio editor


TiMidity is also used by the Compositor Tool when rendering compositions to audio. Since you may want specific flags for the TiMidity command line, it uses another variable:
TIMIDITYmixflags = " -int -A80 -s44100 -Ow -o "
... this will be followed by SSDIR+AUDIOMIXtempwave, but it is another story... see here for more.



Defining patchmaps based on TiMidity's configuration files


You can reference TiMidity's configuration (*.cfg) files in your ACpatchmapn.txt; this makes all banks and drumsets available in KeyKit's "Program Change (old)" tool, and also in the GeoMaestro GUI. The "Drum Picker" tool can also be used to extend Kboom-like tools capabilities



Syntax: (here is an example file)

The first line of the file (except if an #import statement is used, see below) must be
#timidity
... all that follows will be considered as the TiMidity section, until a line starting with
#end_timidity
is found. Following lines are understood as an usual ACpatchmapn.txt file



Including a configuration file is done with the #cfg keyword. Example:
#cfg C:/timidity/SF2.cfg
...in this case, all banks and drumsets are loaded in the patchmap. If another file is called by SF2.cfg (with a "source" command), it will be included as well. Note that "dir" and "progbase" keywords are supported.



Selecting only part of the banks and drumsets involves the keywords #banks and #drums. Example:
#cfg C:/timidity/SF2.cfg
#banks 90, 91, 97
#drums 0, 127
... this loads only three banks and two drumsets. Note that the syntax is quite rigid: #cfg, #banks and #drums must appear in this order and not be separated by an empty line. Also, if #banks is used but #drums isn't, no drumsets will be loaded.

You can have several *.cfg files referenced this way in the TiMidity section.



Selecting only some patches from a bank is simply done by copying the corresponding lines from the *.cfg file. Example:
bank 20
0 %font C:/timidity/SoundFonts/WarrenTrachmanPiano.sf2 0 0
1 %font C:/timidity/SoundFonts/WarrenTrachmanPiano.sf2 0 1
2 %font C:/timidity/SoundFonts/WarrenTrachmanPiano.sf2 0 2
3 %font C:/timidity/SoundFonts/WarrenTrachmanPiano.sf2 0 3
4 %font C:/timidity/SoundFonts/WarrenTrachmanPiano.sf2 0 4

bank 10
0 Stef/HmmSnd/Flute
... this will load five patches in bank 20, from a SoundFond2 file, and one patch in bank 10 (in GUS format)

It is not possible to select only part of a drumset, so no corresponding syntax is available.



Names for the patches:

When I say a patch is "loaded", it simply means that the references (bank and program number) for this patch will be available in the patchmap. There are three ways to associate a name to this patch. Here is a comprehensive example:
#sfplist
Nice piano 	prog:0	bank:20
Piano, again	prog:1	bank:20
Flute		prog:0	bank:10

bank 20
0 %font C:/timidity/SoundFonts/WarrenTrachmanPiano.sf2 0 0
1 %font C:/timidity/SoundFonts/WarrenTrachmanPiano.sf2 0 1
#n WT Piano 2
2 %font C:/timidity/SoundFonts/WarrenTrachmanPiano.sf2 0 2
3 %font C:/timidity/SoundFonts/WarrenTrachmanPiano.sf2 0 3	#WT Piano 3
#WT Piano 4
4 %font C:/timidity/SoundFonts/WarrenTrachmanPiano.sf2 0 4

bank 10
#n Nice Flute
0 Stef/HmmSnd/Flute

The #sfplist keyword indicates the beginning of a section where are listed names with their corresponding bank and program numbers. The three fields must be separated by tabulations. No space is allowed between the double dots and the numbers; no empty line is allowed until the end of the #sfplist section is reached. (If you're curious to know where this syntax comes from: it's the output of the "sfplist" Csound opcode, which I use to give me a list of the presets in a SoundFont2 collection)

#sfplist can be followed by a file name: in this case, the list will be looked for in that file. It is the case is the provided example file, and here is the corresponding file defining the names. As you can see there, you may freely comment the file: only the lines including "bank:" and "prog:" statements will not be ignored.

Another way to name a patch is to simply add a comment to the line where the patch is defined. A third way is to use the #n keyword in the line just before.

The order of priority is the following:

1) #sfplist section
2) #n in the previous line
3) # in the corresponding line
4) no correct definition: the last part of the patch definition line is used by default


So the previous example leads to the following names:
Flute
Nice piano 	
Piano, again
WT Piano 2
WT Piano 3	
WarrenTrachmanPiano.sf2 0 4


No need to repeat the process over and over:

Loading a large collection of patches can take some time, that you don't want to have to wait everytime you start KeyKit. So, if your settings are not subject to constant changes, you can add #import at the very beginning of the ACpatchmapn.txt file.

In this case, GeoMaestro will look for a file called ACpatchmapn.dat, and if it finds it, read the patchmap in this file, ignoring the rest of the ACpatchmapn.txt file. Otherwise it just goes on like previously described.

To create the dat. file, simply type
ACsave()
at the console: the current patchmap will be exported

If you make changes in the configuration, simply delete the .dat file to make GeoMaestro read the actual instructions.



Having a look at the patchmap

The patchmap is stored in the ACPat array. It is created by the patchmap() function when ACPATCHES is not 0 (this is the default, the value of ACPATCHES being set up in the prerc.k file. More about this here). You can have a look at (or even edit) this array by typing
Notepad(ACPat)
at the console.

But you will not have any information about the source files for the patches here, since KeyKit is only interested in sending the right bank and program changes messages for a given name. You may however have a file created automatically when the patches are loaded, that contains this information and is easier to read than the TiMidity configuration files (it will also exactly match your patchmap).
To do so, write the following in your prerc.k file:
ACMAP = 1
The file will be named ACpatchmapn(map).txt




-- Back --