1ABC2MIDI(1)                 General Commands Manual                ABC2MIDI(1)
2
3
4

NAME

6       abc2midi - converts abc file to MIDI file(s)
7

SYNOPSIS

9       abc2midi  infile  [refnum]  [-c]  [-v]  [-ver]  [-t]  [-n  limit] [-CS]
10       [-quiet] [-silent] [-Q tempo] [-NFNP] [-NFER] [-NGRA]  [-NGUI]  [-STFW]
11       [-OCC] [-NCOM] [-HARP] [-BF] [-TT] [-o outfile] -CSM [filename]
12

DESCRIPTION

14        The default action is to write a MIDI file for each abc tune
15        with the filename <stem>N.mid, where <stem> is the filestem
16        of the abc file and N is the tune reference number. If the -o
17        option is used, only one file is written. This is the tune
18        specified by the reference number or, if no reference number
19        is given, the first tune in the file.
20

OPTIONS

22       refnum process the tune with reference number refnum
23
24       -c     selects checking only
25
26       -v n   selects verbose option where n is the level (optional)
27
28       -ver   prints version number and exits
29
30       -t     selects filenames derived from tune titles
31
32       -CS    use 2:1 instead of 3:1 for broken rhythms
33
34       -quiet Suppresses some common warnings.
35
36       -silent
37              Suppresses other messages.
38
39       -n  X  limits the length of the file name stem to X characters
40
41       -Q  tempo
42              sets the default tempo in quarter notes per minute if it was not
43              specified in the abc header.
44
45       -NFNP  Ignore any dynamic indications !f! !ff! etc.
46
47       -NFER  Ignore any fermata indications (eg H or !fermata!).
48
49       -NGRA  Ignore any grace notes.
50
51       -NGUI  Ignore any guitar chords enclosed in double quotes.
52
53       -STFW  Place lyric text in separate MIDI tracks.
54
55       -NCOM  Suppress some comments in the output MIDI file.
56
57       -OCC   Accept old chord convention (eg +D2G2+ instead of [DG]2).
58
59       -BF    BarFly mode: invokes a stress model if possible.
60
61       -HARP  Roll ornaments=roll are generated for the harpist (same pitch)
62
63       -TT    Changes the tuning from A = 440 Hz.
64
65       -o outfile
66              write output to outfile
67
68       -CSM infile
69              load a set of custom stress modes from a file
70

FEATURES

72       * Broken rhythms (>, <), chords, n-tuples,  slurring,  ties,  staccatto
73       notes,  repeats,  in-tune  tempo/length/time  signature changes are all
74       supported.
75
76       * R:hornpipe or r:hornpipe is recognized and note timings are  adjusted
77       to give a broken rhythm (ab is converted to a>b).
78
79       *  Most  errors in the abc input will generate a suitable error message
80       in the output and the converter keeps going.
81
82       * Comments and text fields in the abc  source  are  converted  to  text
83       events in the MIDI output
84
85       * If guitar chords are present, they are used to generate an accompani‐
86       ment in the MIDI output.
87
88       * If there are  mis-matched  repeat  signs  in  the  abc,  the  program
89       attempts to fix them. However, it will not attempt this if a multi-part
90       tune description has been used or if multiple voices are in use.
91
92       * Karaoke MIDI files can be generated by using the w: field to  include
93       lyrics.
94
95       *  Nonnumeric  voice  id's, eg. V: soprano, as proposed for the new abc
96       standard is accepted.
97
98       * Invisible rests specified by x are treated the  same  way  as  normal
99       rests (z).
100
101       *  Decorations  may  be  indicated using either the deprecated notation
102       (eg. !fermata!) or the standard version 2.0 notation (eg. +fermata+).
103

LIMITATIONS

105       * No field is inherited from above the X: field of the tune.
106
107
108

ABC SYNTAX EXTENSIONS

110       * There are some extensions to the abc syntax of the form
111
112       %%MIDI channel n
113
114       These control channel and program selection,  transposing  and  various
115       other features of abc2midi.
116
117       Each  of  these  should  appear  on  a  line by itself. All of them are
118       allowed within the abc tune body. By using these  in  combination  with
119       the part notation, one can, for example, play a part transposed or in a
120       different key.
121
122       The idea behind this syntax is that other programs will treat it  as  a
123       comment and ignore it.
124
125       %%MIDI channel n
126
127       selects melody channel n (in the range 1-16).
128
129       %%MIDI program [c] n
130
131       selects program n (in the range 0-127) on channel c. If c is not given,
132       the program is selected on the current melody channel. Most modern tone
133       generators  follow  the General MIDI standard which defines the instru‐
134       ment type for each program number.
135
136       %%MIDI beat a b c n
137
138       controls the way note velocities are selected. The first note in a  bar
139       has  velocity  a. Other "strong" notes have velocity b and all the rest
140       have velocity c. a, b and c must be in the range 0-127. The parameter n
141       determines which notes are "strong". If the time signature is x/y, then
142       each note is given a position number k = 0, 1, 2  ..  x-1  within  each
143       bar.  Note that the units for n are not the unit note length. If k is a
144       multiple of n, then the note is "strong". The volume  specifiers  !ppp!
145       to !fff! are equivalent to the following :
146
147       !ppp! = %%MIDI beat 30 20 10 1
148       !pp!  = %%MIDI beat 45 35 20 1
149       !p!   = %%MIDI beat 60 50 35 1
150       !mp!  = %%MIDI beat 75 65 50 1
151       !mf!  = %%MIDI beat 90 80 65 1
152       !f!   = %%MIDI beat 105 95 80 1
153       !ff!  = %%MIDI beat 120 110 95 1
154       !fff! = %%MIDI beat 127 125 110 1
155
156
157       %%MIDI beatmod n
158
159       Increments  by  n  (or decrements if n is negative) the velocities a, b
160       and c described above. The instructions !crescendo(!  and  !crescendo)!
161       are  equivalent  to  inserting a %%MIDI beatmod 15 wherever they occur.
162       (Alternatively you can use !<(! and !<)!.) Similarly  the  instructions
163       !diminuendo(! and !diminuendo)! are equivalent to %%MIDI beatmod -15.
164
165
166       %%MIDI deltaloudness n
167
168       where  n  is  a  small  positive  number.  By default the crescendo and
169       diminuendo instructions modify the beat variables a, b,  and  c  by  15
170       velocity  units.  This  instruction  allows  you to set this default to
171       value n.
172
173
174       %%MIDI nobeataccents
175
176       For instruments such as church organ that have  no  greatly  emphasized
177       beat  notes,  using this will force use of the 'b' velocity (see %%MIDI
178       beat) for every note irrespective of position in the bar.  This  allows
179       dynamics (ff, f, etc) to be used in the normal way.
180
181       %%MIDI beataccents
182
183       Revert to emphasizing notes the the usual way. (default)
184
185
186       %%MIDI beatstring <string of f, m and p>
187
188       This  provides  an  alternative  way of specifying where the strong and
189       weak stresses fall  within  a  bar.  'f'  means  velocity  a  (normally
190       strong),  'm' means velocity b (medium velocity) and 'p' means velocity
191       c (soft velocity).  For example, if the  time  signature  is  7/8  with
192       stresses  on the first, fourth and sixth notes in the bar, we could use
193       the following
194
195       %%MIDI beatstring fppmpmp
196
197       %%MIDI transpose n
198
199       transposes the output by the specified number of semitones.  n  may  be
200       positive or negative.
201
202       %%MIDI rtranspose n
203
204       Relative  transpose  by the specified number of semitones. i.e.  %%MIDI
205       transpose a followed by %%MIDI rtranspose b results in a  transposition
206       of  a+b.  %%MIDI  transpose b will result in a transposition of b semi‐
207       tones, regardless of any previous transposition.
208
209       %%MIDI c n
210
211       specifies the MIDI pitch which corresponds to c.  The  default  is  60.
212       This number should normally be a multiple of 12.
213
214       %%MIDI grace a/b
215
216       sets  the  fraction  of  the next note that grace notes will take up. a
217       must be between 1 and b-1. The grace notes may  not  sound  natural  in
218       this approach, since the length of the individual grace notes vary with
219       the complexity of the grace and the length of  the  following  note.  A
220       different  approach  (which  is now the default) assumes that the grace
221       notes always have a fixed duration.  To  use  the  other  approach  you
222       would specify,
223
224       %%MIDI gracedivider b
225
226       where b specifies how many parts to divide the unit length specified by
227       the L: field command. For example if b = 4 and L:  =  1/8,  then  every
228       grace  note  would be 1/(8*4) or a 32nd note. Time would be stolen from
229       the note to which the grace notes are applied. If that note is not long
230       enough  to  handle  the  grace then the grace notes would be assigned 0
231       duration.
232
233
234
235
236       %%MIDI chordname name n1 n2 n3 n4 n5 n6
237
238       Defines how to play a guitar chord called "name". n1 is usually  0  and
239       n2,  n3 to n6 give the pitches of the other notes in semitones relative
240       to the root note. There may be fewer than 6 notes in the chord, but not
241       more.If  "name"  is already defined, this command re-defines it. Unlike
242       most other commands, chordname definitions stay in  effect  from  where
243       they  are defined to the end of the abc file. The following illustrates
244       how m, 7, m7 and maj7 could be set up if they were not already defined.
245
246       %%MIDI chordname m 0 3 7
247       %%MIDI chordname 7 0 4 7 10
248       %%MIDI chordname m7 0 3 7 10
249       %%MIDI chordname maj7 0 4 7 11
250
251       %%MIDI gchord string
252
253       sets up how guitar chords are generated. The string is a sequence  made
254       of  of  z's, c's  f's and b's for rests, chords, fundamental and funda‐
255       mental plus chord notes respectively.  This specifies how each  bar  is
256       to be played.  An optional length is allowed to follow the z's, c's f's
257       and b's  e.g.  czf2zf3.   If  the  abc  contains  guitar  chords,  then
258       abc2midi  automatically adds chords and fundamentals after encountering
259       the first guitar chord. It keeps using that chord until a new chord  is
260       specified  in the abc. Whenever the M: field is encountered in the abc,
261       an appropriate default string is set :
262
263       For 2/4 or 4/4 time default is equivalent to : %%MIDI gchord fzczfzcz
264
265       For 3/4 time default is equivalent to : %%MIDI gchord fzczcz
266
267       For 6/8 time default is equivalent to : %%MIDI gchord fzcfzc
268
269       For 9/8 time default is equivalent to : %%MIDI gchord fzcfzcfzc
270
271       The gchord command has been extended to allow you to play the  individ‐
272       ual  notes  comprising the guitar chord. This allows you to play broken
273       chords or arpeggios. The new codes g,h,i,j, G,H,I,J reference the indi‐
274       vidual  notes starting from the lowest note of the chord (not necessar‐
275       ily the root in the case of inversions). For example for  the  C  major
276       chord,  g  refers  to  C, h refers to E and i refers to G. For a gchord
277       command such as,
278
279       %%MIDI gchord ghih
280
281       Abc2midi will arpeggiate the C major guitar chord to  CEGE.  The  upper
282       case  letters  G,H,I,  and  J  refer  to the same notes except they are
283       transposed down one octave. Note for the first inversion of the C major
284       chord  (indicated by "C/E"), E would be the lowest note so g would ref‐
285       erence the note E.
286
287       Like other gchord codes, you may append a numeral indicating the  dura‐
288       tion of the note. The same rules apply as before.  You can use any com‐
289       bination of the gchord codes, (fcbghijGHIJz).
290
291
292
293       %%MIDI chordprog n
294
295       Sets the MIDI instrument for  the  chords  to  be  n.  If  the  command
296       includes  the  string  octave=n  where  n  is a number between -2 and 2
297       inclusive, then this will shift  the  pitch  of  the  instrument  by  n
298       octaves. For example %%MIDI chordprog 10 octave=1.)
299
300
301       %%MIDI bassprog n
302
303       Sets  the  MIDI  instrument  for the bass notes to be n. If the command
304       includes the string octave=n where n is  a  number  between  -2  and  2
305       inclusive,  then  this  will  shift  the  pitch  of the instrument by n
306       octaves. For example %%MIDI bassprog 10 octave=-1.)
307
308       %%MIDI chordvol n
309
310       Sets the volume (velocity) of the chord notes at n.
311
312       %%MIDI bassvol n
313
314       Sets the volume (velocity) of the bass notes at n. There is  no  corre‐
315       sponding  melodyvol  command  since  there  are  3  velocity values for
316       melody, set using the beat command.
317
318       %%MIDI gchordon
319
320       Turns on guitar chords (they are turned on by default at the start of a
321       tune).
322
323       %%MIDI gchordoff
324
325       Turns off guitar chords.
326
327       %%MIDI droneon
328
329       Turns  on  a continuous drone (used in bagpipe music) consisting of two
330       notes. By default the notes are A, and A,, played on  a  bassoon  at  a
331       velocity  of  80.  This  can  be configured by the %%MIDI drone command
332       described below.
333
334       %%MIDI droneoff
335
336       Turns off the continuous drone.
337
338       %%MIDI drone n1 n2 n3 n4 n5
339
340       Sets the drone parameters where n1 is the MIDI program, n2 and n3 spec‐
341       ify the MIDI pitches of the two notes in the chord, and n4 and n5 spec‐
342       ify the MIDI velocities of the two notes.  If  you  do  not  set  these
343       parameters  they are by default 70 45 33 80 80. A value of zero or less
344       indicates that the setting of this parameter should be left as it is.
345
346       %%MIDI drum string [drum programs] [drum velocities]
347
348       This sets up a drum pattern. The string determines when there is a drum
349       beat and the drum program values determine what each drum strike sounds
350       like.
351
352       e.g. %%MIDI drum d2zdd 35 38 38  100 50 50
353
354       The string may contain 'd' for a drum strike or  'z'  for  a  rest.  By
355       default  a  voice  starts  with  no drum pattern and '%%MIDI drumon' is
356       needed to enable the drumming. The drum pattern is repeated during each
357       bar  until '%%MIDI drumoff' is encountered. The %%MIDI drum command may
358       be used within a tune to change the drum pattern.  This command  places
359       the  drum sounds on channel 10 and assumes your tone generator complies
360       with the General Midi standard - if it does  not,  then  you  may  hear
361       tones instead of drum sounds.
362
363       In  both  the  gchord  and drum commands, the standard note length of a
364       single note f,c,z or d is not set by the  L:  command.  Instead  it  is
365       adjusted  so  that the entire gchord string or drum string fits exactly
366       into one bar. In other words the duration of each note  is  divided  by
367       the  total  duration  of  the string. This means that, for example, the
368       drum string "dd" is equivalent to drum string "d4d4".  You cannot  cur‐
369       rently specify fractions directly (eg. C3/2) as done in the body of the
370       music, but it is still possible to express complex rhythms.  For  exam‐
371       ple,  to  indicate  a rhythm such as (3ddd d/d/d/d, you would write the
372       string "d4d4d4d3d3d3d3".
373
374       %%MIDI drumbars n
375
376       The %%MIDI drum line can sound quite monotonous if it is repeated  each
377       bar.  To  circumvent  this problem a new MIDI command %%MIDI drumbars n
378       where n is a small number will spread out the drum string over  n  con‐
379       secutive  bars. By default drumbars is set to 1 maintaining compatibil‐
380       ity with existing abc files. You should take care that  the  drumstring
381       is  evenly  divisible between the drumbar bars. Also the time signature
382       should not change between bars in a drumbar unit. (Sample abc  file  in
383       doc/CHANGES June 24 2008.)
384
385       %%MIDI gchordbars n
386
387       This  command  spreads  the  gchord string over n consecutive bars just
388       like drumbars (above). (A sample  is  found  in  doc/CHANGES  March  17
389       2009.)
390
391
392
393
394
395       With  version  1.54 Dec 4 2004 of abc2midi, notes in chords (eg. [FAc])
396       are not played in the same instant but offsetted and  shortened  by  10
397       MIDI time units. Thus the first note in the chord (eg. F) is played for
398       the full indicated time, the second note (eg. A) starts 10  MIDI  units
399       later  and  is  shortened  by the same amount and the third note starts
400       another 10 MIDI units later and is shortened by another 10 units.  This
401       introduces  an  "expressivo"  option and avoids the heavy attack. (This
402       does not apply to gchords or multivoiced chords.)  The  amount  of  the
403       delay and shortening may be configured by the MIDI command
404
405
406       %%MIDI chordattack n
407
408
409       where n is a small number. If n is zero, then abc2midi should behave as
410       in earlier versions. The delay n is in MIDI time units where there  are
411       480  units in a quarter note beat. The program may not run correctly if
412       n is too large and there are short chords.
413
414
415       %%MIDI randomchordattack n
416
417       Like above except that the delay is a random  variable  uniformly  dis‐
418       tributed between 0 and n-1.
419
420
421       %%MIDI trim x/y
422
423       where  x  and y are two numbers. This command controls the articulation
424       of notes and chords by placing silent  gaps  between  the  notes.   The
425       length of these gaps is determined by x/y and the unit length specified
426       by the L: command. These gaps are produced by shortening the  notes  by
427       the  same  amount.   If  the note is already shorter than the specified
428       gap, then the gap is set to half the length of the note.  The  fraction
429       x/y  indicates  a  note duration in the same manner as specified in the
430       abc file.  The actual duration is based on the unit length specified by
431       the L: field command. It is recommended that x/y be a fraction close to
432       zero. Note trimming is disabled inside slurs as specified by  parenthe‐
433       ses.  You  can turn off all note trimming by setting x to 0, eg 0/1. By
434       default, note trimming is turned off at the  beginning  of  a  tune  or
435       voice command.
436
437
438       %%MIDI expand x/y
439
440       where  x  and  y are two numbers defining a fraction less than 1.  This
441       command controls the articulation of notes and chords  in  the  reverse
442       manner.  The  notes are lengthened by this fraction so they overlap the
443       start of the next note.
444
445
446
447       %%MIDI drummap note midipitch
448
449       Please see abcguide.txt.
450
451       %%MIDI ptstress filename
452
453       This command loads file filename into abc2midi which contains the  Phil
454       Taylor stress parameters and puts abc2midi in the mode where it applies
455       these stress parameters on every note. This model runs in opposition to
456       the standard beat model, so the MIDI beat, beatstring, beatmod commands
457       become ineffectual.  This also means that the dynamic  indications  !f!
458       !pp! etc.  do not work any more.
459
460       There  are  two different implementations of the stress model.  Model 1
461       modifies the note articulation and  takes  control  of  the  MIDI  trim
462       parameters  too.  To revert back to the standard model, put the command
463       %%MIDI beataccents.  Model 2 modifies both the onset and ending of each
464       note  allowing  a  musical beat to expand or contract in time. However,
465       the length of a musical measure should be preserved. Note if you  using
466       model  2, which the current default, you must include -BF as one of the
467       runtime parameters of abc2midi.
468
469       The model divides a bar into equal segments. For each segment, a  loud‐
470       ness  or MIDI velocity is specified and a duration multiplier is speci‐
471       fied. If a note falls into a specific segment, it assumes the  velocity
472       of  that  segment and its duration is modified accordingly. If the note
473       overlaps more than one segment, then the note assumes  the  average  of
474       those segment values.
475
476       The  input  file  specifies the number of segments and the loudness and
477       duration multipliers for each segment. The file has the following  for‐
478       mat.  The first value is the number of segments and each line specifies
479       the velocity and duration  multiplier  of  the  specific  segment.  The
480       velocity  is  limited  to 127 and the duration is a decimal number. The
481       note durations is modified by varying the gap between notes, so  it  is
482       not  possible to extend a note. This preserves the regular tempo of the
483       music. The program scales, the note duration indications by dividing it
484       by the maximum value which here is 1.4.
485
486
487       %%MIDI stressmodel n
488
489       where n is either 1 or 2, selects the stress model implementation.
490
491
492        other  %%MIDI commands such as bendvelocity, bendstring, controlstring
493       have  been  introduced  recently  and  are  described   in   the   file
494       abcguide.txt.
495
496
497
498

COMPATIBILITY WITH DRAFT STANDARD 2.0

500       The proposed standard introduces a new copyright field using the syntax
501
502
503       %%abc-copyright (c) Copyright John Smith 2003
504
505
506       Abc2midi  now  inserts  this in the MIDI file in the form of a metatext
507       copyright tag. Changes were made  to  the  event_specific  function  in
508       store.c  to  process  the copyright information. It is also copied into
509       the Karaoke track (if it is created) as as @T field.
510
511

SEE ALSO

513       abc2ps(1), midi2abc(1), yaps(1).
514

AUTHOR

516       James Allwright <J.R.Allwright@westminster.ac.uk>
517

SUPPORTED

519        by Seymour Shlien <fy733@ncf.ca>
520

VERSION

522       This man page describes abc2midi version 2.27  June 25 2006.
523
525       Copyright 1999 James Allwright
526
527       abc2midi is supplied "as is" without any warranty. It is free  software
528       and can be used, copied, modified and distributed without fee under the
529       terms of the GNU General Public License.
530
531       More complete documentation may be found in  abcguide.txt  which  comes
532       with the abcMIDI distribution.
533
534
535
536                                   June 2017                       ABC2MIDI(1)
Impressum