]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/usage/external.itely
Doc: new chapter "External programs" in Usage.
[lilypond.git] / Documentation / usage / external.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2
3 @ignore
4     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
5
6     When revising a translation, copy the HEAD committish of the
7     version that you are working on.  See TRANSLATION for details.
8 @end ignore
9
10 @c \version "2.12.0"
11
12 @node External programs
13 @chapter External programs
14
15 FIXME: blah blah
16
17
18 @menu
19 * Point and click::
20 * Text editor support::
21 * Converting from other formats::
22 * LilyPond output in other programs::
23 @end menu
24
25
26 @node Point and click
27 @section Point and click
28
29 @cindex point and click
30
31 Point and click lets you find notes in the input by clicking on them
32 in the PDF viewer.  This makes it easier to find input that causes
33 some error in the sheet music.
34
35 When this functionality is active, LilyPond adds hyperlinks to the PDF
36 file.  These hyperlinks are sent to the web-browser, which opens a
37 text-editor with the cursor in the right place.
38
39 To make this chain work, you should configure your PDF viewer to
40 follow hyperlinks using the @file{lilypond-invoke-editor} script
41 supplied with LilyPond.
42
43 For Xpdf on UNIX, the following should be present in
44 @file{xpdfrc}@footnote{On UNIX, this file is found either in
45 @file{/etc/xpdfrc} or as @file{.xpdfrc} in your home directory.}
46
47 @example
48 urlCommand     "lilypond-invoke-editor %s"
49 @end example
50
51 The program @file{lilypond-invoke-editor} is a small helper
52 program.  It will invoke an editor for the special @code{textedit}
53 URIs, and run a web browser for others.  It tests the environment
54 variable @code{EDITOR} for the following patterns,
55
56 @table @code
57 @item emacs
58   this will invoke
59 @example
60 emacsclient --no-wait +@var{line}:@var{column} @var{file}
61 @end example
62 @item gvim
63   this will invoke
64 @example
65 gvim --remote +:@var{line}:norm@var{column} @var{file}
66 @end example
67
68 @item nedit
69 this will invoke
70 @example
71   nc -noask +@var{line} @var{file}'
72 @end example
73 @end table
74
75 The environment variable @code{LYEDITOR} is used to override this.  It
76 contains the command line to start the editor, where @code{%(file)s},
77 @code{%(column)s}, @code{%(line)s} is replaced with the file, column
78 and line respectively.  The  setting
79
80 @example
81 emacsclient --no-wait +%(line)s:%(column)s %(file)s
82 @end example
83
84 @noindent
85 for @code{LYEDITOR} is equivalent to the standard emacsclient
86 invocation.
87
88
89 @cindex file size, output
90
91 The point and click links enlarge the output files significantly.  For
92 reducing the size of PDF and PS files, point and click may be switched
93 off by issuing
94
95 @example
96 \pointAndClickOff
97 @end example
98
99 @noindent
100 in a @file{.ly} file.  Point and click may be explicitly enabled with
101
102 @example
103 \pointAndClickOn
104 @end example
105
106 Alternately, you may disable point and click with a command-line
107 option:
108
109 @example
110 lilypond -dno-point-and-click file.ly
111 @end example
112
113 @warning{You should always turn off point and click in any LilyPond
114 files to be distributed to avoid including path information about
115 your computer in the .pdf file, which can pose a security risk.}
116 @node Text editor support
117 @section Text editor support
118
119 @cindex editors
120 @cindex vim
121 @cindex emacs
122 @cindex modes, editor
123 @cindex syntax coloring
124 @cindex coloring, syntax
125
126 There is support for different text editors for LilyPond.
127
128 @menu
129 * Emacs mode::
130 * Vim mode::
131 * Other editors::
132 @end menu
133
134 @node Emacs mode
135 @unnumberedsubsec Emacs mode
136
137 Emacs has a @file{lilypond-mode}, which provides keyword
138 autocompletion, indentation, LilyPond specific parenthesis matching
139 and syntax coloring, handy compile short-cuts and reading LilyPond
140 manuals using Info.  If @file{lilypond-mode} is not installed on your
141 platform, see below.
142
143 An Emacs mode for entering music and running LilyPond is contained in
144 the source archive in the @file{elisp} directory.  Do @command{make
145 install} to install it to @var{elispdir}.  The file @file{lilypond-init.el}
146 should be placed to @var{load-path}@file{/site-start.d/} or appended
147 to your @file{~/.emacs} or @file{~/.emacs.el}.
148
149 As a user, you may want add your source path (e.g. @file{~/site-lisp/}) to
150 your @var{load-path} by appending the following line (as modified) to your
151 @file{~/.emacs}
152
153 @c any reason we do not advise:  (push "~/site-lisp" load-path)
154 @example
155 (setq load-path (append (list (expand-file-name "~/site-lisp")) load-path))
156 @end example
157
158
159 @node Vim mode
160 @unnumberedsubsec Vim mode
161
162 For @uref{http://@/www@/.vim@/.org,VIM}, a @file{vimrc} is supplied,
163 along with syntax coloring tools.  A Vim mode for entering music and
164 running LilyPond is contained in the source archive in @code{$VIM}
165 directory.
166
167 The LilyPond file type is detected if the file
168 @file{~/.vim/filetype.vim} has the following content
169
170 @example
171 if exists("did_load_filetypes")
172   finish
173 endif
174 augroup filetypedetect
175   au! BufNewFile,BufRead *.ly,*.ily           setf lilypond
176 augroup END
177 @end example
178
179 Please include this path by appending the following line to your
180 @file{~/.vimrc}
181
182 @example
183 set runtimepath+=/usr/local/share/lilypond/$@{LILYPOND_VERSION@}/vim/
184 @end example
185
186 @noindent
187 where $@{LILYPOND_VERSION@} is your LilyPond version.  If LilyPond was not
188 installed in @file{/usr/local/}, then change this path accordingly.
189 The path may differ significantly. In Fedora the path leads to the
190 current version of Vim instead of Lilypond:
191
192 @example
193 set runtimepath+=/usr/share/vim/vim72/
194 @end example
195
196
197 @node Other editors
198 @unnumberedsubsec Other editors
199
200 Other editors (both text and graphical) support LilyPond, but
201 their special configuration files are not distributed with
202 LilyPond.  Consult their documentation for more information.  Such
203 editors are listed in @rweb{Alternate editors}.
204
205
206 @node Converting from other formats
207 @section Converting from other formats
208
209 Music can be entered also by importing it from other formats.  This
210 chapter documents the tools included in the distribution to do so.
211 There are other tools that produce LilyPond input, for example GUI
212 sequencers and XML converters.  Refer to the
213 @uref{http://@/lilypond@/.org,website} for more details.
214
215 These are separate programs from @command{lilypond} itself, and are
216 run on the command line; see @ref{Command-line usage} for more
217 information.  If you have MacOS 10.3 or 10.4 and you have trouble
218 running some of these scripts, e.g. @code{convert-ly}, see
219 @rweb{MacOS X}.
220
221
222 @knownissues
223 We unfortunately do not have the resources to maintain these
224 programs; please consider them @qq{as-is}.  Patches are appreciated, but
225 bug reports will almost certainly not be resolved.
226
227 @menu
228 * Invoking midi2ly::            Importing MIDI.
229 * Invoking musicxml2ly::        Importing MusicXML.
230 * Invoking abc2ly::             Importing ABC.
231 * Invoking etf2ly::             Importing Finale.
232 * Other formats::
233 @end menu
234
235
236
237 @node Invoking midi2ly
238 @subsection Invoking @command{midi2ly}
239
240 @cindex MIDI
241
242 @command{midi2ly} translates a Type@tie{}1 MIDI file to a LilyPond source
243 file.
244
245 MIDI (Music Instrument Digital Interface) is a standard for digital
246 instruments: it specifies cabling, a serial protocol and a file
247 format.  The MIDI file format is a de facto standard format for
248 exporting music from other programs, so this capability may come in
249 useful when importing files from a program that has a converter for a
250 direct format.
251
252 @command{midi2ly} converts tracks into @rinternals{Staff} and
253 channels into @rinternals{Voice} contexts.  Relative mode is used
254 for pitches, durations are only written when necessary.
255
256 It is possible to record a MIDI file using a digital keyboard, and
257 then convert it to @file{.ly}.  However, human players are not
258 rhythmically exact enough to make a MIDI to LY conversion trivial.
259 When invoked with quantizing (@code{-s} and @code{-d} options)
260 @command{midi2ly} tries to compensate for these timing errors, but is not
261 very good at this.  It is therefore not recommended to use @command{midi2ly}
262 for human-generated midi files.
263
264
265 It is invoked from the command-line as follows,
266 @example
267 midi2ly [@var{option}]@dots{} @var{midi-file}
268 @end example
269
270 Note that by @q{command-line}, we mean the command line of the
271 operating system.  See @ref{Converting from other formats}, for
272 more information about this.
273
274 The following options are supported by @command{midi2ly}.
275
276 @table @code
277 @item -a, --absolute-pitches
278 Print absolute pitches.
279
280 @item -d, --duration-quant=@var{DUR}
281 Quantize note durations on @var{DUR}.
282
283 @item -e, --explicit-durations
284 Print explicit durations.
285
286 @item -h,--help
287 Show summary of usage.
288
289 @item -k, --key=@var{acc}[:@var{minor}]
290 Set default key.  @math{@var{acc} > 0} sets number of sharps;
291 @math{@var{acc} < 0} sets number of flats.  A minor key is indicated by
292 @code{:1}.
293
294 @item -o, --output=@var{file}
295 Write output to @var{file}.
296
297 @item -s, --start-quant=@var{DUR}
298 Quantize note starts on @var{DUR}.
299
300 @item -t, --allow-tuplet=@var{DUR}*@var{NUM}/@var{DEN}
301 Allow tuplet durations @var{DUR}*@var{NUM}/@var{DEN}.
302
303 @item -v, --verbose
304 Be verbose.
305
306 @item -V, --version
307 Print version number.
308
309 @item -w, --warranty
310 Show warranty and copyright.
311
312 @item -x, --text-lyrics
313 Treat every text as a lyric.
314 @end table
315
316
317 @knownissues
318
319 Overlapping notes in an arpeggio will not be correctly rendered.  The
320 first note will be read and the others will be ignored.  Set them all
321 to a single duration and add phrase markings or pedal indicators.
322
323
324 @node Invoking musicxml2ly
325 @subsection Invoking @code{musicxml2ly}
326
327 @cindex MusicXML
328
329 @uref{http://@/www.@/musicxml@/.org/,MusicXML} is an XML dialect
330 for representing music notation.
331
332 @command{musicxml2ly} extracts the notes, articulations, score structure,
333 lyrics, etc. from part-wise MusicXML files, and writes them to a .ly
334 file.  It is invoked from the command-line.
335
336
337 It is invoked from the command-line as follows,
338 @example
339 musicxml2ly [@var{option}]@dots{} @var{xml-file}
340 @end example
341
342 Note that by @q{command-line}, we mean the command line of the
343 operating system.  See @ref{Converting from other formats}, for
344 more information about this.
345
346 If the given filename is @file{-}, @command{musicxml2ly} reads input
347 from the command line.
348
349 The following options are supported by @command{musicxml2ly}:
350
351 @table @code
352 @item -a, --absolute
353 convert pitches in absolute mode.
354
355 @item -h,--help
356 print usage and option summary.
357
358 @item -l, --language=LANG
359 use a different language file 'LANG.ly' and corresponding pitch names,
360 e.g. 'deutsch' for deutsch.ly and German note names.
361
362 @item --lxml
363 use the lxml.etree Python package for XML-parsing; uses less memory and cpu time.
364
365 @item --nd --no-articulation-directions
366 do not convert directions (@code{^}, @code{_} or @code{-}) for
367 articulations, dynamics, etc.
368
369 @item --no-beaming
370 do not convert beaming information, use LilyPond's automatic
371 beaming instead.
372
373 @item -o,--output=@var{file}
374 set output filename to @var{file}.  If @var{file} is @file{-}, the output
375 will be printed on stdout.  If not given, @var{xml-file}@file{.ly} will
376 be used.
377
378 @item -r,--relative
379 convert pitches in relative mode (default).
380
381 @item -v,--verbose
382 be verbose.
383
384 @item --version
385 print version information.
386
387 @item -z,--compressed
388 input file is a zip-compressed MusicXML file.
389 @end table
390
391
392 @node Invoking abc2ly
393 @subsection Invoking @code{abc2ly}
394
395 @warning{This program is not supported, and may be remove from
396 future versions of LilyPond.}
397
398 @cindex ABC
399
400 ABC is a fairly simple ASCII based format.  It is described at the ABC site:
401
402 @quotation
403 @uref{http://@/www@/.walshaw@/.plus@/.com/@/abc/@/learn@/.html}.
404 @end quotation
405
406 @command{abc2ly} translates from ABC to LilyPond.  It is invoked as follows:
407
408 @example
409 abc2ly [@var{option}]@dots{} @var{abc-file}
410 @end example
411
412 The following options are supported by @command{abc2ly}:
413
414 @table @code
415 @item -b,--beams=None
416 preserve ABC's notion of beams
417 @item -h,--help
418 this help
419 @item -o,--output=@var{file}
420 set output filename to @var{file}.
421 @item -s,--strict
422 be strict about success
423 @item --version
424 print version information.
425 @end table
426
427 There is a rudimentary facility for adding LilyPond code to the ABC
428 source file.  If you say:
429
430 @example
431 %%LY voices \set autoBeaming = ##f
432 @end example
433
434 This will cause the text following the keyword @q{voices} to be inserted
435 into the current voice of the LilyPond output file.
436
437 Similarly,
438
439 @example
440 %%LY slyrics more words
441 @end example
442
443 will cause the text following the @q{slyrics} keyword to be inserted
444 into the current line of lyrics.
445
446
447 @knownissues
448
449 The ABC standard is not very @q{standard}.  For extended features
450 (e.g., polyphonic music) different conventions exist.
451
452 Multiple tunes in one file cannot be converted.
453
454 ABC synchronizes words and notes at the beginning of a line;
455 @command{abc2ly} does not.
456
457 @command{abc2ly} ignores the ABC beaming.
458
459
460 @node Invoking etf2ly
461 @subsection Invoking @command{etf2ly}
462
463 @warning{This program is not supported, and may be remove from
464 future versions of LilyPond.}
465
466 @cindex ETF
467 @cindex enigma
468 @cindex Finale
469 @cindex Coda Technology
470
471 ETF (Enigma Transport Format) is a format used by Coda Music
472 Technology's Finale product.  @command{etf2ly} will convert part of an ETF
473 file to a ready-to-use LilyPond file.
474
475 It is invoked from the command-line as follows.
476
477 @example
478 etf2ly [@var{option}]@dots{} @var{etf-file}
479 @end example
480
481 Note that by @q{command-line}, we mean the command line of the
482 operating system.  See @ref{Converting from other formats}, for
483 more information about this.
484
485 The following options are supported by @command{etf2ly}:
486
487 @table @code
488 @item -h,--help
489 this help
490 @item -o,--output=@var{FILE}
491 set output filename to @var{FILE}
492 @item --version
493 version information
494 @end table
495
496
497 @knownissues
498
499 The list of articulation scripts is incomplete.  Empty measures
500 confuse @command{etf2ly}.  Sequences of grace notes are ended improperly.
501
502
503 @node Other formats
504 @subsection Other formats
505
506 @cindex External programs, generating LilyPond files
507
508 LilyPond itself does not come with support for any other formats,
509 but some external tools can also generate LilyPond files.  These
510 are listed in @rweb{Alternate editors}.
511
512
513
514 @node LilyPond output in other programs
515 @section LilyPond output in other programs
516
517 This section shows methods to integrate text and music, different than
518 the automated method with @command{lilypond-book}.
519
520 @menu
521 * Many quotes from a large score::
522 * Inserting LilyPond output into OpenOffice.org::
523 * Inserting LilyPond output into other programs::
524 @end menu
525
526 @node Many quotes from a large score
527 @unnumberedsubsec Many quotes from a large score
528
529 If you need to quote many fragments from a large score, you can also use
530 the clip systems feature, see @ruser{Extracting fragments of music}.
531
532
533 @node Inserting LilyPond output into OpenOffice.org
534 @unnumberedsubsec Inserting LilyPond output into OpenOffice.org
535
536 @cindex OpenOffice.org
537
538 LilyPond notation can be added to OpenOffice.org with
539 @uref{http://@/ooolilypond@/.sourceforge@/.net@/,OOoLilyPond}.
540
541
542 @node Inserting LilyPond output into other programs
543 @unnumberedsubsec Inserting LilyPond output into other programs
544
545 To insert LilyPond output in other programs, use @code{lilypond}
546 instead of @code{lilypond-book}.  Each example must be created
547 individually and added to the document; consult the documentation for
548 that program.  Most programs will be able to insert LilyPond output in
549 @file{PNG}, @file{EPS}, or @file{PDF} formats.
550
551 To reduce the white space around your LilyPond score, use
552 the following options
553
554 @example
555 \paper@{
556   indent=0\mm
557   line-width=120\mm
558   oddFooterMarkup=##f
559   oddHeaderMarkup=##f
560   bookTitleMarkup = ##f
561   scoreTitleMarkup = ##f
562 @}
563
564 @{ c1 @}
565 @end example
566
567 To produce a useful @file{EPS} file, use
568
569 @example
570 lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts   myfile.ly
571
572 @file{PNG}:
573 lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts --png myfile.ly
574 @end example
575
576