4 @node Converting from other formats
5 @chapter Converting from other formats
7 Music can be entered also by importing it from other formats. This
8 chapter documents the tools included in the distribution to do so.
9 There are other tools that produce LilyPond input, for example GUI
10 sequencers and XML converters. Refer to the
11 @uref{http://lilypond.org,website} for more details.
16 * Invoking convert-ly:: Older LilyPond versions.
17 * Invoking midi2ly:: Importing MIDI.
18 * Invoking etf2ly:: Importing Finale.
19 * Invoking abc2ly:: Importing ABC.
20 * Invoking pmx2ly:: Importing PMX.
21 * Invoking musedata2ly:: Importing Musedata.
22 * Invoking mup2ly:: Importing MUP.
26 @node Invoking convert-ly
27 @section Invoking convert-ly
29 Convert-ly sequentially applies different conversions to upgrade a
30 LilyPond input file. It uses @code{\version} statements in the file to
31 detect the old version number. For example, to upgrade all LilyPond
32 files in the current directory and its subdirectories, use
34 convert-ly -e --to=1.3.150 `find . -name '*.ly' -print`
37 The program is invoked as follows:
39 convert-ly [@var{option}]@dots{} @var{file}@dots{}
43 The following options can be given:
47 Do an inline edit of the input file. Overrides @code{--output}.
48 @item -f,--from=@var{from-patchlevel}
49 Set the level to convert from. If this is not set, convert-ly will
50 guess this, on the basis of @code{\version} strings in the file.
51 @item -o,--output=@var{file}
52 Set the output file to write.
54 Normally, convert-ly adds a @code{\version} indicator
55 to the output. Specifying this option suppresses this.
56 @item -s, --show-rules
57 Show all known conversions and exit.
58 @item --to=@var{to-patchlevel}
59 Set the goal version of the conversion. It defaults to the latest
69 Not all language changes are handled. Only one output option can be specified.
71 @node Invoking midi2ly
72 @section Invoking midi2ly
76 Midi2ly translates a MIDI input file to a LilyPond source file. MIDI
77 (Music Instrument Digital Interface) is a standard for digital
78 instruments: it specifies cabling, a serial protocol and a file format.
80 The MIDI file format is a de facto standard format for exporting music
81 from other programs, so this capability may come in useful when you want
82 to import files from a program that has no converter for its native
85 @file{midi2ly} will convert tracks into @internalsref{Staff} and
86 channels into @internalsref{Voice} contexts. Relative mode is used
87 for pitches, durations are only written when necessary.
89 It is possible to record a MIDI file using a digital keyboard, and then
90 convert it to @file{.ly}. However, human players are not rhythmically
91 exact enough to make a MIDI to LY conversion trivial. midi2ly tries to
92 compensate for these timing errors, but is not very good at this. It is
93 therefore not recommended to use midi2ly for human-generated midi files.
95 Hackers who know about signal processing are invited to write a more
96 robust midi2ly. midi2ly is written in Python, using a module written in
97 C to parse the MIDI files.
99 It is invoked as follows:
101 midi2ly [@var{option}]@dots{} @var{midi-file}
104 The following options are supported by midi2ly:
107 @item -a, --absolute-pitches
108 Print absolute pitches.
109 @item -d, --duration-quant=@var{DUR}
110 Quantise note durations on @var{DUR}.
111 @item -e, --explicit-durations
112 Print explicit durations.
114 Show summary of usage.
115 @item -k, --key=@var{acc}[:@var{minor}]
116 Set default key. @var{acc} > 0 sets number of sharps; @var{acc} < 0
117 sets number of flats. A minor key is indicated by ":1".
118 @item -o, --output=@var{file}
119 Write output to @var{file}.
120 @item -s, --start-quant=@var{DUR}
121 Quantise note starts on DUR.
122 @item -t, --allow-tuplet=@var{DUR}*@var{NUM}/@var{DEN}
123 Allow tuplet durations @var{DUR}*@var{NUM}/@var{DEN}.
127 Print version number.
129 Show warranty and copyright.
130 @item -x, --text-lyrics
131 Treat every text as a lyric.
135 @node Invoking etf2ly
136 @section Invoking etf2ly
141 @cindex Coda Technology
143 ETF (Enigma Transport Format) is a format used by Coda Music
144 Technology's Finale product. etf2ly will convert part of an ETF
145 file to a ready-to-use LilyPond file.
147 It is invoked as follows:
149 etf2ly [@var{option}]@dots{} @var{etf-file}
152 The following options are supported by etf2ly:
156 @item -o,--output=FILE
157 set output filename to FILE
165 The list of articulation scripts is incomplete. Empty measures confuse
166 etf2ly. Sequences of grace notes are ended improperly sometimes.
169 @node Invoking abc2ly
170 @section Invoking abc2ly
174 ABC is a fairly simple ASCII based format. It is described at the abc site:
176 @uref{http://www.gre.ac.uk/~c.walshaw/abc2mtex/abc.txt}.
178 abc2ly translates from ABC to LilyPond. It is invoked as follows:
181 abc2ly [@var{option}]@dots{} @var{abc-file}
184 The following options are supported by abc2ly:
189 @item -o,--output=@var{file}
190 set output filename to @var{file}.
192 print version information.
195 There is a rudimentary facility for adding LilyPond code to the ABC
196 source file. If you say:
199 %%LY voices \set autoBeaming = ##f
202 This will cause the text following the keyword ``voices'' to be inserted
203 into the current voice of the LilyPond output file.
208 %%LY slyrics more words
211 will cause the text following the ``slyrics'' keyword to be inserted
212 into the current line of lyrics.
217 The ABC standard is not very ``standard''. For extended features
218 (eg. polyphonic music) different conventions exist.
220 Multiple tunes in one file cannot be converted.
222 ABC synchronizes words and notes at the beginning of a line; abc2ly does
225 abc2ly ignores the ABC beaming.
227 @node Invoking pmx2ly
228 @section Invoking pmx2ly
230 PMX is a MusiXTeX preprocessor written by Don Simons. More information
231 on PMX is available from the following site:
234 @uref{http://icking-music-archive.org/Misc/Music/musixtex/software/pmx/}.
240 pmx2ly converts from PMX to LilyPond input. The program is invoked as
244 pmx2ly [@var{option}]@dots{} @var{pmx-file}
247 The following options are supported by pmx2ly:
252 @item -o,--output=FILE
253 set output filename to FILE
260 This script was updated last in September 2000, and then successfully
261 converted the @file{barsant.pmx} example from the PMX
262 distribution. pmx2ly cannot parse more recent PMX files.
265 @node Invoking musedata2ly
266 @section Invoking musedata2ly
271 Musedata (see @uref{http://www.musedata.org/}) is an electronic library of
272 classical music scores, currently comprising about 800 composition
273 dating from 1700 to 1825. The music is encoded in so-called Musedata
274 format. musedata2ly converts a set of musedata files to one .ly file,
275 and will include a @code{\header} field if a @file{.ref} file is
276 supplied. It is invoked as follows:
279 musedata2ly [@var{option}]@dots{} @var{musedata-files}
282 The following options are supported by musedata2ly:
287 @item -o,--output=@var{file}
288 set output filename to @var{file}
291 @item -r,--ref=@var{reffile}
292 read background information from ref-file
298 @file{musedata2ly} converts only a small subset of musedata.
300 @node Invoking mup2ly
301 @section Invoking mup2ly
303 MUP (Music Publisher) is a shareware music notation program by Arkkra
304 Enterprises. Mup2ly will convert part of a Mup file to LilyPond
305 format. It is invoked as follows:
307 @cindex Music Publisher
312 mup2ly [@var{option}]@dots{} @var{mup-file}
315 The following options are supported by mup2ly:
319 show what constructs are not converted, but skipped.
320 @item -D, --define=@var{name}[=@code{exp}]
321 define macro @var{name} with opt expansion @code{exp}
322 @item -E,--pre-process
323 only run the pre-processor
326 @item -o,--output=@var{file}
327 write output to @var{file}
331 print warranty and copyright.
337 Only plain notes (pitches, durations), voices, and staves are