]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/usage/external.itely
Doc: selective point and click
[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.  For details, see the Contributors'
8     Guide, node Updating translation committishes..
9 @end ignore
10
11 @c \version "2.14.0"
12
13 @node External programs
14 @chapter External programs
15
16 LilyPond can interact with other programs in various ways.
17
18 @menu
19 * Point and click::
20 * Text editor support::
21 * Converting from other formats::
22 * LilyPond output in other programs::
23 * Independent includes::
24 @end menu
25
26
27 @node Point and click
28 @section Point and click
29
30 Point and click adds links to pdf documents for certain music
31 elements.
32
33 @menu
34 * Enabling point and click::
35 * Selective point-and-click::
36 @end menu
37
38 @node Enabling point and click
39 @unnumberedsubsec Enabling point and click
40
41 @cindex point and click
42
43 Point and click lets you find notes in the input by clicking on them
44 in the PDF viewer.  This makes it easier to find input that causes
45 some error in the sheet music.
46
47 When this functionality is active, LilyPond adds hyperlinks to the PDF
48 file.  These hyperlinks are sent to the web-browser, which opens a
49 text-editor with the cursor in the right place.
50
51 To make this chain work, you should configure your PDF viewer to
52 follow hyperlinks using the @file{lilypond-invoke-editor} script
53 supplied with LilyPond.
54
55 For Xpdf on UNIX, the following should be present in
56 @file{xpdfrc}.  On UNIX, this file is found either in
57 @file{/etc/xpdfrc} or as @file{$HOME/.xpdfrc}.
58
59 @example
60 urlCommand     "lilypond-invoke-editor %s"
61 @end example
62
63 The program @file{lilypond-invoke-editor} is a small helper
64 program.  It will invoke an editor for the special @code{textedit}
65 URIs, and run a web browser for others.  It tests the environment
66 variable @code{EDITOR} for the following patterns,
67
68 @table @code
69 @item emacs
70   this will invoke
71 @example
72 emacsclient --no-wait +@var{line}:@var{column} @var{file}
73 @end example
74 @item gvim
75   this will invoke
76 @example
77 gvim --remote +:@var{line}:norm@var{column} @var{file}
78 @end example
79
80 @item nedit
81 this will invoke
82 @example
83   nc -noask +@var{line} @var{file}'
84 @end example
85 @end table
86
87 The environment variable @code{LYEDITOR} is used to override this.  It
88 contains the command line to start the editor, where @code{%(file)s},
89 @code{%(column)s}, @code{%(line)s} is replaced with the file, column
90 and line respectively.  The  setting
91
92 @example
93 emacsclient --no-wait +%(line)s:%(column)s %(file)s
94 @end example
95
96 @noindent
97 for @code{LYEDITOR} is equivalent to the standard emacsclient
98 invocation.
99
100
101 @cindex file size, output
102
103 The point and click links enlarge the output files significantly.  For
104 reducing the size of PDF and PS files, point and click may be switched
105 off by issuing
106
107 @example
108 \pointAndClickOff
109 @end example
110
111 @noindent
112 in a @file{.ly} file.  Point and click may be explicitly enabled with
113
114 @example
115 \pointAndClickOn
116 @end example
117
118 Alternately, you may disable point and click with a command-line
119 option:
120
121 @example
122 lilypond -dno-point-and-click file.ly
123 @end example
124
125 @warning{You should always turn off point and click in any LilyPond
126 files to be distributed to avoid including path information about
127 your computer in the .pdf file, which can pose a security risk.}
128
129 @node Selective point-and-click
130 @unnumberedsubsec Selective point-and-click
131
132 For some interactive applications, it may be desirable to only
133 include certain point-and-click items.  For example, if somebody
134 wanted to create an application which played audio or video
135 starting from a particular note, it would be awkward if clicking
136 on the note produced the point-and-click location for an
137 accidental or slur which occurred over that note.
138
139 This may be controlled by indicating which events to include:
140
141 @itemize
142 @item
143 Hard-coded in the @file{.ly} file:
144
145 @example
146 \pointAndClickTypes #'note-event
147 \relative c' @{
148   c2\f( f)
149 @}
150 @end example
151
152 or
153
154 @example
155 #(ly:set-option 'point-and-click 'note-event)
156 \relative c' @{
157   c2\f( f)
158 @}
159 @end example
160
161 @item
162 Command-line:
163
164 @example
165 lilypond -dpoint-and-click=note-event   example.ly
166 @end example
167
168 @end itemize
169
170 Multiple events can be included:
171
172 @itemize
173 @item
174 Hard-coded in the @file{.ly} file:
175
176 @example
177 \pointAndClickTypes #'(note-event dynamic-event)
178 \relative c' @{
179   c2\f( f)
180 @}
181 @end example
182
183 or
184
185 @example
186 #(ly:set-option 'point-and-click '(note-event dynamic-event))
187 \relative c' @{
188   c2\f( f)
189 @}
190 @end example
191
192 @item
193 Command-line:
194
195 @smallexample
196 lilypond \
197   -e"(ly:set-option 'point-and-click '(note-event dynamic-event))" \
198   example.ly
199 @end smallexample
200
201
202 @end itemize
203
204
205 @node Text editor support
206 @section Text editor support
207
208 @cindex editors
209 @cindex vim
210 @cindex emacs
211 @cindex modes, editor
212 @cindex syntax coloring
213 @cindex coloring, syntax
214
215 There is support for different text editors for LilyPond.
216
217 @menu
218 * Emacs mode::
219 * Vim mode::
220 * Other editors::
221 @end menu
222
223 @node Emacs mode
224 @unnumberedsubsec Emacs mode
225
226 Emacs has a @file{lilypond-mode}, which provides keyword
227 autocompletion, indentation, LilyPond specific parenthesis matching
228 and syntax coloring, handy compile short-cuts and reading LilyPond
229 manuals using Info.  If @file{lilypond-mode} is not installed on your
230 platform, see below.
231
232 An Emacs mode for entering music and running LilyPond is contained in
233 the source archive in the @file{elisp} directory.  Do @command{make
234 install} to install it to @var{elispdir}.  The file @file{lilypond-init.el}
235 should be placed to @var{load-path}@file{/site-start.d/} or appended
236 to your @file{~/.emacs} or @file{~/.emacs.el}.
237
238 As a user, you may want add your source path (e.g. @file{~/site-lisp/}) to
239 your @var{load-path} by appending the following line (as modified) to your
240 @file{~/.emacs}
241
242 @c any reason we do not advise:  (push "~/site-lisp" load-path)
243 @example
244 (setq load-path (append (list (expand-file-name "~/site-lisp")) load-path))
245 @end example
246
247
248 @node Vim mode
249 @unnumberedsubsec Vim mode
250
251 For @uref{http://@/www@/.vim@/.org,Vim}, a filetype plugin, indent
252 mode, and syntax-highlighting mode are available to use with
253 LilyPond.  To enable all of these features, create (or modify)
254 your @file{$HOME/.vimrc} to contain these three lines, in order:
255
256 @example
257 filetype off
258 set runtimepath+=/usr/local/share/lilypond/current/vim/
259 filetype on
260 @end example
261
262 @noindent
263 If LilyPond is not installed in the @file{/usr/local/} directory,
264 change the path appropriately.  This topic is discussed in
265 @rlearning{Other sources of information}.
266
267
268 @node Other editors
269 @unnumberedsubsec Other editors
270
271 Other editors (both text and graphical) support LilyPond, but
272 their special configuration files are not distributed with
273 LilyPond.  Consult their documentation for more information.  Such
274 editors are listed in @rweb{Easier editing}.
275
276
277 @node Converting from other formats
278 @section Converting from other formats
279
280 Music can be entered also by importing it from other formats.  This
281 chapter documents the tools included in the distribution to do so.
282 There are other tools that produce LilyPond input, for example GUI
283 sequencers and XML converters.  Refer to the
284 @uref{http://@/lilypond@/.org,website} for more details.
285
286 These are separate programs from @command{lilypond} itself, and are
287 run on the command line; see @ref{Command-line usage} for more
288 information.  If you have MacOS 10.3 or 10.4 and you have trouble
289 running some of these scripts, e.g. @code{convert-ly}, see
290 @rweb{MacOS X}.
291
292
293 @knownissues
294 We unfortunately do not have the resources to maintain these
295 programs; please consider them @qq{as-is}.  Patches are appreciated, but
296 bug reports will almost certainly not be resolved.
297
298 @menu
299 * Invoking midi2ly::            Importing MIDI.
300 * Invoking musicxml2ly::        Importing MusicXML.
301 * Invoking abc2ly::             Importing ABC.
302 * Invoking etf2ly::             Importing Finale.
303 * Other formats::
304 @end menu
305
306
307
308 @node Invoking midi2ly
309 @subsection Invoking @command{midi2ly}
310
311 @cindex MIDI
312
313 @command{midi2ly} translates a Type@tie{}1 MIDI file to a LilyPond source
314 file.
315
316 MIDI (Music Instrument Digital Interface) is a standard for digital
317 instruments: it specifies cabling, a serial protocol and a file
318 format.  The MIDI file format is a de facto standard format for
319 exporting music from other programs, so this capability may come in
320 useful when importing files from a program that has a converter for a
321 direct format.
322
323 @command{midi2ly} converts tracks into @rinternals{Staff} and
324 channels into @rinternals{Voice} contexts.  Relative mode is used
325 for pitches, durations are only written when necessary.
326
327 It is possible to record a MIDI file using a digital keyboard, and
328 then convert it to @file{.ly}.  However, human players are not
329 rhythmically exact enough to make a MIDI to LY conversion trivial.
330 When invoked with quantizing (@option{-s} and @option{-d} options)
331 @command{midi2ly} tries to compensate for these timing errors, but is not
332 very good at this.  It is therefore not recommended to use @command{midi2ly}
333 for human-generated midi files.
334
335
336 It is invoked from the command-line as follows,
337 @example
338 midi2ly [@var{option}]@dots{} @var{midi-file}
339 @end example
340
341 Note that by @q{command-line}, we mean the command line of the
342 operating system.  See @ref{Converting from other formats}, for
343 more information about this.
344
345 The following options are supported by @command{midi2ly}.
346
347 @table @code
348 @item -a, --absolute-pitches
349 Print absolute pitches.
350
351 @item -d, --duration-quant=@var{DUR}
352 Quantize note durations on @var{DUR}.
353
354 @item -e, --explicit-durations
355 Print explicit durations.
356
357 @item -h,--help
358 Show summary of usage.
359
360 @item -k, --key=@var{acc}[:@var{minor}]
361 Set default key.  @math{@var{acc} > 0} sets number of sharps;
362 @math{@var{acc} < 0} sets number of flats.  A minor key is indicated by
363 @code{:1}.
364
365 @item -o, --output=@var{file}
366 Write output to @var{file}.
367
368 @item -s, --start-quant=@var{DUR}
369 Quantize note starts on @var{DUR}.
370
371 @item -t, --allow-tuplet=@var{DUR}*@var{NUM}/@var{DEN}
372 Allow tuplet durations @var{DUR}*@var{NUM}/@var{DEN}.
373
374 @item -v, --verbose
375 Be verbose.
376
377 @item -V, --version
378 Print version number.
379
380 @item -w, --warranty
381 Show warranty and copyright.
382
383 @item -x, --text-lyrics
384 Treat every text as a lyric.
385 @end table
386
387
388 @knownissues
389
390 Overlapping notes in an arpeggio will not be correctly rendered.  The
391 first note will be read and the others will be ignored.  Set them all
392 to a single duration and add phrase markings or pedal indicators.
393
394
395 @node Invoking musicxml2ly
396 @subsection Invoking @code{musicxml2ly}
397
398 @cindex MusicXML
399
400 @uref{http://@/www.@/musicxml@/.org/,MusicXML} is an XML dialect
401 for representing music notation.
402
403 @command{musicxml2ly} extracts the notes, articulations, score structure,
404 lyrics, etc. from part-wise MusicXML files, and writes them to a @file{.ly}
405 file.  It is invoked from the command-line.
406
407
408 It is invoked from the command-line as follows,
409 @example
410 musicxml2ly [@var{option}]@dots{} @var{xml-file}
411 @end example
412
413 Note that by @q{command-line}, we mean the command line of the
414 operating system.  See @ref{Converting from other formats}, for
415 more information about this.
416
417 If the given filename is @file{-}, @command{musicxml2ly} reads input
418 from the command line.
419
420 The following options are supported by @command{musicxml2ly}:
421
422 @table @code
423 @item -a, --absolute
424 convert pitches in absolute mode.
425
426 @item -h,--help
427 print usage and option summary.
428
429 @item -l, --language=LANG
430 use LANG for pitch names, e.g. 'deutsch' for note names in German.
431
432 @item --loglevel=@var{loglevel}
433 Set the output verbosity to @var{loglevel}. Possible values are @code{NONE},
434 @code{ERROR}, @code{WARNING}, @code{PROGRESS} (default) and @code{DEBUG}.
435
436 @item --lxml
437 use the lxml.etree Python package for XML-parsing; uses less memory and cpu time.
438
439 @item --nd --no-articulation-directions
440 do not convert directions (@code{^}, @code{_} or @code{-}) for
441 articulations, dynamics, etc.
442
443 @item --no-beaming
444 do not convert beaming information, use LilyPond's automatic
445 beaming instead.
446
447 @item -o,--output=@var{file}
448 set output filename to @var{file}.  If @var{file} is @file{-}, the output
449 will be printed on stdout.  If not given, @var{xml-file}@file{.ly} will
450 be used.
451
452 @item -r,--relative
453 convert pitches in relative mode (default).
454
455 @item -v,--verbose
456 be verbose.
457
458 @item --version
459 print version information.
460
461 @item -z,--compressed
462 input file is a zip-compressed MusicXML file.
463 @end table
464
465
466 @node Invoking abc2ly
467 @subsection Invoking @code{abc2ly}
468
469 @warning{This program is not supported, and may be remove from
470 future versions of LilyPond.}
471
472 @cindex ABC
473
474 ABC is a fairly simple ASCII based format.  It is described at the ABC site:
475
476 @quotation
477 @uref{http://@/www@/.walshaw@/.plus@/.com/@/abc/@/learn@/.html}.
478 @end quotation
479
480 @command{abc2ly} translates from ABC to LilyPond.  It is invoked as follows:
481
482 @example
483 abc2ly [@var{option}]@dots{} @var{abc-file}
484 @end example
485
486 The following options are supported by @command{abc2ly}:
487
488 @table @code
489 @item -b,--beams=None
490 preserve ABC's notion of beams
491 @item -h,--help
492 this help
493 @item -o,--output=@var{file}
494 set output filename to @var{file}.
495 @item -s,--strict
496 be strict about success
497 @item --version
498 print version information.
499 @end table
500
501 There is a rudimentary facility for adding LilyPond code to the ABC
502 source file.  If you say:
503
504 @example
505 %%LY voices \set autoBeaming = ##f
506 @end example
507
508 This will cause the text following the keyword @q{voices} to be inserted
509 into the current voice of the LilyPond output file.
510
511 Similarly,
512
513 @example
514 %%LY slyrics more words
515 @end example
516
517 will cause the text following the @q{slyrics} keyword to be inserted
518 into the current line of lyrics.
519
520
521 @knownissues
522
523 The ABC standard is not very @q{standard}.  For extended features
524 (e.g., polyphonic music) different conventions exist.
525
526 Multiple tunes in one file cannot be converted.
527
528 ABC synchronizes words and notes at the beginning of a line;
529 @command{abc2ly} does not.
530
531 @command{abc2ly} ignores the ABC beaming.
532
533
534 @node Invoking etf2ly
535 @subsection Invoking @command{etf2ly}
536
537 @warning{This program is not supported, and may be remove from
538 future versions of LilyPond.}
539
540 @cindex ETF
541 @cindex enigma
542 @cindex Finale
543 @cindex Coda Technology
544
545 ETF (Enigma Transport Format) is a format used by Coda Music
546 Technology's Finale product.  @command{etf2ly} will convert part of an ETF
547 file to a ready-to-use LilyPond file.
548
549 It is invoked from the command-line as follows.
550
551 @example
552 etf2ly [@var{option}]@dots{} @var{etf-file}
553 @end example
554
555 Note that by @q{command-line}, we mean the command line of the
556 operating system.  See @ref{Converting from other formats}, for
557 more information about this.
558
559 The following options are supported by @command{etf2ly}:
560
561 @table @code
562 @item -h,--help
563 this help
564 @item -o,--output=@var{FILE}
565 set output filename to @var{FILE}
566 @item --version
567 version information
568 @end table
569
570
571 @knownissues
572
573 The list of articulation scripts is incomplete.  Empty measures
574 confuse @command{etf2ly}.  Sequences of grace notes are ended improperly.
575
576
577 @node Other formats
578 @subsection Other formats
579
580 @cindex External programs, generating LilyPond files
581
582 LilyPond itself does not come with support for any other formats,
583 but some external tools can also generate LilyPond files.  These
584 are listed in @rweb{Easier editing}.
585
586
587
588 @node LilyPond output in other programs
589 @section LilyPond output in other programs
590
591 This section shows methods to integrate text and music, different than
592 the automated method with @command{lilypond-book}.
593
594 @menu
595 * Many quotes from a large score::
596 * Inserting LilyPond output into OpenOffice.org::
597 * Inserting LilyPond output into other programs::
598 @end menu
599
600 @node Many quotes from a large score
601 @unnumberedsubsec Many quotes from a large score
602
603 If you need to quote many fragments from a large score, you can also use
604 the clip systems feature, see @ruser{Extracting fragments of music}.
605
606
607 @node Inserting LilyPond output into OpenOffice.org
608 @unnumberedsubsec Inserting LilyPond output into OpenOffice.org
609
610 @cindex OpenOffice.org
611
612 LilyPond notation can be added to OpenOffice.org with
613 @uref{http://@/ooolilypond@/.sourceforge@/.net@/,OOoLilyPond}.
614
615
616 @node Inserting LilyPond output into other programs
617 @unnumberedsubsec Inserting LilyPond output into other programs
618
619 To insert LilyPond output in other programs, use @code{lilypond}
620 instead of @code{lilypond-book}.  Each example must be created
621 individually and added to the document; consult the documentation for
622 that program.  Most programs will be able to insert LilyPond output in
623 @file{PNG}, @file{EPS}, or @file{PDF} formats.
624
625 To reduce the white space around your LilyPond score, use
626 the following options
627
628 @example
629 \paper@{
630   indent=0\mm
631   line-width=120\mm
632   oddFooterMarkup=##f
633   oddHeaderMarkup=##f
634   bookTitleMarkup = ##f
635   scoreTitleMarkup = ##f
636 @}
637
638 @{ c1 @}
639 @end example
640
641 To produce useful image files:
642
643 @example
644 EPS
645
646 lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts myfile.ly
647
648 PNG
649
650 lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts --png myfile.ly
651
652 A transparent PNG
653
654 lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts \
655   -dpixmap-format=pngalpha --png myfile.ly
656 @end example
657
658
659 @node Independent includes
660 @section Independent @code{include}s
661
662 Some people have written large (and useful!) code that can be
663 shared between projects.  This code might eventually make its way
664 into LilyPond itself, but until that happens, you must download
665 and @code{\include} them manually.
666
667
668 @menu
669 * MIDI articulation::
670 @end menu
671
672
673 @node MIDI articulation
674 @subsection MIDI articulation
675
676 LilyPond can be used to produce MIDI output, for
677 @qq{proof-hearing} what has been written.  However, only dynamics,
678 explicit tempo markings, and the notes and durations themselves
679 are produced in the output.
680
681 The @emph{articulate} project is one attempt to get more of the
682 information in the score into he MIDI.  It works by shortening
683 notes not under slurs, to @q{articulate} the notes.  The amount of
684 shortening depends on any articulation markings attached to a
685 note: staccato halves the note value, tenuto gives a note its full
686 duration, and so on.  The script also realises trills and turns,
687 and could be extended to expand other ornaments such as mordents.
688
689 @example
690 @uref{http://@/www@/.nicta@/.com@/.au/@/people/@/chubbp/@/articulate}
691 @end example
692
693 @knownissues
694
695 Its main limitation is that it can only affect things it knows
696 about: anything that is merely textual markup (instead of a note
697 property) is still ignored.
698
699