Runabc.tcl

Updates of this text

November 16 2007, TclAbcEditor provides allows you to replace a tune in a music collection in one abc file.

Table of Contents

To download runabc.tcl:

top level

Introduction

The program allows you to display an abc file in standard music notation, send it to your printer and play the tune in any tempo or key on your audio card on your computer. Furthermore if you have the music score of a tune that you like, you can create your own abc file using any text editor (or the one included in this program), and hear how it sounds like when it is played on your computer.

There is already a database of several thousands of folk tunes notated in the abc format that is freely available from web sites. There is also lots of software, either freeware or shareware, for playing these files on your computer or printing it in music notation. Some of these programs are command driven. Thus to produce a postscript file, from an abc file you would type a command like "abc2ps sample.abc 1-3 -P -X -O out.ps" which would produce a file called out.ps. You would then display the program on the screen by typing "c:/program files/ghostgum/gsview/gsview32 out.ps".

Runabc.tcl is a script that acts as a front end and user interface to these command driven programs. It allows you to to perform actions by pointing and clicking with your mouse rather than typing long commands. It is written in a language called Tcl/Tk that has been ported to many different platforms. Thus you can run this script on a PC running Windows 95/98/00/ME/XP or NT 4/00, or on a Macintosh or a Unix workstation as long as Tcl/Tk version 8.4 or higher has been installed on this machine. Runabc.tcl no longer works properly with older versions like Tcl/Tk 8.3. To tell which version you are running, type in the command info tclversion while you are in the wish or tclsh command console.)

As this script is merely a front end, you need to install the other programs abc2midi, abc2ps, yaps, a midi player, and a postscript file viewer on your system. Sources for this software are indicated on the page describing the installation.

As the installation of all the package components is not a trivial matter, (see install.html for more details), the intention of this page is to give you an idea of what the program does and how it operates. Note the appearance of the windows shown here may differ depend on operating system you are running Tcl/Tk and its settings. Also note that this guide may not always be up to date with the minor improvements in this program.

Getting Started for the First Time

On Windows, you may put runabc.tcl and runabc.ico, in any folder. I usually put it in a folder called something like abc and add the various other executables that are needed like abc2midi.exe, abc2ps, etc into the same folder. For Unix, you have the same flexibility however the folder must have execution/read/write access for all users. Runabc will create a tmp directory and it will also create or modify the file runabc.ini in the same directory. For multiuser systems, it is recommended that each user has his private copy of runabc.tcl somewhere in his home directory since that is where the runabc.ini file will be stored. You start runabc.tcl on Windows by clicking on the file runabc.tcl. Assuming Tcl/Tk is installed on your system, the Tcl/Tk interpreter will start and automatically run runabc.tcl. On other systems such as Unix, Linux and etc. it may be necessary to start runabc.tcl using a command line such as "wish runabc.tcl".

The main screen to runabc.tcl consists of a series of buttons and a list of tunes contained in an a specific abc file.

runabc main menu

If you are running the program for the first time, you should first click the Options menubutton. This is the button showing a wrench. The following menu will be displayed. shown below.

runabc configuration menu
All of these menu items shall be explained here, however, there is context help for most of the menu items. Assuming the character font is readable on your computer, you should first select menu item Options/abc executables. Otherwise you should choose Options/font and read the appropriate section in this documentation right away.

abc executables

runabc abc executables configuration menu
All your abcmidi applications (abc2midi.exe, abc2abc.exe, yaps.exe, midi2abc.exe and midicopy.exe) should be in the same folder. Either enter the path name of this folder in the abcmidi folder entry box or start the browser by clicking the button labeled abcmidi folder. Once you have selected the folder, runabc will list the version numbers and expected version numbers in a summary window shown below. If any of the files were not found, they will be indicated. The the runabc/cfg window will be expanded to include all the abcmidi paths, in case you need to make minor changes.
runabc abc executables summary window
Set the path names to the other applications that you may use such as abc2ps.exe, abcm2ps. If you wish to use a particular abc to postscript converter such as jcabc2ps or jaabc2ps, you may substitute its path for abc2ps. It is good idea to have a choice of several abc to postscript converters since some applications work better on some abc files. I find that the yaps converter can handle certain abc files which would cause abc2ps or abcm2ps to crash. You can change the default converter by going to the menu button which labeled as one of the following (yaps options, abcm2ps, abc2ps or other ps) in the second row of buttons and selecting ps converter cascade menu.

In order to be able to display postscript files on your screen, you will need to specify the path to a postscript viewer program besides the label ghostview. For Linux I use gv, for Windows I use gview32.exe. Sites where you download these viewers are indicated in the install.html web page. The postscript viewer program is called automatically when ever you click on the Display button. This is the button showing an icon of a printer.

A helpful hint:

If you are using gsview on windows, you may wish to pass the -e argument so that a new gsview window does not appear each time you display another file. Unfortunately, you cannot pass program arguments in the entry box since tcl/tk assumes this is just part of the file or folder name. A simple way around this is to call gsview32.exe indirectly through a batch file. You can also use this batch file to convert the PostScript file to a Acrobat PDF file. For example, here is gsview.bat
REM execute gsview32.exe with the -e option
"C:\Program Files\Ghostgum\gsview\gsview32.exe" -e Out.ps 

REM convert Out.ps to out.pdf using gswin32.exe
"C:\Program Files\gs\gs8.53\bin\gswin32.exe" -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -q -sOutputFile=out.pdf Out.ps
You would now specify the path to gsview.bat in the ghostview entry box. Note you may need to edit gsview.bat if gsview32.exe and gswin32.exe are not in the same locations on your system.

Though the script has its own editor for creating and editing abc files (with many special features), you may prefer to use your own editor (like vi, emacs, notepad...) for everyday work. You specify the path to the editor in the adjoining entry box.

When you edit a particular tune included in a compilation of tunes in a abc file, runabc extracts this particular tune and saves it to a abc file with a name derived from the title into a specified directory. The name of the directory is specified in the entry box besides work folder. You should specify the name of a folder to keep everything organized. If the folder does not exist, it will be created automatically. It is necessary to do things this way to remain compatible with the other editors.

Abcmatch is a program for performing searches on abc databases on your hard drive. You will need it when you use the find utility on the menu screen.

player 1

Now return to the Options menu button and configure the options for the midi player (Options/player 1).

runabc player 1 configuration menu

You have the choice of specifying two midi players with their options. If you only have one midi player available then ignore player 2 configuration menu item. The selected midi player is chosen from the abc2midi options (second row of buttons).

This configuration page is used to specify the path name to the midi player, any required run time options and the protocol for passing the midi files to the midi player. All midi players handle single files. Others can accommodate a list of midi files, while some will even accept a folder of midi files. The manner of passing the midi file(s) to the player is specified by the protocol. You may use any of the three protocols even if you are only passing one midi file to the player, provided the player supports this method. If you are passing a folder then the folder name should be given in the options entry box and the 'folder' radio button should be selected. It is necessary to do this manually since some midi players require the folder name to be preceded by a flag. Note that in some operating systems there may be a limit in the length of the string containing the list of midi files.

X.tmp

When you click the Play selection button (shows a picture of a speaker), runabc creates a file called X.tmp containing the selected abc tunes and puts it in a tmp folder in the same folder from which runabc.tcl is invoked. (If you wish to use a different subdirectory name instead of tmp, you should edit the contents of the midi_dir parameter in the runabc.ini file.) Prior to running abc2midi, any midi files beginning with the letter X are removed from the tmp directory. Then abc2midi is executed with the file X.tmp and it creates a new set of midi files. These midi files are sent to a designated midi player using one of three protocols. You are allowed to designate up to two possible midi players which have their own option entry box and protocol. A convenient way for viewing the X.tmp file is to click the edit/view X.tmp menu item. Line numbers are added so it is easy to review the error messages from abc2midi. A sample of such file is shown here.

X.tmp file

font

Go to the menu item Options/font and select the font size and weight ideal for your display.

runabc font configuration menu

The font size, is very useful for adjusting the size of all windows and buttons to match the resolution settings of your screen. The program uses two different fonts, one for all the buttons and controls and the other to display the table of contents and the editor. Any font is suitable for the former, but you should use an equally spaced font (eg fixed) for the table of contents and editor. You enter the names of the fonts in the entry box followed by a carriage return. For tcl/tk 8.4 and higher a spinbox at the bottom allows you to browse through the fonts available on your system. Samples characters of the font "abcdefg" are shown at the bottom right. For tcl/tk 8.3 and lower, you can get the list of available fonts by typing "font families" while running the Tcl/Tk interpreter (usually called wish). On my system (Windows 98) the list includes Courier, Arial, Century, Comic and many others.

If the font that you choose results in an unreadable screen when you run the script runabc.tcl, you can press the button labeled Reset. Alternatively, you can edit the runabc.ini file and changing the entries for font_family. In the worst case you can delete the entire line and tcl/tk and runabc will try to restore it to something reasonable. If the font you choose does not exist, Tcl/Tk chooses a standard font.

end of line convention

The abc standard uses a blank line to separate abc tunes in a compilation of tunes in a file. Unfortunately, different computer platforms use different end of line conventions, (eg. carriage/return linefeed, carriage/return, or linefeed) which get in the way of this convention. On unix, there are programs called dos2unix, unix2dos, mac2unix, etc. which convert a text file to the appropriate convention. If runabc has difficulty detecting the blank line or sees blank lines every where, it is suggested that you tell runabc to ignore this convention by ticking the check box ignore blank lines. Since each tune is supposed to start with an X: reference number, runabc will use this as an indication to separate tunes. Runabc requires that every tune has an X: reference number, T: title, and K: key signature.

sanity check

If you do not succeed in getting runabc working properly, you can do a sanity check and send me the runabc.out file by e-mail to me. The runabc.out file is a text file that you can view with any editor.

Register abc files

If you are running on Windows, operating system, you will see the button Register abc files. Clicking this button will display the following window which will allow you to associate abc files with runabc.

Association Window
Associating the abc files with runabc means that whenever you double click on an abc file it will automatically start up runabc with that file loaded. If runabc was already running, then double clicking on the file will load that file into the current process. The association is set up through the Windows registry system. (Note this feature requires tcl/tk version 8.4. It will not work with 8.3. If you are using a freewrapped (or starpack) version like runabc.exe then you don't care, since the correct version is already built in.)

Normally it is only necessary to create this association once. The association remains permanent (unless changed by another abc application). If you later decide to move runabc to a new directory, then it is necessary to reestablish the association the same way. If at sometime you wish to destroy or change this association, you can do this by going to 'Folder Options' which is accessed from the file manager under the menu item view or toolbar or somthing else (depending on which version of Windows you are running -- 95,98,ME,etc.); then select 'File Types' find ABC, select it and take the appropriate action (eg remove).

When you double click on abc file, windows starts up runabc and loads up the selected abc file. However, the current directory is the same directory where the abc file was found. This poses a problem, since the runabc.ini and tmp directory is normally in the same directory as where runabc was installed. To fix this problem, this function also stores the path name to the runabc install directory in the registry. Runabc determines whether runabc.tcl or runabc.exe are found in the current directory. If they are not found, then runabc looks in the registry to find out where they are located and changes the current directory to this location. Now it is possible to load and store the correct runabc.ini file.

Note if you use runabc.exe or runabc.kit, you should associate the abc files with runabc.exe or runabc.kit.

If you want a similar feature on other operating systems, it will be necessary for you to set it up yourself. You can put a link a runabc link in your ~/bin directory (i.e. in your home directory), so that it points to the location of runabc.tcl. For example, you would create the link by typing.
ln -s ~/abc/runabc.tcl runabc
Now you can start up runabc from any current directory. Furthermore, if you enter
runabc sample.abc
where sample.abc is some abc file in your current directory, then runabc will start up with this file preloaded. However, in order for this to work properly, you also need to create a new environment variable called RUNABCPATH which points to the folder where runabc.tcl is stored. On my system, I added the following to my .bashrc file.
export RUNABCPATH=~/abc/
If this is not done, runabc will not cd to the directory where runabc.tcl was installed and will not find the runabc.ini file.

Main Features

At this point you are ready to start using the program. Click the file button at the top left, and use the file browser to select the desired abc file. Alternatively, you may enter the full file pathname in the entry box and press 'return'. (The return key can be used to remove the focus, i.e. flashing cursor from many of the entry boxes you will see.) A list of all the tunes in that file should appear below. (If no index appears on the screen, it may be necessary to convert abc text file to unix, dos format or whatever is appropriate for your machine using utilities like dos2unix, see readme file for more discussion.) If you do not have those utilities, you may be able to accomplish this using the edit/copy to file command on the runabc console and create a new copy of the tunes in the abc file. This is discussed later.

Select a tune, using the mouse pointer. If you right click a particular tune, a short summary will pop up in a separate window. Then click the play button, to hear it on your speakers or the display button to view the tune in musical notation. You can select several tunes by dragging the mouse pointer, or clicking with the shift key (or control key) depressed. When you click the play or display button, all the selected tunes will be converted to midi files or a postscript file.

Other bindings: the arrow, page up/down, home, end keys allow you to scroll up and down the table of contents. The cntl-slash and cntl-backslash allow you to select or deselect all titles in the table of contents; the cntl-home activates and selects the first title; and the cntl-end activates and selects the last title. In addition the p key or will play the current selection and the d key will display this selection.

When you right click any tune in the table of contents list box, a short descriptor of the tune will appear in a separate and resizeable window. If you want the entire tune shown then set 'summary_enabled' to 2.

If you click the Play selection button (which has a speaker icon), the program will convert the specific tunes to a midi files, store them in a specific directory (by default tmp in your current directory) and then attempt to play these midi files using the midi player that you had designated in the configuration property sheet. Any error or warning messages reported by abc2midi can be viewed by clicking the button labeled Console. (The Console button appears as a rectangular box with a blue bar at the top.) Note abc2midi is more stringent than abc2ps in the use of the P: field. The P: field has sometimes been used to put additional annotation rather than designate the parts and how they are repeated.

runabc sample message window

The error and warning messages produced by abc2midi and yaps may appear in blue print. If you click on one of those messages, runabc will display the input file (X.tmp) in a separate window and the line associated with this error message will be highlighted with a grey background. Do not attempt to edit the contents of this window since you cannot save the results.

tmp.X file

If you click the button labeled Display, the program will create a postscript file (Out.ps) of the abc file by calling the program abc2ps or whatever with the appropriate parameters and then display this file by running ghostview. A sample view of the postscript file is shown below. Again you can view any messages reported by abc2ps by clicking on the button labeled console. Abc2ps depends on the X: reference number to find the selected tune so be sure there are no duplicate numbers or the wrong tune could be selected. Note abc2ps and its variant may not handle all forms of line/end conventions even though runabc, yaps and abc2midi can handle them.

runabc sample postscript file

Abc2midi Options

Runabc has many advanced features to control how the midi file or postscript file is created. You get to these features by clicking the menu button abc2midi or abc2ps (may also be labeled yaps or abcm2ps).

When you are creating and playing the midi file, the Play options menu button provides options for changing the tempo, transposition, assignment of voices to melody and accompaniment, turning off chordal/bass accompaniment, turning off the melody line. (This button shows a picture of a hammer and a pin, standing vertically.) Most of this information is rarely included in the midi file, so it is necessary to automatically insert it before sending it to abc2midi.

Prior to calling abc2midi, runabc creates a copy of the tunes you wish to play with this added information in the file called X.tmp which is stored in the tmp subdirectory. Abc2midi then processes the file X.tmp producing the desired midi files. You can view, but not edit the X.tmp file using the menu button edit/view X.tmp. (The edit button shows an icon of a pencil writing on a sheet of paper.) This is often useful, since the error messages reported by abc2midi (viewed when the console button is clicked), refer to lines in the X.tmp file. Line numbers are automatically inserted by the runabc viewer for your convenience.

Tempo/pitch

If you wish to change the tempo or choice of instruments in the midi file, you should click the button labeled Play options and select tempo/pitch. A new property sheet will appear as shown below. On line help appropriate to this sheet is available if you now click the help button.

runabc midi configuration

Most abc files do not have any tempo or midi program indications, so it does not matter whether this program ignores or uses these indications. This also provides complete freedom to change the tempo or instrumentation. However, there are a few abc files (in particular the multivoice files generated by midi2abc) which preserve these indications. If you wish to ignore these indications, check the appropriate boxes in this property page.

The tempo slider allows you to control the tempo in quarter notes per minute. The transpose slider allows you to transpose all channels up or down by a number of semitones. If you move the transpose slider, remember to restore it back to zero. Its position is stored in the runabc.ini file until you change it.

If you have specified an alternate midi player in the configuration property page, you can select the desired midi player to use here. Note: for these changes to take effect, the play mode must be aborted and the play button must be clicked again.

By default all MIDI tracks are mapped to the acoustic piano. If you wish abc2midi to map the melody track to another instrument, you should select Play options/melody and the following sheet will be exposed.

abc2midi melody selection

melody

The melody checkbutton should always be left checked unless you want to play minus one style (The computer plays the accompaniment and you play the melody on your favourite instrument. Be sure that the bass/chords checkbox is checked and the tune has guitar chords or you will hear nothing when you click the Play button.)

If you click on the button labeled Recorder in the figure, a cascaded menu will allow you to choose a different instrument from a set of 128 General Midi instruments.

A volume slider on the next line adjusts the volume level of the melody. Abc2midi requires 3 numbers to specify the volume level. They are the velocity of the note on the on the first beat, the velocity of the note on the offbeat, and the velocity of all the remaining notes. The velocity for the first beat should be higher than than the offbeat and similarly the velocity of the offbeat should be higher than the other notes. You can edit these in the adjoining entry boxes, or you can adjust them automatically with the volume slider. The volume levels in each entry box should not exceed 127.

The gracedivider is a new feature which replaces the old %%MIDI grace a/b (still available in abc2midi but no longer supported by runabc). In the old method, you would specify would part of the note could be used for expressing a grace and this ratio would remain fixed. Unfortunately, the length of each grace note is now dependent on the complexity of the grace group and the note to which it was applied. In the new method, the grace note always has a fixed duration, eg (1/64 th note) irrespective of where it occurs. The time is still taken from the following note but the ratio of grace notes to the following note is now variable. If the following note is too short to handle the grace, then the grace is ignored. You specify the duration of the grace notes using the new %%MIDI gracedivider b command. Runabc supports this new command by allowing you to specify the b value. This value specifies the divider applied to the standard note length as specified by the L: field command. For example, for L:1/8 and b=4, all the grace notes would be 1/32nd notes. (Note that in order for this feature to work correctly the version of abc2midi must be 1.44 or higher.)

Broken rhythm ratio adjusts the times for > and < indications in the music body (eg. B > c). The default is 2 to 1, meaning the notes are played as B4/3 c2/3 even though it is printed as B3/2 c1/2. If you want it to be played as written then you should set the ratio to 3.

The parameter beat divider is used for determining which notes are to be considered as strong (off beat). If the time signature is x/y then each note is assigned a position 0,1,2,...x-1 depending on its position in the bar. If its position k, is an exact multiple of n, then that note is considered strong and is assigned a level of b. If you need finer control, you should insert the %%MIDI beatstring string into your abc file. This is documented in the abcguide.txt which comes with the abcmidi distribution.

The default button restores all these parameters to factory settings.

bass/chord

Similarly you can select any instruments for the chordal and bass accompaniment by selecting the menu items Play options/chord or /bass. A sample sheet is shown below.

abc2midi chordal accompaniment selection
In addition to selecting the instrument or switching it on or off, you can also adjust the volume level. The same is true for the bass accompaniment. Switching off the bass accompaniment also switches off the chordal accompaniment automatically and vice-versa.

The pattern of the chordal/bass accompaniment is determined by the time signature of the music. You have the option of choosing another pattern by selecting the gchord menu button. Be sure to check the checkbox my gchord or else abc2midi will use its default pattern. Clicking the gchord button will drop a cascaded menu. The gchord pattern is specified using the codes, f (bass fundamental), c (chord) and z (rest). A number after the codes f,c and z specifies the duration. For example the default gchord string or 3/4 time is fzczcz. The duration of the gchord string is always normalized to one measure so that f4c2 and f2c denote the same thing.

Besides the f,c,z codes, no codes g,h,i,j,G,H,I and J were recently introduced for handling broken codes or arpeggios. These codes address the individual notes in the chord starting from the lowest note in the code. The lowest note is not necessarily the root if the chord is an inversion. For example for the C major chord, the ghord string ghih would play the sequence CEGE for every bar. The code GHIJ would play the same notes but at a lower octave.

drone

bagpipe drone.
Bagpipe music now has some limited support. If the music is written in the K:Hp or K:hp signature, then you can instruct abc2midi to insert a continuous drone which is played in the background. The loudness of the two instruments generating the drone are configurable using the drone property sheet.

voice

If your abc file uses different voices (V:1, V:2, ...) then you should select Play options/voices to control the assignment of the voices to the different MIDI instruments, volume levels and panning parameter. If the tune has already assigned instruments to the voices and you have not requested to override all MIDI indications (in the abc2midi options/tempo-pitch page), then these changes will not be effective.

abc2midi voices.

The panning parameter is useful if you have two speakers. You can shift the voice towards the left or right speaker. If you wish to turn a voice off, simply set the volume level to zero. Be sure to return the level back to normal when you are done, since all settings are saved when you exit from runabc. These options were found to be useful when you are trying to track errors in one of the voices or you are playing a long with the computer using your musical instrument.

Abc2ps, Abcm2ps, Yaps Configuration

Similarly, you can also configure the appearance of the postscript file by changing the parameters passed to the program abc2ps or yaps. To do this, you should click on the button either labeled abc2ps options or yaps options depending on which postscript converter you had indicated in config/executables window. A dialog box with entry boxes appears as shown below. (If abc2ps is your selected converter, then a different property page will appear.)

runabc abc2ps configuration

Jcabc2ps, Jaabc2ps, Abctab2ps and other abc2ps clones

For the many other postscript file creators, you can select the other radio button in the config/abc executables menu page. When you click on the other ps button, the following configuration page would be displayed.

other postscript

You specify the path name to the executable and the program options in the two entry boxes provided. You may specify as many options as you wish, but you should ensure that the program produces an output file called Out.ps. The input abc file name will be automatically provided by runabc. Unless you are running an old version of runabc (prior to 3.95 April 9 2003) you should no longer specify the selector parameter -e $xsel. Runabc now copies all the selected tunes to a separate file (usually X.tmp) in the tmp folder and the postscript creator processes this file. This avoids several problems (eg. duplicate X: reference numbers). When you click the display button, runabc calls this converter with these options producing an Out.ps file which is then sent to a postscript viewer such as Ghostview. If there are any problems, you should click the Console button in order to see any of the error messages.

Edit/Abc2abc interface

The user's interface to abc2abc is hidden away in the Edit menu menu button. Selecting this item causes runabc to display the following frame in its main window.
abc2abc interface

Abc2abc is one of the programs which comes with the abcmidi package and provides many useful formating and conversion functions. As its name implies, both the input and output are abc files. (If you do not redirect the output to a file, the output will be printed on your command window.) Abc2abc is commonly used to transpose an abc file to a different key signature; however, it provides many other formatting functions. The documentation in the readme.txt file is quite concise and for the benefit of some runabc users, I shall provide a more detailed description below.

The abc2abc interface reflects nearly all the run time options which are listed when you run the program with no options. Thus if you tick the checkbox halve note lengths, abc2abc would be run with the parameter -v. The execution string is displayed at the bottom of the main window after you click the button labeled abc2abc near the bottom. If you had selected, the radio button output to editor, then the abc2abc would be written in a file edit.abc and displayed in TclAbcEditor which will be described in the following section. If you selected the radio button output to clipboard the results would be placed in a clipboard where it can be accessed by most textbased editors. (For example, cntl-v will access the clipboard on the Windows operating system.)

To illustrate the effect of various abc2abc options, consider the following simple example adapted from http://www.leeds.ac.uk/music/Info/RRTuneBk/tunebook.html

X:17
T:Quick Step 71st. Regt.
M:6/8
L:1/8
K:D
dfdecA|dfagfe|dfdecA|dedd3:|
AFABGB|cBcded|AFABGB|cBcd3:|
If the no error report checkbox is not ticked, abc2abc will produce the following output
X: 17
T:Quick Step 71st. Regt.
Z:rrobinson/Aird1.abc
M:6/8
L:1/8
K:D
dfdecA|dfagfe|dfdecA|dedd3
%Warning : No repeat expected, found :|
:|
AFABGB|cBcded|AFABGB|cBcd3
%Warning : No repeat expected, found :|
:|
Unless you are trying to clean up any errors or minor inconsistencies, you would normally have that checkbox ticked so all warnings and error messages are suppressed.

Ticking the box new spacing will result in the following output which would produce a cleaner output when converted to a postscript file.

X: 17
T:Quick Step 71st. Regt.
Z:rrobinson/Aird1.abc
M:6/8
L:1/8
K:D
dfd ecA|dfa gfe|dfd ecA|ded d3:|
AFA BGB|cBc ded|AFA BGB|cBc d3:|

Spaces were placed between beats.

The option use [] for chords and slurs is an ancient remnant when abc files indicated chords with +ACE+ instead of [ACE]. Presently, it is fairly difficult to find abc files using the old convention. Abc2abc would convert the old convention to the new standard if this option is selected.

Running abc2abc with the option double note length produces the following output.

X: 17
T:Quick Step 71st. Regt.
Z:rrobinson/Aird1.abc
M:6/8
L:1/16
K:D
d2f2d2 e2c2A2|d2f2a2 g2f2e2|d2f2d2 e2c2A2|d2e2d2 d6:|
A2F2A2 B2G2B2|c2B2c2 d2e2d2|A2F2A2 B2G2B2|c2B2c2 d6:|
The standard unit length specified by the L: field has been halved to 1/16 and all the notes have been doubled in length. Effectively, there has been no change; however, this feature is sometimes handy when you are transcribing a new tune. The option halve note length does the opposite as illustrated below.
X: 17
T:Quick Step 71st. Regt.
Z:rrobinson/Aird1.abc
M:6/8
L:1/4
K:D
d/2f/2d/2 e/2c/2A/2|d/2f/2a/2 g/2f/2e/2|d/2f/2d/2 e/2c/2A/2|d/2e/2d/2 d3/2:|
A/2F/2A/2 B/2G/2B/2|c/2B/2c/2 d/2e/2d/2|A/2F/2A/2 B/2G/2B/2|c/2B/2c/2 d3/2:|
The option force key to none will produce the following output
X: 17
T:Quick Step 71st. Regt.
Z:rrobinson/Aird1.abc
M:6/8
L:1/8
K:none
d^fd e^cA|d^fa gfe|d^fd e^cA|ded d3:|
A^FA BGB|^cBc ded|A^FA BGB|^cBc d3:|
The key signature is K:none and additional sharps were added to preserve the original music. You can force the key signature to any one of 11 possibilities if you click on the menu item currently labeled none. This feature becomes useful for some jazz music which has so many accidentals that it is hard to assign any particular key signature.

Some musical instruments automatically transpose the music a certain interval. For example, when clarinet plays a piece written in C major, the music comes out in Bb. Ticking the transpose button and entering a number -1 in the semitones entry box produces the following output.

X: 17
T:Quick Step 71st. Regt.
Z:rrobinson/Aird1.abc
M:6/8
L:1/8
K:Db
dfd ecA|dfa gfe|dfd ecA|ded d3:|
AFA BGB|cBc ded|AFA BGB|cBc d3:|
All the notes were shifted down one semitone and the key signature was changed to Db to be consistent. Note it is important to tick the adjoining checkbox for performing the transposition or else no action will be taken.

The placement of linebreaks affects the clarity of the abc file and the appearance postscript converted file. Ticking the linebreaks every n bars allows you to place linebreaks at regular intervals. For example if n is set to 3 the output would look like

X: 17
T:Quick Step 71st. Regt.
Z:rrobinson/Aird1.abc
M:6/8
L:1/8
K:D
dfd ecA|dfa gfe|dfd ecA|
ded d3:|AFA BGB|cBc ded|
AFA BGB|cBc d3:|

The last option extract only voice is applicable to multivoiced abc files. It will produce an abc file with only the selected voice.

Abc2abc can perform several operations at a time if more than one option has been selected. It has not been tested with all combinations of options, so it is recommended that the user keep things simple. The program performs only one pass through the abc file and the source code has become quite complex in some places. Other useful formatting features such as diatonic transposition has been introduced into the runabc builtin editor which is described in the next section.

Edit/TclAbcEditor

built in editor

Introduction

As a text editor, this is not the best. I prefer to use a different editor most of the time. However, in order to provide special editing features such as reformatting, transposing, introducing grace notes or guitar chords, and various clean up features, it was necessary to design my own editor. The play button is one of the most useful features that allows you to play any selected section of abc tune. This is useful when you are trying out different chords or trying to identify a bar that does not sound right.

The editor requires Tcl/Tk version 8.4. It will not run properly with older versions of Tcl/Tk. If you are not sure which version it uses, you can run the sanity check by pressing going to the config/sanity check menu item. Alternatively you can press the alt-s key on the keyboard as soon as runabc starts and look at the runabc.out text file. (Be sure that the runabc window is in focus, or else the program will not pick up the alt-s key.)

Syntax highlighting is done in real time while you are editing the text; however, if for some reason the highlighting appears incorrect, you can restore the correct colours by clicking the clean/retag button. The choice of colours for syntax highlighting can be changed by editing the variables edit_body_colour, edit_field_colour etc in the runabc.ini file. You can find out the names of the various colours by running one of the listboxes demos which comes in the Tk Widget Demonstration package in the Tcl/Tk distribution.)

The editor does not copy the global headers which appear at the beginning of a abc file; however, if you do require them you can import them using the file menu command 'insert global header'.

The undo button or the key will undo any of your changes. You have unlimited undo's provided there is sufficient memory in your computer. The redo button or the keys on Windows or the keys on all other platforms, will redo your changes.

Before running any editors, you should designate your favourite editor in the Options/abc executables menu page. If you have not done this, then this editor will remain your default. However even if you have designated a different editor, you can still start this editor from the menu item Edit menu/TclAbcEditor.

Secondly, you should specify a directory name in the work folder entry box where your work will be stored. Don't worry if the directory does not exist. It will be created automatically if it is not found. The directory is relative to where you are running runabc. Thirdly, you should ensure that a fixed spacing font (the same one used in the TOC) is chosen. This is the default unless, you have reconfigured this in the Options/font.

Assuming that you are editing a particular tune in a file containing many tunes, then runabc will copy this tune to a separate file, with a file name derived from the title of the tune. The file will be placed in your working folder which you should have designated in the Options/abc executables property sheet. Then this file will be opened by either your own editor or by TclAbcEditor depending on whether you choose edit selection or TclAbcEditor. If you choose the menu item, edit file, then the active file containing all the tunes would be opened by the editor. Note that if you decide to do it this way, you should have runabc reread this file (by reopening the same file), after you have done the save so that its table of contents is resynced. Otherwise, runabc may behave strangely and play the wrong tune that you selected. Also note, this method is not as safe as no backup is made unless your particular editor does this automatically.

TclAbcEditor, uses the Tcl/Tk Text Widget standard bindings described here. These bindings are also listed in the runabc context help.

In addition you there are customized bindings listed here:

In order to save the results, you must go to the file/save or file/save as menu item. On Unix systems, you may hear a bell during a file write operation; however, I did not manage to get the bell working on Microsoft Windows Tcl/Tk. If you have modified the file and did not perform a save, the editor will ask you whether you wish to save the file prior to exiting.

If you are editing a particular tune in a file containing a collection of tunes, you can replace that tune in the collection using the menu item file / replace tune in collection . The program will also create a backup file of this collection, however it is recommended that you have an independent backup.

If you are creating a new tune using the menu item Edit menu/new tune, will automatically create a file edit.abc for a lack of a better name. This file will have a template (X:.. T: etc.) for you to fill in. Note that you should do a save as to specify the desired file name, or else you may remain with a file called edit.abc which will be overwritten or deleted many times.

At this point, I shall describe the many special features of this editor. Most of these features all called up from the menu items clean, play and tools; however, other features such as the guitar chord toolbox and grace notes toolbox appear on the right. The program assigns an initial width of 60 columns for the editor. If you need more space, you can move the toolbox out of the way or you can expand the window. If you always want it to start with more than 60 columns, you can change the value associated with the variable edit_initial_width in the file runabc.ini to something a little larger.

Other features are accessible from the cascaded menus at the top of the window. Many of the menus contain an individual help button that provides information relevant to these functions. Many of these features are not applied to the entire file you are editing but to only the selected area. You select an area by sweeping the mouse pointer while holding the left button down. (Other methods are described in the online help.)

Guitar chords and grace notes

A lot of abc tunes contain a single voice without any harmony. This sounds rather plain when it is converted to a MIDI file. The addition of guitar chords (contained in double quotes) greatly enhances the quality of the reproduction. Abc2midi will generate a chordal/bass accompaniment that helps the listener to quickly establish the key of the music and the beat of the tune. The guitar toolbox on the right helps you to choose and place guitar chords.

There are general rules for adding guitar chords. If the music is in a major key signature, eg. you should stay with the major chords which are I, IV and V. For C major they would translate to G, C and D. For minor key signatures which includes modes like Dorian and Phrygian, you should also include the minor chords II, III, VI, VII. You are also free to use the IV and V when appropriate. The editor automatically figures out the chords appropriate for the key signature and places the list in the guitar chords labeled frame on the left.

To place a chord, position the edit window cursor at the appropriate spot in the music, and then click one of the chord menu buttons. If the cursor precedes an existing guitar chord, you can replace it with another chord the same way. Usually a guitar chord should be specified for each bar, but if it has not changed in the previous bars, it may be left out.

If the key signature has changed, you may get the recommended chords for the new key signature by clicking the refresh button.

To change the chord type and inversion type for a specific chord, first indicate which chord you wish to modify by selecting it from the list in the guitar chords frame, here Bb Cm Dm etc. When you select it, the chord will still be placed in the position of the insert cursor in your edit window but the corresponding radio button will also be ticked. Now press the types menu button and select the type of chord you want. (There is some duplication in this list.) For example, if F is your active chord and you selected 7, then F would be changed to F7. If this is the chord you want then just click F7 and the guitar chord F7 will replace F at your current cursor position assuming you had not moved the cursor. If you also want the first inversion, then click inversion to change F7 to F7/A. This chord type and inversion type will remain fixed for that chord until you close the edit window or click the refresh button.

Below the inversion button is a list of suggested chords that should follow based on the chordal progression. You do not have to follow this progression, however the music may sound strange if you do not.

The grace toolbox which occurs below the guitar toolbox, is used for inserting various grace notes prior to a specific note in the file. Position, the cursor just before the note you want to grace (eg. A) and then select one of the grace sequences. For example if you click trill, {ABAB} will be inserted just before the note. If you change your mind and want slide, you can click that button and the grace note sequence will be changed. This only works if you have not moved the edit cursor and it is positioned just before the start of the trill. The sequence labeled cut is more formally known as appoggiatura. The sequence labeled strike is musically known as acciacccatura. Other sequences are mordent and reverse mordent, slide and trill.

The button labeled cfg is used for configuring the grace note labels and sequences; however, their labels should be seven or less letters. To make a change, place the cursor in one of the entry boxes shown below and type in the new name or sequence followed with a carriage return. These changes will remain the next time you start runabc. To return to the initial settings, click the reset button.

built in editor

The grace note sequence is indicated by a series of small positive or negative numbers. They indicate the relative pitch offset between the grace note and the note to which it is being applied.

Other formatting and editing tools

The cascaded menu item clean contains numerous functions. The retag item will retag the field commands and body of the file in different colours. Otherwise any new items that you have added will remain in black. erase all does what it says. You end up with a blank buffer.

You can remove all redundant guitar chords. (A guitar chord is redundant to abc2midi if it has not changed in the previous bar.)

You can remove all guitar chords or anything else included in double quotes from the designated portion of the file.

You can remove all grace notes or anything else included in curly braces from the designated part of the file.

Other functions such as remove inline voice fields, remove backslash continuations and remove tab chars are also self explanatory. These functions are handy when you are extracting a single voice from a multivoice file using the edit/extract part menu function.

There are special tools for transposing all the notes in certain section of the edit window.

You can replace each note in selected group of notes with the chords. For example the notes FAA FAd can be converted to [FD][AF][AF] [FD][AF][dB] by selecting tools/chords/third.

The above operation can be reversed using the tool replace chords. For example if your selected region includes
[A2D2][AD][BE] [c2F2][d2G2] | [cF][BE][cF][A-D-] [A4D4]
you can replace it with either
A2AB c2d2 | cBcA A4 or
D2DE F2G2 | FEFD D4
using this tool. The tool handles chords containing up to 4 notes. The notes in the chord are sorted by pitch and you select which note (eg. highest pitch) that should replace the chord.

This tool is useful for formatting the music into separate voices. For example you can change,

chords in one voice

to
chords split into two voices

This is illustrated below for the following abc file.
X: 6
T: Bela Rada
R: 
O: Srbija
B: 
D: 
Z: John Chambers  http://ecf-guest.mit.edu/~jc/music/
M: 2/4
L: 1/16
K: G
|: "G"[B2G2][dB][dB] [d2B2][^c^A][dB] | [dB][ec][d2B2] [d2B2][B2G2] \
| "D7"[d2B2][c2A2] [cA][BG][A2F2] | [cA][BG][A2F2] "G"[BG][AF][G2D2] :|
|: "C"[c4A4] [cA][BG][A2F2] | "D7"[d2B2][A2F2] [AF][GD][AF][BG] \
|  "C"[c4A4] [cA][BG][A2F2] | "D7"[d2B2][A2F2] [A4F4] :| 
The body of the music was duplicated by highlighting, grabbing it into the clipboard using the cntl-c, and dumping it using the cntl-v (or cntl-y in unix) command. V: fields were added to separate the copies so that the edit window now looks like
X: 6
T: Bela Rada
R: 
O: Srbija
B: 
D: 
Z: John Chambers  http://ecf-guest.mit.edu/~jc/music/
M: 2/4
L: 1/16
K: G
V:1
|: "G"[B2G2][dB][dB] [d2B2][^c^A][dB] | [dB][ec][d2B2] [d2B2][B2G2] \
| "D7"[d2B2][c2A2] [cA][BG][A2F2] | [cA][BG][A2F2] "G"[BG][AF][G2D2] :|
|: "C"[c4A4] [cA][BG][A2F2] | "D7"[d2B2][A2F2] [AF][GD][AF][BG] \
|  "C"[c4A4] [cA][BG][A2F2] | "D7"[d2B2][A2F2] [A4F4] :| 
V:2
|: "G"[B2G2][dB][dB] [d2B2][^c^A][dB] | [dB][ec][d2B2] [d2B2][B2G2] \
| "D7"[d2B2][c2A2] [cA][BG][A2F2] | [cA][BG][A2F2] "G"[BG][AF][G2D2] :|
|: "C"[c4A4] [cA][BG][A2F2] | "D7"[d2B2][A2F2] [AF][GD][AF][BG] \
|  "C"[c4A4] [cA][BG][A2F2] | "D7"[d2B2][A2F2] [A4F4] :| 
V:1 body was selected and the "tools/replace chords/with top note" was used to replace each chord with the top note. Guitar chords were removed from the second voice using "clean/remove all guitar chords". Finally the chords in the second voice were replaced by the second highest note using "tools/x replace chords/with 2nd note". The resulting edit window now appears as follows.
X: 6
T: Bela Rada
R: 
O: Srbija
B: 
D: 
Z: John Chambers  http://ecf-guest.mit.edu/~jc/music/
M: 2/4
L: 1/16
K: G
V:1
|: "G"B2dd d2^cd | ded2 d2B2 \
| "D7"d2c2 cBA2 | cBA2 "G"BAG2 :|
|: "C"c4 cBA2 | "D7"d2A2 AGAB \
|  "C"c4 cBA2 | "D7"d2A2 A4 :| 
V:2
|: G2BB B2^AB | BcB2 B2G2 \
| B2A2 AGF2 | AGF2 GFD2 :|
|: A4 AGF2 | B2F2 FDFG \
|  A4 AGF2 | B2F2 F4 :| 
The tool x replace chords differs from replace chords in the manner that it treats notes that are not embedded in chords. Instead of repeating the note, it is replaced with an invisible rest. Thus
G2 [A2c2]
would be replaced with
x2 A2
The tool solfege vocalization appends the solfege do/re/me.. symbols to the notes as a lyric line. For example if the following lines were highlighted for a tune in the key of Em,
A2 A3 c BA|B2 G3 B AG|A2 D2 ddcA|B8|!
A2 A3 c BA|B2 B2 c2 BA|G2 G2 AAGF|E8:|!
The function would replace these lines with
A2 A3 c BA|B2 G3 B AG|A2 D2 ddcA|B8|!
w: re re fa me re | me do me re do | re so so so fa re | me | 
A2 A3 c BA|B2 B2 c2 BA|G2 G2 AAGF|E8:|!
w: re re fa me re | me me fa me re | do do re re do ti | la | 
The vocalizations use the moveable-do system (as opposed to fixed-do). For the key of E minor, the relative major is G major so G is represented by do. The purpose of this function is to assist in learning music sight reading. The function figures out the key signature by searching backwards for the first K: field indication. (If the music contains key modulations, it is recommended that you highlight only the part of the music in the same key.) The program attempts to ignore guitar chords, decorations, field commands etc. but it is not perfect. For example something like ... A:| is mistaken for a field command and ignored, so the output may require minor editing. The program also ignores all accidentals since I have not learnt how to treat them.

The function align bars will cause the editor to insert spaces before the bar lines so that they line up vertically. This is done without changing the way the tune would be converted to a postscript or midi file. The image below shows part of a tune before the alignment.

no alignment
The next image shows the effect of the alignment. Though the alignment expands the size of the abc file, it is easier to read or edit. The alignment is applied on the entire contents of the edit window, so only one tune should be loaded. The algorithm is not very smart, so funny results may be obtained for some files. (For example tunes containing double bar lines.)

with alignment

For many folk dances, drum accompaniment may be more appropriate. The MIDI standard assigns one of the channels (usually 10) to be used for drum accompaniment. This means that any MIDI notes indicated in this channel is interpreted as a drum hit. There is a choice of more than 45 percussion instruments which is indicated using the byte normally reserved for the pitch. Since many percussion instruments such as cymbols, triangle, tambourine, ... do not have a pitch associated with the sound this does not pose any problem.

The abcguide.txt indicates how to set up the drum pattern using several of the %%MIDI extensions of abc2midi. The editor assists you with a special tool box for incorporating the drum accompaniment tools/drum. This tools allows you to create a drum pattern and patch it your abc tune. A simple pattern is indicated here.
%%MIDI drum dzdd 36 40 40
The drum tool appears as follows:

drum tool
The top text line window shows the default drum string d2dz2d. To change it, click on the entry box in the line below and enter your desired string. You must complete the string with a carriage return or click the enter button.

There are two scrolled listboxes that are used to map the individual drum hits (eg d2) to particular drum patches. The left box shows the current mapping for each drum hit. To change, the mapping select a particular drum hit in the left listbox and then click on a desired patch shown in the right list box. The mapping should change immediately. The beige label immediately above the list box shows the last selected patch. Whenever you click the enter button, all the drum hits will be changed to that patch.

The play button will allow you to listen to the particular drumstring. It will create and play a midi file with 8 bars of this drumstring. The paste button will paste the drumstring in your file being edited in the abcedit window. The %%MIDI drum command will be pasted at the position of the insert cursor. (Don't forget to insert the %%MIDI drumon command in the body of the music.)

You can see some sample dances where it is used in the collection of international and Israeli dances that I have transcribed. I have also included the abc files drumdemo.abc and drumpat.abc, that you may wish to listen to. The latter file is helpful for learning to associate the sounds of the MIDI percussion instruments with their names.

There is a separate display button for converting the entire contents in the editor to a common music notation postscript file and displaying it on the computer.

The edit button now gives you a choice of editing the entire abc file or just the selected tune. If you edit only a selected tune then it will be copied into a file called edit.abc in the same directory as runabc.tcl. This file will then be renamed to another file based on the title of the first tune in your selection. The renamed file will be placed in a work folder created by runabc, called workfold. In event there is another file with the same name, in the work folder, it will be replaced. You may use the save-as button to save the tune under a different file name, but under no condition overwrite the original file containing the collection since only the contents of the edit window are copied. When you do any editing, it is strongly recommended that you keep backups somewhere else just in case the unexpected occurs. Further notes about the edit button may be found in the runabc.txt file included in the runabc.zip distribution.

The play and display commands always rereads the original abc file, so you must save your changes to the disk file to hear the edited results. I always prefer editing a single tune files and update the compilation abc file using cut and paste or something similar when I am finished editing. I prefer to use the editor with which I am most familiar rather than the Tcl/Tk text widget. In any case, other people may have different styles.

Also be aware that if you are editing a compilation or deleting, adding or renumbering a tune, the table of contents window (title index) will need to be updated by rereading the same file. Otherwise, the play, display and edit selected tune may go to the wrong tune.

The edit/new option will create a template edit.abc file.

Edit menu/Copy

The function will copy the selected tunes in the table of contents to a designated abc file. If the file does not already exist, it will create a new file; otherwise, it will destroy the existing file and overwrite it with the selected tunes. The X: numbers will be preserved.

Copy and renumber will do the same as above but it will renumber the selected tunes increasing sequentially from a selected number.

Append will append the selected tunes to an existing file, preserving the original numbering.

Append and renumber will do the same but renumber the selected tunes.

The copy combine parts function is specificly designed to reformat Laura Conrads renaissance music in her allparts.abc files. Each part is written as a separate tune rather than a separate voice. Therefore it is not possible to create a midi file with all parts playing simultaneously. This function combines all the parts into one tune, giving each part a separate voice. Duplicate titles, and lyrics are removed. When using this function, you must first select (highlight) all the tunes that you wish to combine. Like other copy functions, you will prompted for the name of an output file.

Caution: do not try to copy over the source file already displayed in the table of contents.

The function 'separate tunes' splits a multitune abc file into separate files each containing one tune and puts the files into a directory with the same name as the input file (without the abc extension). You should select all the tunes that you want to extract in the TOC before using this function. To select all tunes press cntl-/ (i.e. control-slash).

Edit menu/Incipits

incipits
The function will copy the first few bars of all the tunes in the table of contents to a designated file or place it in the TclAbcEditor buffer. If the checkbox 'to single tune' is ticked, all the incipits will be stuffed into a single tune. This produces the most compact Postscript file when abcm2ps is executed on the output file and also allows you to put all the incipits in one MIDI file. If the checkbox is not ticked then each incipit goes into a separate tune and all the X: reference numbers are preserved. The number of bars in the incipit can be configured using the scale widget.

For multivoiced files, the first few bars of each voice will be copied. The function handles inline voice commands eg \[V:2\]\ but they should be placed at the beginning of the line.

If you want to produce incipits for any a selection of tunes, first copy the selected tunes to a separate abc file using runabc edit/copy command and then load that file into the TOC.

Extras/Find Title

The Extras button shows a picture of a wheel with teeth. If you are like me, you probably have a collection of several hundred abcfiles. Finding a specific tune can be quite laborious. If you have placed all your abcfiles into a specific folder, there is now a tool which makes it much easier to find a specific file or tune. When you click the button labeled 'find', a new tool will be displayed on your screen.

search tool

If this is the first time you are running this tool, it is necessary to enter the path name of the folder where all the abc files are located. This folder can contain sub-folders with more abc files. Now you are all set up. Just enter a word or two in the title in the search string entry box and then press carriage return or click the button labeled search. The program will search every abc file it finds for the specific word, and display the title of tunes in the listbox. (In this case, we were searching for any tunes with the word maggot.) If you have a big directory and some large files, please allow some time for the program to perform the search. You may abort the search anytime if you are getting too many hits.

To access any tune in the list box, just click that entry and the table of contents of that file will be displayed. Furthermore, the table of contents will be scrolled to the position where the file is visible.

The tool does not distinguish between upper and lower case letters; however, you should avoid punctuation marks and special characters as they mean something special to the string matching algorithm. The string you enter is interpreted as a regular Tcl expression using the regexp. As a result you can make fairly complex searches. For example,

mary | john will return any title containing the word mary or john
fairies$ will return any title ending with the word fairies
^some will return any title starting with the word some

Extras/Find Bar

There is also another tool that allows you to search for abc tunes based on the content in the body. The matching tool does not do a straight string search but removes extraneous information such as guitar chords, grace notes, decorations and compensates for different key signatures. You can perform exact matches or approximate matches. Furthermore it is not restricted to the first few bars of the tune. It will find a match anywhere in the tune. To use this tool, you enter one or more bars from the tune in the body entry box using abc notation. Also specify the meter, note length and key signature in the entry boxes M: L: and K:. Then press the match button. If you are using TclAbcEditor, then you can copy this information by clicking on the transfer button. The play button allows you to listen to this template. The output of the search will be displayed in a scrolled text window as shown below.

match tool
Bars which match the given criterion will be shown in red. If you click the file names shown in blue, that file will be automatically loaded in the table of contents and the specific matched tune will be selected in the list box. To learn more about abcmatch click on this link abcmatch link.

Multivoice extraction functions

The purpose of this function is to allow you to go from a full score (i.e. music for all instruments encoded in separate voices) to the sheet music of one part (one instrument). Musicians do not like turning pages while performing and would prefer if all the music fits on one or two pages on their music stand; so they would prefer to have the music for just their part. If there is a long series of rests where they are not playing, it is preferable that they are grouped together into one long rest. Sometimes their instrument automatically transposes the music to another key, so they would like the sheet music to be transposed accordingly. In contrast when the music is being notated, it is preferable to have all the parts together and interleaved.

The multivoice extraction function attempts to address this problem. First there is the problem of extracting and possibly transposing one of the voices. This is not trivial if the voices are interleaved. Next there is the problem of combining a sequence of bar rests. They would be indicated for each bar so that the music interleaves properly.

For historic reasons there are two conventions for indicating multirests. The old notation required by abc2ps uses something like "15"z8 where the number 15 indicates 15 consecutive bars and z8 is the length of a rest covering one bar. The newer notation would indicate this as Z15, where the upper case Z implies a full bar rest. Abc2midi, abcm2ps, yaps and other applications only understand the new notation.

extract part

Now here is a description of how this is done. First you indicate which voice number and any transposition in the first two entry boxes. Tranposition is indicated by an integer specifying the number of semitones to shift the music. Positive numbers shift the pitch upwards. Negative numbers shift downwards. Zero implies no transposition. If you tick the checkbox condense rests, then a line of music written as:

z4|z4|z4|z4|z4|AB CD|BC AA|
would appear either like:
"5"z4|AB CD|BC AA|
or
Z5| AB CD| BC AA|
depending on which radio button you have selected. If you select auto, then runabc will make its selection depending on which postscript converter you have chosen (abc2ps or other). The buttons marked "Display", "Save to file" or "To editor", performs the appropriate action. If you select "Display", the part will be extracted, converted to a Postscript file and displayed using gsview or whatever. If you select "Save to file", you will be asked for a abc file name for saving the part. If you select "To editor", the part will appear in the TclAbcEditor.

The extraction, transposition and rest condensation are all done by the external application abc2abc. In fact, when you perform the action the exec command appears appears at the bottom of the window for your information.

Creating Midi Files

You can save a tune as a midi file using the edit/save midi file(s) menu item. Runabc will prompt you for the name (path name) of the midi file. It is not necessary for you to enter a mid extension, but if you include it the program will not insert another one. If you wish to make many midi files at once, just select the tunes in the TOC and use the same function. Recall that the -/ will select all tunes, -\ will deselect all tunes, -mouse click will select or deselect a tune in the TOC. When you select this menu item, a property sheet shown below will appear below the TOC.

save midi files

The midi files will be named automatically in one of two ways depending on the radio buttons selection. The midi file name can be derived from the tune's title or else it can be derived from its xref number in the file. If you derive it from the title, the maximum number of characters in the tail part of the file name is by default 8 letters. So the midi file derived from the tune "April Waltz" would be called April_Wa.mid. You can change this default by replacing the value in the adjacent entry box. Note that if there are several tunes with the same title, that the same midi file may be overwritten several times.

Alternatively, you can choose to derive the midi file name from its xref number. The names of the midi files will be based on the name of the open abc file (in the TOC) and the X reference numbers. Thus if your active file is waltz.abc and you selected tunes 5 and 8, the file names will be waltz5.mid and waltz8.mid. You can choose a different root name by replacing the string in the adjacent entry box.

When you click the continue button, the program will proceed to create the midi files. All the files will be put into a separate folder that you will select. If the folder does not exist, you will can enter its name in the entry box and the folder will be automatically created.

Midi to Abc

It is quite difficult to find multivoiced abc files on the Web. Furthermore the genre of the abc files are fairly limited. Fortunately, you can make your own multivoiced abc files from the many MIDI files on the internet. In most cases the midi2abc tool does this completely automatically; however, a few MIDI files provide a challenge.

Besides abc, there are probably 50 or so music notation formats in common use. Many of them are proprietary to a commercial product and there are few applications for converting one format to another. Fortunately all music notation programs usually have provision to export the music in MIDI format. This provides a means of converting the music into abc format. Therefore, a lot of effort has been made in providing a good tool for converting a MIDI file into an abc file. Runabc provides three main tools for handling and viewing MIDI files. They are midi2abc, midishow and mftext which are all accessible through the extras menu. They shall be described in detail.

To get to the midi2abc interface, select the meu item extras/midi2abc. The following graphical interface will be displayed.

midi2abc tool

To use it, you first need to select the input midi file using the browse button. You also need to designate the name of an output abc file that will be created. Now click on the lower left hand button midi2abc which will execute the midi2abc.exe program. Once this program is executed, the specified abc file will be created and the play abc will be enabled. You may also click the top console button, to view the messages returned by midi2abc which are sometimes useful. See the sample below.

midi2abc console output

The button at the bottom, play orig will allow you to hear the original MIDI file. If you click on the button play abc, abc2midi will be convert the output abc file back to a MIDI file and send it to a media player program. If you click the next button labeled display at the bottom right of the window, the output abc file will be converted to a postscript file and the postscript viewer will display the results. If you wish to edit the file you will have to change the active file in the top entry box to the output abc file before selecting the editor. Pressing the top play button may produce different results since runabc may change the tempo or introduce other %%MIDI instructions to control the voice assignments which were selected by the user.

For most of the midi files posted on the web you should run midi2abc with the default parameters. These defaults can be restored by clicking the button labeled defaults.

Here is an easy example, you can try. Go to the web site http://www.contemplator.com/tunebook/ and find a MIDI file you like. Download this MIDI file and select this file as the input midi file. Click the midi2abc button and play and display the resulting abc file.

Now if you set this output abc file as you active file (in the top file entry box), you can do many more things with the result. Using the edit/extract part function you can extract a single voice from the multipart score and display it. Now suppose, you wish to play along with the MIDI file on your own musical instrument but you wish to slow it down. The tempo is already indicated in the output abc file, but you can still override it if you go to the Play options/tempo/pitch menu item. Tick the override tempo indications checkbox and it will play with whatever tempo you set. Suppose now you want to turn off some of the instruments. Select Play options/voices and adjust the audio levels of the different voices. Ignore, the program selections as they will not override the current indications in the abc file unless you have indicated that in the Play options/tempo/pitch window. Note after you have finished experimenting, you should remember to restore these settings to their nominal values before you quit or else all abc files will sound funny.

For some MIDI files especially the raw output of a MIDI keyboard it may be necessary to run midi2abc with different parameters. Though the output abc file converts back to a reasonable MIDI file, it may produce a PostScript file that is difficult to read. For those files it may be necessary to adjust some of the run time parameters in order to improve these results. This is explained below but first you need to understand how a midi file is encoded.

A midi file contains a list of events which are mainly note-on and note-off commands. A note-on/off command indicates the relative time from the previous command in units of midi pulses, the particular midi channel, the pitch in midi units and the loudness or velocity. There is a direct mapping between midi pitch units and the keys of a musical instrument so extracting the musical notes is generally simple. The mapping between note duration in midi pulses and note type (quarter note, half note, etc.) may be less straight forward in some cases.

All midi files contain an indication of the number of midi pulses per quarter note, but this may not be relevant for some midi files. If the midi file was created using music notation software, then this indication is probably reliable. On the other hand, if the midi file was recorded directly from a performer playing a musical instrument, there is no guarantee that the player will maintain this mapping exactly or approximately. The duration of a midi pulse in seconds is specified by a tempo command in the midi file. Most midi files have only one tempo command, but some may have many.

There are two types of MIDI files in current practice. The earlier types of file recorded are the MIDI files in one track, where the musical instruments are distinguished by the channel numbers. Newer MIDI files are multitrack, where each instrument is recorded in a separate track. Midi2abc is designed to work on the latter format but it can handle the earlier type to a limited extent.

In order to create an abc file, midi2abc needs to convert the note durations specified in MIDI pulses to abc units, where called quantum units. By default midi2abc assumes a quantum unit equal to half of the L: unit length which typically is either 1/8 or 1/16 depending on the time signature encoded in the MIDI file. Thus for L:1/8, the quantum unit is a 1/16 th note and midi2abc quantizes all notes to these units. Notes that are shorter than that (after rounding) are typically ignored. The conversion factor from MIDI pulses to quantum units is xunits, which may be determined in one of several ways depending upon the run time parameters of midi2abc. By default, midi2abc determines xunits from the header information in the midi file (PPQN or pulses per quarter note). However, midi2abc allows you to specify xunits as a run time parameter, or determine xunits from other information such as the tempo or desired number of measures to output. Furthermore, midi2abc has the capability of estimating xunits statistically by attempting to minimizing the quantization error. (For most music the note durations should be approximately integer multiples of some number of MIDI pulses.)

The first menu button on the abc2midi property sheet, labeled unit length, enables you to select how to determine the unit length. When the program starts up, the method used is "from midi file". If you change this setting to "from entry box", then you must enter a number in the adjoining entry box specifying this length. It is not recommended that you use this method unless you know a priori this conversion or you are doing some fine tuning. For your information, the unit length used by the program is printed out on the summary every time you click the midi2abc button or execute midi2abc.

If you specify "by minimization quantization error", then midi2abc will use its own algorithm for estimating the unit length. The answer is usually correct, but sometimes it is out by exactly a factor of two or so. If you specify "from tempo in entry box", then the adjacent entry box should contain the estimated number of beats per minute. The program will attempt to use this information to figure out the number of midi pulses in a quarter note and then unit length in order to get this beat. The program assumes the last tempo indication in the file so if the file has more than one tempo indication, this method is not going to work. Finally if you specify "from expected bars in entry box", then you should enter the number of bars or measures you expect in the output abc file. This assumes a constant time signature throughout the file. If the output music notation results is full of tied notes, the program is probably using the wrong unit length.

A lot of music does not begin with a full bar, but may start with one or more leading notes. This is called anacrusis. If For some MIDI files it may be necessary to either specify the anacrusis in quantum units, or else tell midi2abc to estimate the anacrusis using one of two algorithms. (One algorithm, attempts to minimize the tied notes across bar lines. The other algorithm searches for strong beats based on the velocity (or loudness) of the MIDI notes. If all the bar lines are off by a couple of beats, you can adjust that using the anacrusis control.

For some reason, many MIDI files do not specify a key signature. This does not affect how the MIDI file is played by the synthesizer, since all the sharps and flats have already been notated in the MIDI file; however, there may be lots of accidentals when you convert the file to abc format. If the key signature is encoded in the MIDI file, midi2abc will use this information in creating the abc file but if it is missing midi2abc will attempt to guess the key signature by minimizing the number of accidentals. Sometimes the key signature indicated in the MIDI file is incorrect and you may wish to use a different one. The next menu button, key signature, provides you with several options. There is a similar menu button for time signature.

Finally, if the MIDI file contains several instruments encoded in different MIDI channels (0 to 15), you have the option of extracting only a single channel. By default all channels are extracted and the different lines of music (voices) are separated by the track number. Nearly all the recent MIDI files are multitrack format (MIDI format 1)

Certain percussion instruments are represented in the MIDI file by notes of very short durations. These will be ignored by midi2abc unless you tick the box, save short rests. In that case, all these short notes will be assigned a duration of one quantum unit.

To improve the articulation of notes, some MIDI music contains short time gaps between every note. This would appear as many rests sprinkled between each note in the abc file. The parameter minimum rest allows you to specify the minimum sized rest that can appear in the abc file. Rests smaller than that will be absorbed by the preceding note.

If you know the music is not full of triplets and broken notes, then you may wish to tick the check box no triplets .

The music in MIDI files are generally more complex than you typically find in abc files. Furthermore, midi2abc cannot distinguish grace notes from real notes and a trill will expand to a long series of notes. Therefore the output of midi2abc may is usually very complicated and it is recommended that you limit the output to one measure (or bar) per line. (Some software may have difficulty handling lines longer than 128 characters.) Midi2abc will place a backslash continuation at the end the line so that most abc to postscript converters will not print one bar per staff. The entry boxes in this interface allow you to specify both the number of bars per output line, and the number of bars to continue. Enter small numbers in the entry box bars per line and bars per staff.

Midi2abc outputs the tracks in separate blocks for each voice. This is quite difficult to edit or read. If you tick the check box voice interleave, runabc will run its own script to produce an output in voice interleaved format. This script currently is rather restrictive and only handles the midi2abc output.

New parameters were recently introduced in midi2abc that provide more control on the size of the quantum unit. As mentioned in the beginning of this discussion, midi2abc splits a L: unit length into two parts called quantum units. Now you may specify the number of parts provided it is a power of 2 and not too large. Midi2abc automatically chooses the L: unit length (either 1/8 or 1/16), but now you also have the option of choosing your own unit length provided the denominator is a power of 2. Increasing the quantization precision by raising parts/unit will provide a more accurate representation however this can introduced strange tied notes like 1/4 tied to 3/64 notes which will be hard to sight read. It is recommended that you stick to the default of 2. By convention L:denominator=0 indicates allows midi2abc to choose its own L:unit length.

For some raw MIDI files, in particular keyboard music, all the notes are placed in a single track. There are many nonhomophonic chords -- chords containing notes that do not share a common onset time or stop time. In other words they are polyphonic. Representation of such chords is rather awkward in abc notation producing an awkward notation which is difficult to edit.

F/2E/2[FF,-] [GF,]A/2-[A/2-F/2] [A/2E/2]F/2[B/2-D/2][B/2-E/2]| \
[B/2-C/2][B/2D/2]B,/2D/2 [G/2C/2][F/2D/2][G/2-B,/2][G/2C/2] [A/2-A,/2][A/2B,/2][B/2-G,/2][B/2-F/2] [B/2E/2]D/2[c/2-E/2][c/2-F/2]| \
[c/2-D/2][c/2E/2][A/2-F,/2][A/2F/2] [d/2-E/2][d/2D/2]
If the abc to postscript converter is able to handle this file, it produces an almost unreadable output similar to below.
midi2abc output with no splits

The option bar splits attempts to avoid polyphonic chords by splitting a bar into separate lines using the '&' symbol. The output is somewhat easier to edit and looks like this.

F/2E/2F GA3/2x/2D/2E/2 C/2D/2B,/2D/2 &  \
xF,2x/2F/2 E/2F/2B2x |  \
[G/2C/2][F/2D/2]B,/2C/2 A,/2B,/2B3/2x/2E/2F/2 D/2E/2F,/2F/2 &  \
xG AG,/2F/2 E/2D/2c2A | 
E/2 & d
midi2abc output with bar splits

This output is somewhat of an improvement but leaves much to be desired. The option voice splits goes a further step and splits the entire voice into separate voices. The output looks like

V: split2A
%%MIDI program 24
F/2E/2F GA3/2x/2D/2E/2 C/2D/2B,/2D/2| \
[G/2C/2][F/2D/2]B,/2C/2 A,/2B,/2B3/2x/2E/2F/2 D/2E/2F,/2F/2| \
E/2D/2
V:split2B
xF,2x/2F/2 E/2F/2B2x| \
xG AG,/2F/2 E/2D/2c2A| \
midi2abc output with voice splits
which is possibly easier to interpret. Unfortunately, this is a difficult problem in artificial intelligence and midi2abc's greedy algorithm does not always do a good job. The code is still not fully debugged.

Midishow - Piano Roll Representation

The main purpose of this application is to allow you to produce an abc file or display the music notation of part of a MIDI file. MIDI files are generally a lot more complicated and longer than abc files. There may be repeats and key signature changes that are not expressed explicitly in the MIDI file. Converting the entire MIDI file into an abc file may produce a big mess requiring much editing. In some cases the output file may not be accepted by other applications and cause it to crash.

Midishow is a MIDI navigation tool built into runabc. It displays the MIDI file in piano roll format in a scrolled Tcl/Tk canvas. Using the scroll and zoom controls, you can select any particular segment of the MIDI file and convert this section into an abc file using midi2abc. Other functions allow you to examine the characteristics of the MIDI file or part of the MIDI file and determine how it was created.

To use this tool, you must have the latest version of midi2abc and a new program midicopy which comes with the abcmidi distribution. If the MIDI file is very big (say over 100 kbytes) and your computer is slow (say 600Mhz), there may be a long pause before Midishow responds. Runabc will appear to be frozen for that time. Just be patient and the results should appear in about a minute.

Midishow is called from the Extras menu. Assuming you have selected a midi file in the mid2abc window (described above), midishow will generate a new window like the following example.

midishow toplevel
Each note is represented by a black horizontal arrow, whose vertical position represents its pitch and whose width represents its duration. If you place the mouse pointer on any particular note, this note and all the other notes belonging to the same track are highlighted in red. (Unfortunately, the mouse pointer was removed when I grabbed this window.) A short descriptor of the note is placed in text near the bottom of the window. If you right click the mouse pointer while it is positioned over this note, all the highlighted notes will be put into a temporary MIDI file and sent to your designated MIDI player. If you right click while the mouse pointer is not over any particular note, then all the displayed notes (i.e. all tracks) are played. The piano window is resizeable and you can change the horizontal scale using the zoom and unzoom buttons.

While the music is playing, you may see a vertical red marker attempt to follow along with the music. Unfortunately, the music is played by a separate application which does not communicate with runabc so there may be a loss of synchronization between the movement of the cursor and the music. If the moving marker is annoying, you can turn off this feature by removing the tick mark from the config/follow while playing checkbox. Pressing any key on the keyboard while the piano window is in focus will stop the moving cursor for the current instance.

For finer control, you can select a particular portion of the MIDI file by sweeping the mouse cursor while holding the left mouse button down. The selected area will be highlighted in a light yellow stipple. (Double clicking anywhere in the piano window will remove the highlighted region.) The abcfile button, and right mouse button will now act on only the the highlighted area.

You may configure the program to separate the MIDI file by either tracks or channels.

The action menu button brings up a menu of selected actions that you can apply to the displayed region of the MIDI file. If you select specific channels or tracks using the check buttons at the bottom of the window, then only those tracks/channels will be processed. If no tracks or channels have been selected, then all the channels and tracks will be processed. For example, you can create an using midi2abc for the specific time region and tracks. The midi2abc configuration parameters can be customized using the extras/midi2abc window.

If you select action/velocity distribution, the program will analyze the velocity (loudness) indications in the MIDI file and display a graph of its distribution in a separate window. The vertical scale is in units of probability.

velocity distribution of MIDI
The distribution provides some indication of how the MIDI file was created. If the velocities cover a wide range, the MIDI file was probably produced using a MIDI instrument with velocity sensors. If all the notes are restricted to a few velocity values, then the MIDI file was probably created using a music notation program. An example is shown below.
velocity distribution of MIDI

If you select action/velocity map, the program will display the velocity of the notes versus beats corresponding to the midishow display. Each note is a horizontal arrow, but its elevation now corresponds to its velocity instead of its pitch. If the music contains many chords of the same velocity, many of the notes will appear on top of each other. You can select particular tracks or channels using the selection menu in the midishow window. If you scroll or zoom, in the midishow window you should update the plot by calling this action item again.

velocity map of MIDI

If you select action/pitch distribution, you get two graphs. The first plot is the distribution of all pitches in the the exposed region of the MIDI file. This plot gives you an idea of the range of notes.

pitch distribution of MIDI
The second plot shows the distribution of pitch classes. This is useful for guessing the likely key signature of the music. Many MIDI files do not specify the key signature. By observing which keys are absent and which one is the most common, one can frequently infer the musics key signature. In the following plot, the key of G is most common and the key of F# occurs instead of F. This suggests the key of exposed section is G major.
pitch class distribution of MIDI

The beat graph is a useful but complicated representation to describe. It plots the position of the onset time of a note in a beat versus its beat number for all the selected notes. If you look at the mftext output displayed by runabc, note onset times are represented by beat number, where a beat is usually a quarter note. This is more informative, than displaying the MIDI pulse number. The relationship between MIDI pulses and quarter notes is given by the PPQN parameter (pulses per quarter note) which appears in the header of the MIDI file. If the MIDI file was produced by a music notation program, the onset times of the notes follow musical standards at occur at exact fractions of a beat. So the beat numbers of a note are generally numbers like, 10.250, 12.000, 13.50 etc. rather than 10.158, 12.012, 13.683 etc. The beat graph plots the fraction of a beat versus the beat number so for previous onset times the points (10, 0.250), (12, 0.000) and (13.0 0.500) would be plotted. The following plot is an example of a beat graph for a MIDI file produced by a music notation program.

beat graph 1
Note the points generally align along horizontal lines. If there are no notes smaller than a quarter note, then the horizontal line will be along the zero axis.

Creating a MIDI file using a music notation program is very slow. MIDI files are also created in real time while the musician is playing a MIDI keyboard. Often the musician plays the music a little fast or a little slow so that all the beats are a little shorter or longer than the nominal value indicated by the PPQN. The following figure shows the beat graph for such a file.

beat graph 2
Since the beat positions seem to occur earlier in each subsequent frames (the points are sloping downwards), it appears that the nominal PPQN is a bit too large. If midi2abc produced a abc file using the value in the MIDI file, there will be lots of tied notes. (In this case, midi2abc should estimate the unit length by minimizing the quantization error and you may probably have to introduce an anacrusis value.)

You may also see a beat graph which looks like this.

beat graph 3
The PPQN is probably correct, but the notes have not been quantized to musical intervals. The midi2abc output may need considerable editing.

The beat graph is not my original idea, but was first introduced by Van Belle Werner (http://bio6.itek.norut.no/werner/Papers/bpm04/). I adapted it to a MIDI file.

Midishow indicates quarter note beat positions with vertical lines based on the ppqn variable in the MIDI file. (To avoid cluttering the screen they are decimated until you zoom into a specific area.) For some MIDI files, the ppqn has an incorrect as discussed above. You can temporarily change the ppqn and the spacing of the quarter beat indications by going to the config/ppqn adjustment menu item on the top left. The following window should pop up.

beat graph 3
Clicking on the button increase ppqn or decrease ppqn will increment or decrement the ppqn and increase or decrease the spacing between the quarter note vertical lines. Clicking either the button + pulse offset or - pulse offset will not change the spacing but merely shift the quarter note lines to the left or right. If you hold down any of these buttons for more than a half a second, the appropriate action will be automatically repeated about 20 times a second.

To illustrate the usefulness of this feature, you need to download Scarlatti's Sonatas from John Sankey's MIDI site.
http://www.sankey.ws/harpsichord.html
These MIDI files are difficult to convert to music notation for several reasons. The ppqn indication is frequently incorrect and there is no time signature meta commands. (In addition each note class is in a different MIDI channel to allow pitchbending to the desired temperament.) If you run midishow on one of these files (eg. K019.MID which is in 2/4 time) you will find that the quarter note lines do not line up with the notes since the file assumes a ppqn of 192.

K019 raw
By adjusting the ppqn, you can get something like this.
K019 adjusted
Note the ppqn value of 528 listed at the bottom of this window. Midi2abc is unable to infer correct unit length even when using the -gu option. However, you can tell it to use the value of 264 (for a 1/8 note unit length) (i.e. use options -u 264 -m 2/4 -aul 8) and get something resembling the printed score.

You can also use the beatgraph output to infer the ppqn. If the lines are going up, you need to increase the ppqn. (The lines become flat when ppqn is 536. You need to request a new beatgraph output whenever you change the ppqn.)

As a convenience, the actions create abc file, play abc and display abc will migrate your ppqn parameters to the midi2abc options whenever the ppqn window is displayed.

If you are preparing a paper, you may need a copy of the displayed piano roll as a PostScript file. Click the button action/Create PostScript file to produce a file called piano.ps.

The analysis of chords is a challenging problem in musicology. Another action feature unique chords (which may be of questionable value) creates a textual histogram of all chords in the exposed portion of the MIDI file. This is presented as a table in a separate window illustrated below.

chord statistics
The chords were creating by from all coincident notes after combining all tracks. Provided the chord last for more than 0.2 beats it is included in the table. The chords are generated starting from the lowest note and going up in pitch. The maximum number of notes in the chord may be altered using the scale widget. The table lists the chord's notes and the number of times this chord was encountered in the exposed section of the MIDI file. Pressing, the chordlist button regenerates the table. The chordclasses computes the chords from pitch classes only. (In other words octave position is ignored.)

Mftext - Textual Representation of a MIDI file

mftext window

Clicking extras/mftext will display a window similar to above showing a textual representation of a MIDI file. In order for this to work you need the latest version of midi2abc (2.80 or higher). The output is somewhat similar to mftext. Time is indicated in beat units. The channel number is usually indicated after the MIDI command.

The checkbuttons on the bottom allow you to elide specified tracks or specified MIDI commands. For example in the above sample, all the MIDI commands in track 2 were hidden. This is useful when you are viewing a fairly complex MIDI file. If you are eliding a mixture of tracks and MIDI commands, tcl/tk may get confused and not elide some of the commands correctly. I do not know how to fix this problem.

Quiting

Whenever you exit from runabc.tcl by clicking on the x on the top right corner of the window (assuming Windows 95/NT), the program creates or updates a file called runabc.ini. This is an ascii file containing all of your settings allowing the program to resume the next time you run it.

seymour.shlien@crc.ca.

Return to top level to download runabc.zip and read the install.html page.


This page was last updated on December 06 2004