]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/converters.itely
166ef758509b3a9a0b6e2ffa6ada9c22402ef285
[lilypond.git] / Documentation / user / converters.itely
1 @c -*- coding: latin-1; mode: texinfo; -*-
2
3 @node Converting from other formats
4 @chapter Converting from other formats
5
6 Music can be entered also by importing it from other formats.  This
7 chapter documents the tools included in the distribution to do so.
8 There are other tools that produce LilyPond input, for example GUI
9 sequencers and XML converters.  Refer to the
10 @uref{http://@/lilypond@/.org,website} for more details.
11
12
13
14 @menu
15 * Invoking convert-ly::         Older LilyPond versions.
16 * Invoking midi2ly::            Importing MIDI.
17 * Invoking etf2ly::             Importing Finale.
18 * Invoking abc2ly::             Importing ABC.          
19 * Invoking mup2ly::             Importing MUP. 
20 * Other formats::               
21 @end menu
22
23
24 @node Invoking convert-ly
25 @section Invoking @command{convert-ly}
26
27 The LilyPond input syntax is routinely changed to simplify it or improve
28 it in different ways.  As a side effect of this, the LilyPond interpreter
29 often is no longer compatible with older input files.  To remedy this,
30 the program @command{convert-ly} can be used to deal with most of the
31 syntax changes between LilyPond versions.
32
33 It uses @code{\version} statements in the input files to detect the old
34 version number.  In most cases, to upgrade your input file it is sufficient
35 to run
36
37 @example
38 covert-ly -e myfile.ly
39 @end example
40
41 If there are no changes to myfile.ly and file called myfile.ly.NEW
42 is created, then myfile.ly is already updated.
43
44 To upgrade LilyPond fragments in texinfo files, use
45
46 @example
47 convert-ly --from=... --to=... --no-version *.itely
48 @end example
49
50 In general, the program is invoked as follows:
51
52 @example
53 convert-ly [@var{option}]@dots{} @var{file}@dots{}
54 @end example
55
56
57 The following options can be given:
58
59 @table @code
60 @item -e,--edit
61 Do an inline edit of the input file.  Overrides @code{--output}.
62
63 @item -f,--from=@var{from-patchlevel}
64 Set the version to convert from.  If this is not set, @command{convert-ly}
65 will guess this, on the basis of @code{\version} strings in the file.
66
67 @item -o,--output=@var{file}
68 Set the output file to write.  
69
70 @item -n,--no-version
71 Normally, @command{convert-ly} adds a @code{\version} indicator 
72 to the output. Specifying this option suppresses this.  
73
74 @item -s, --show-rules
75 Show all known conversions and exit.
76
77 @item --to=@var{to-patchlevel}
78 Set the goal version of the conversion.  It defaults to the latest
79 available version.
80
81 @item -h, --help
82 Print usage help.
83 @end table
84
85 @command{convert-ly} always converts up to the last syntax change handled by
86 it.  This means that the @code{\version} number left in the file is
87 usually lower than the version of @command{convert-ly} itself.
88
89 @refbugs
90
91 Not all language changes are handled.  Only one output option can be
92 specified.
93
94 @ignore
95 Copy and paste from CVS, last updated
96 Dec 22, 2004
97
98 http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/lilypond/lily-bugs/bugs/convert-ly.txt?rev=HEAD&content-type=text/plain
99 @end ignore
100 @verbatim
101
102 There are a few things that the convert-ly cannot handle. Here's a list of limitations
103 that the community has complained about.
104
105 This bug report structure has been chosen because convert-ly has a structure that doesn't
106 allow to smoothly implement all needed changes. Thus this is just a wishlist, placed
107 here for reference.
108
109 1.6->2.0:
110  Doesn't always convert figured bass correctly, specifically things like {< >}. Mats' comment on working around this:
111    To be able to run convert-ly
112    on it, I first replaced all occurencies of '{<' to some dummy like '{#'
113    and similarly I replaced '>}' with '&}'. After the conversion, I could
114    then change back from '{ #' to '{ <' and from '& }' to '> }'.
115  Doesn't convert all text markup correctly. Only very simple cases are fixed.
116 2.0->2.2:
117  Doesn't handle \partcombine
118  Doesn't do \addlyrics => \lyricsto, this breaks some scores with multiple stanzas.
119 2.2->2.4:
120  \turnOff (used in \set Staff.VoltaBracket = \turnOff) is not properly converted.
121 @end verbatim
122
123
124 @node Invoking midi2ly
125 @section Invoking @command{midi2ly}
126
127 @cindex MIDI
128
129 @command{midi2ly} translates a Type@tie{}1 MIDI file to a LilyPond source
130 file.
131
132 MIDI (Music Instrument Digital Interface) is a standard for digital
133 instruments: it specifies cabling, a serial protocol and a file
134 format.  The MIDI file format is a de facto standard format for
135 exporting music from other programs, so this capability may come in
136 useful when importing files from a program that has a convertor for a
137 direct format.
138
139 @command{midi2ly} converts tracks into @internalsref{Staff} and
140 channels into @internalsref{Voice} contexts.  Relative mode is used
141 for pitches, durations are only written when necessary.
142
143 It is possible to record a MIDI file using a digital keyboard, and
144 then convert it to @file{.ly}.  However, human players are not
145 rhythmically exact enough to make a MIDI to LY conversion trivial.
146 When invoked with quantizing (@code{-s} and @code{-d} options)
147 @command{midi2ly} tries to compensate for these timing errors, but is not
148 very good at this.  It is therefore not recommended to use @command{midi2ly}
149 for human-generated midi files.
150
151
152 It is invoked from the command-line as follows,
153 @example
154 midi2ly [@var{option}]@dots{} @var{midi-file}
155 @end example
156
157
158 The following options are supported by @command{midi2ly}.
159
160 @table @code
161 @item -a, --absolute-pitches
162 Print absolute pitches.
163
164 @item -d, --duration-quant=@var{DUR}
165 Quantize note durations on @var{DUR}.
166
167 @item -e, --explicit-durations
168 Print explicit durations.
169
170 @item -h,--help
171 Show summary of usage.
172
173 @item -k, --key=@var{acc}[:@var{minor}]
174 Set default key.  @math{@var{acc} > 0} sets number of sharps;
175 @math{@var{acc} < 0} sets number of flats.  A minor key is indicated by
176 ":1".
177
178 @item -o, --output=@var{file}
179 Write output to @var{file}.
180
181 @item -s, --start-quant=@var{DUR}
182 Quantize note starts on DUR.
183
184 @item -t, --allow-tuplet=@var{DUR}*@var{NUM}/@var{DEN}
185 Allow tuplet durations @var{DUR}*@var{NUM}/@var{DEN}.
186
187 @item -V, --verbose
188 Be verbose.
189
190 @item -v, --version
191 Print version number.
192
193 @item -w, --warranty
194 Show warranty and copyright.
195
196 @item -x, --text-lyrics
197 Treat every text as a lyric.
198 @end table
199
200
201 @refbugs
202
203 Overlapping notes in an arpeggio will not be correctly rendered.  The
204 first note will be read and the others will be ignored.  Set them all
205 to a single duration and add phrase markings or pedal indicators.
206
207
208 @node Invoking etf2ly
209 @section Invoking @command{etf2ly}
210
211 @cindex ETF
212 @cindex enigma
213 @cindex Finale
214 @cindex Coda Technology
215
216 ETF (Enigma Transport Format) is a format used by Coda Music
217 Technology's Finale product.  @command{etf2ly} will convert part of an ETF
218 file to a ready-to-use LilyPond file.
219
220 It is invoked from the command-line as follows.
221
222 @example
223 etf2ly [@var{option}]@dots{} @var{etf-file}
224 @end example
225
226 The following options are supported by @command{etf2ly}:
227
228 @table @code
229 @item -h,--help
230 this help
231 @item -o,--output=FILE
232 set output filename to FILE
233 @item -v,--version
234 version information
235 @end table
236
237
238 @refbugs
239
240 The list of articulation scripts is incomplete.  Empty measures
241 confuse @command{etf2ly}.  Sequences of grace notes are ended improperly.
242
243
244 @node Invoking abc2ly
245 @section Invoking @code{abc2ly}
246
247 @cindex ABC
248
249 ABC is a fairly simple ASCII based format.  It is described at the ABC site:
250
251 @quotation
252 @uref{http://@/www@/.gre@/.ac@/.uk/@/~c.walshaw/@/abc2mtex/@/abc@/.txt}.
253 @end quotation
254
255 @command{abc2ly} translates from ABC to LilyPond.  It is invoked as follows:
256
257 @example
258 abc2ly [@var{option}]@dots{} @var{abc-file}
259 @end example
260
261 The following options are supported by @command{abc2ly}:
262
263 @table @code
264 @item -h,--help
265 this help
266 @item -o,--output=@var{file}
267 set output filename to @var{file}.
268 @item -v,--version
269 print version information.
270 @end table
271
272 There is a rudimentary facility for adding LilyPond code to the ABC
273 source file.  If you say:
274
275 @example
276 %%LY voices \set autoBeaming = ##f
277 @end example
278
279 This will cause the text following the keyword ``voices'' to be inserted 
280 into the current voice of the LilyPond output file.
281
282 Similarly,
283
284 @example
285 %%LY slyrics more words
286 @end example
287
288 will cause the text following the ``slyrics'' keyword to be inserted
289 into the current line of lyrics.
290
291
292 @refbugs
293
294 The ABC standard is not very ``standard''.  For extended features
295 (e.g., polyphonic music) different conventions exist. 
296
297 Multiple tunes in one file cannot be converted.
298
299 ABC synchronizes words and notes at the beginning of a line;
300 @command{abc2ly} does not.
301
302 @command{abc2ly} ignores the ABC beaming.
303
304
305 @node Invoking mup2ly
306 @section Invoking @command{mup2ly}
307
308 Mup (Music Publisher) is a shareware music notation program by Arkkra
309 Enterprises.  @command{mup2ly} will convert part of a Mup file to LilyPond
310 format.  It is invoked from the command-line as follows:
311
312 @cindex Music Publisher
313 @cindex Mup
314 @cindex Arkkra
315
316 @example
317 mup2ly [@var{option}]@dots{} @var{mup-file}
318 @end example
319
320 The following options are supported by @command{mup2ly}:
321
322 @table @code
323 @item -d,--debug
324 show what constructs are not converted, but skipped.
325 @item -D, --define=@var{name}[=@code{exp}]
326 define macro @var{name} with opt expansion @code{exp}
327 @item -E,--pre-process
328 only run the pre-processor
329 @item -h,--help
330 print help
331 @item -o,--output=@var{file}
332 write output to @var{file}
333 @item -v,--version
334 version information
335 @item -w,--warranty
336 print warranty and copyright. 
337 @end table
338
339
340 @refbugs
341
342 Only plain notes (pitches, durations), voices, and staves are
343 converted.
344
345
346 @node Other formats
347 @section Other formats
348
349 LilyPond itself does not come with support for other formats, but
350 there are some external tools that also generate LilyPond files.
351
352 These tools include
353
354 @itemize @bullet
355 @item
356 @uref{http://@/denemo@/.sourceforge@/.net/,Denemo}.
357 @item
358 @uref{http://@/www@/.nongnu@/.org/@/xml2ly/, xml2ly}, that imports
359 @uref{http://@/www@/.musicxml@/.com/,MusicXML}
360 @item
361 @uref{http://@/rnvs@/.informatik@/.tu@/-chemnitz@/.de/@/~jan/@/noteedit/@/noteedit@/.html,NoteEdit}
362 which imports MusicXML
363 @item
364 @uref{http://@/www@/.all@/-day@/-breakfast@/.com/@/rosegarden/,Rosegarden},
365 which imports MIDI
366 @end itemize