abcMIDI :   abc <-> MIDI conversion utilities

midi2abc version 2.0.2
abc2midi version 1.5.7
abc2abc  version 1.6.3

11th June 1998

James Allwright
J.R.Allwright@westminster.ac.uk
University of Westminster,
London, UK

These programs may be freely redistributed. They are based on the 'midifilelib'
public domain MIDI file utilities, available from

http://www.harmony-central.com/MIDI/midifilelib.tar.gz

This package is to be found on the web at

http://perun.hscs.wmin.ac.uk/~jra/abcMIDI/

---------------------------------------------------------------------
Program Code

The file midifile.c and the header file midifile.h are almost unchanged from 
the midifilelib distribution. To see the program dependencies, examine the
Makefile.

Compilation

To compile the code, type

make all

If the complete compilation does not work, you can try compiling the 
individual programs separately :

make midi2abc
make abc2midi
make abc2abc
make mftext

----------------------------------------------------------------------
midi2abc - program to convert MIDI format files to abc notation. 

This program takes a MIDI format file and converts it to something as close
as possible to abc text format. The user then has to add text fields not
present in the MIDI header and possibly tidy up the abc note output.

Features :

* The key is chosen so as to minimize the number of accidentals. 
Alternatively, the user can specify the key numerically (a positive number
is the number of sharps, a negative number is minus the number of flats).
* Note length can be set by specifiying the total number of bars or the 
tempo of the piece. Alternatively the note length can be read from the file.
However, by default it is deduced in a heuristic manner from the inter-note 
distances.  This means that you do not have to use the MIDI clock as a 
metronome when playing in a tune from a keyboard. 
* Barlines are automatically inserted. The user specifies the number of
measures in the anacrusis before the first barline and the time signature.
* The program can guess how many beats there should be in the anacrusis,
either by looking for the first strong note or minimizing the number of
notes split by a tie across a barline.
* Where a note extends beyond a bar break, it is split into two tied notes.
* The output has 4 bars per line.
* Enough accidental signs are put in the music to ensure that no pitch
errors occur if a barline is added or deleted.
* The program attempts to group notes sensibly in each bar.
* Triplets and broken rhythm (a>b) are supported.
* Chords are identified.
* Text information from the original MIDI file is included as comments.
* The -c option can be used to select only 1 MIDI channel. Events on 
other channels are ignored.

What midi2abc does not do :

* Supply tune title, composer or any other field apart from X: , K:, Q:, M:
and L: - these must be added by hand afterwards, though they may have been
included in the text of the MIDI file.
* Support duplets, quadruplets, other esoteric features.
* Support mid-tune key or meter changes.
* Deduce repeats. The output is just the notes in the input file.
* Recover an abc tune as supplied to abc2midi. However, if you want to
do this, "midi2abc -xm -xl -xa -f file.mid" comes close.

midi2abc version 2.0
  usage :
midi2abc <options>
         -a <beats in anacrusis>
         -xa  extract anacrusis from file (find first strong note)
         -ga  guess anacrusis (minimize ties across bars)
         -m <time signature>
         -xm  extract time signature from file
         -xl  extract absolute note lengths from file
         -b <bars wanted in output>
         -Q <tempo in quarter-notes per minute>
         -k <key signature> -6 to 6 sharps
         -c <channel>
         -f <input file>
Only the -f option is compulsory. Use only one of -xl, -b and -Q.
If none of these is present, the program attempts to guess a 
suitable note length.

The output of midi2abc is printed to the screen. To save it to a file, use
the redirection operator.

e.g.

midi2abc -f file.mid > file.abc

If the MIDI file is computer-generated, you may be able to extract the time
signature from it using the -xm option. Otherwise you should specify it with
-m. Allowable time signatures are C, 4/4, 3/8, 2/4 and so on.

If the tune has an anacrusis, you should specify the number of beats in
it using the -a option. 

-------------------------------------------------------------------------

abc2midi  - converts abc file to midifile.
Usage : abc2midi <abc file> [reference number] [-c] [-n notes]
        [reference number] selects a tune
        -c selects checking only
        -n notes (specifies units of note storage to be allocated)


Features :

* you can pick out one tune to convert by giving its reference number

e.g. abc2midi mytunes.abc 5

This will produce a file mytunes5.mid. Otherwise all tunes in the file
are converted to MIDI files mytunes1.mid, mytunes2.mid and so on. The
number appended is the reference number givcen in the X: field for each tune.

* Broken rythms (>, <), chords, n-tuples, slurring, ties, staccatto notes,
repeats, in-tune tempo/length/meter changes are all supported.

* R:hornpipe or r:hornpipe is recognized and note timings are adjusted to
give a broken rythm (ab is converted to a>b).

* Most errors in the abc input will generate a suitable error message in
the output and the converter keeps going.

* Comments and text fields in the abc source are converted to text events
in the MIDI output

* If guitar chords are present, these are generated in the MIDI output.

* If there are mis-matched repeat signs in the abc, the program attempts to
fix them. However, it will not attempt this if a multi-part tune 
description has been used or if multiple voices are in use.

* Karaoke MIDI files can be generated by using the w: field to include 
lyrics.

* There are some extensions to the abc syntax of the form

%%MIDI channel n

These control channel and program selection, transposing and various
other features of abc2midi. See the file abcguide.txt for more
details.

Limitations :

* Ties used to tie notes across a barline will cause an erroneous bar length
error.

* No field is inherited from above the X: field of the tune.

-------------------------------------------------------------------------
abc2abc

Usage: abc2abc <filename> [-s] [-n] [-b] [-r] [-e] [-t X] -u
  -s for new spacing
  -n for new linebreaks
  -b to remove bar checking
  -r to remove repeat checking
  -e to remove all error reports
  -t X to transpose X semitones
  -u to update notation ([] for chords and () for slurs)

A simple abc checker/re-formatter/transposer. If the -n option is selected, 
error checking is turned off. The program attempts to linebreak at a ||  :|  
|: or :: .

If you want to check an abc tune, it is recommended that you use abc2midi 
with the -c option as this performs extra checks that abc2abc does not do.

The output of abc2abc is printed to the screen. To save it to a file, use
the redirection operator.

e.g.

abc2abc file.abc -t 2 > newfile.abc

-------------------------------------------------------------------------

mftext - MIDI file to text

This gives a verbose description of what is in a MIDI file. You may wish
to use it to check the output from abc2midi. It is part of the original
midifilelib distribution.

-------------------------------------------------------------------------

Bug reports

Please report any bugs you find in abc2midi, midi2abc or abc2abc to 
J.R.Allwright@westminster.ac.uk. Better still, send me a patch to fix the 
problem! I do try to maintain the code, but it may take me a while to get 
round to fixing a bug.
