]> git.donarmstrong.com Git - lilypond.git/blob - scm/define-music-types.scm
* input/mutopia/F.Schubert/standchen.ly (trebleThrough): fixes
[lilypond.git] / scm / define-music-types.scm
1
2 (define-public music-descriptions
3   `(
4     (AbortEvent
5      . (
6    (description .  "End the currently running spanners.")
7         (internal-class-name . "Event")
8         (span-type . "abort")
9         (types . (general-music event abort-event))
10         ))
11     (AbsoluteDynamicEvent
12      . (
13    (description . "Creates a dynamic mark.  Syntax: @var{note}@code{\\x},
14 where x is one of \@\{\\ppp, \\pp, \\p, \\mp, \\mf, \\f, \\ff, \\fff.\@\}")
15         (internal-class-name . "Event")
16         (types . (general-music event dynamic-event absolute-dynamic-event))
17         ))
18     (ApplyContext
19      . (
20         (description . "Call the argument with the current context during interpreting phase")
21         (internal-class-name . "Music")
22         (types . (general-music apply-context))
23         (iterator-ctor . ,Apply_context_iterator::constructor)
24         ))
25     (ApplyOutputEvent
26      . (
27         (description . "
28 Call the argument with all current grobs during interpreting phase.
29
30 SYNTAX
31
32 \applyoutput FUNC
33
34 arguments to func are 1. the grob, 2. the originating context,
35 3. context where FUNC is called.
36
37 ")
38         (internal-class-name . "Event")
39         (iterator-ctor . ,Output_property_music_iterator::constructor)
40         (types . (general-music layout-instruction))
41         ))
42     (ArpeggioEvent 
43      . (
44         (description .  "Make an arpeggio on this note. Syntax:
45 @var{note}-@code{\\arpeggio}")
46         (internal-class-name .  "Event")
47         (types . (general-music arpeggio-event event))
48         ))
49
50     ;; todo: use articulation-event for slur as well.
51     ;; separate non articulation scripts  
52     (ArticulationEvent
53      . (
54    (description .  "Adds an articulation marking to a note.  Syntax:
55 @var{note}@code{X}@code{Y}, where X is a direction (up @code{^}, down
56 @code{_}, or LilyPond's choice (no direction specified)), and where Y
57 is an articulation (such as @code{-.}, @code{->}, @code{\\tenuto},
58 @code{\\downbow}).  See the user manual for details.")
59
60         (internal-class-name . "Event")
61         (types . (general-music event articulation-event script-event))
62         )) 
63     (AutoChangeMusic
64      . (
65         (description .  "Used for making voices that switch between piano staves automatically.")
66
67         (internal-class-name . "Music_wrapper")
68         (iterator-ctor . ,Auto_change_iterator::constructor)
69         (types . (general-music music-wrapper-music auto-change-instruction))
70         ))
71     (BarCheck
72      . (
73         (description .
74                      "Check whether this music coincides with the start of the measure.")
75         (internal-class-name . "Music")
76         (types . (general-music bar-check))
77         (iterator-ctor . ,Bar_check_iterator::constructor)
78         ))
79     (BassFigureEvent
80      . (
81         (description .  "Print a bass-figure text")
82
83         (internal-class-name . "Event")
84         (types . (general-music event rhythmic-event bass-figure-event))
85         ))
86     (BeamEvent
87      . (
88    (description .  "Starts or stops a beam.  Syntax for manual control:
89 c8-[ c c-] c8")
90
91         (internal-class-name . "Event")
92         (types . (general-music event beam-event span-event))
93         ))
94     (NewBeamEvent
95      . (
96    (description .  "Starts or stops a beam.  Syntax for manual control:
97 c8-[ c c-] c8")
98         (internal-class-name . "Event")
99         (types . (general-music event new-beam-event span-event))
100         ))
101     (BreakEvent
102      . (
103    (description .  "Creates a line break.  Syntax: \\break.")
104
105         (internal-class-name . "Event")
106         (types . (general-music break-event event))
107         ))
108     (BreathingSignEvent
109      . (
110         (description .  "Creates a `breath mark' or `comma'.  Syntax:
111 @var{note}\\breathe.")
112
113         (internal-class-name . "Event")
114         (types . (general-music event breathing-event))
115         )) 
116     (BusyPlayingEvent
117      . (
118         (description .  "Used internally to signal beginning and ending of notes.")
119
120         (internal-class-name . "Event")
121         (types . (general-music event busy-playing-event))
122         ))
123     
124     (ClusterNoteEvent
125      . (
126         (description .  "A note that is part of a cluster.")
127         (internal-class-name . "Event")
128
129         ; not a note-event, to ensure that Note_engraver doesn't eat it. 
130         (types . (general-music cluster-note-event melodic-event rhythmic-event event))
131         ))
132     
133     (ContextSpeccedMusic
134      . (
135         (description .  "Interpret the argument music within a specific context.")
136         (iterator-ctor . ,Context_specced_music_iterator::constructor)
137         (internal-class-name . "Music_wrapper")
138         (types . (context-specification general-music music-wrapper-music))
139         ))
140     
141     (CrescendoEvent
142      . (
143    (description .  "Begins or ends a crescendo.  Syntax: @var{note}\\cr
144 ... @var{note}\\rc (you can also use \\<, \\!, \\cresc, and
145 \\endcresc.  See the user manual for details.).")
146
147         (internal-class-name . "Event")
148         (types . (general-music dynamic-event crescendo-event event))
149         )) 
150     (DecrescendoEvent
151      . (
152         (description .  "See @ref{CrescendoEvent}.")
153
154         (internal-class-name . "Event")
155         (types . (general-music dynamic-event decrescendo-event event))
156         ))
157  
158     (ExtenderEvent
159      . (
160         (description .  "Extend lyrics.")
161
162         (internal-class-name . "Event")
163         (types . (general-music extender-event event))
164         ))
165     (FingerEvent
166      . (
167         (description . "Specify what finger to use for this note.")
168         (internal-class-name . "Event")
169         (types . (general-music fingering-event event))
170         ))
171     (GlissandoEvent
172      . (
173         (description .  "Start  a glissando on this note.")
174         (internal-class-name . "Event")
175         (types . (general-music glissando-event event))
176         ))
177     
178     (GraceMusic
179      . (
180         (description .  "Interpret the argument as grace notes. ")
181
182         (internal-class-name . "Grace_music")
183         (iterator-ctor . ,Grace_iterator::constructor)
184         (types . (grace-music music-wrapper-music general-music))
185         ))
186     (NoteGroupingEvent
187      . (
188         (description . "Start or stop grouping brackets.")
189         (internal-class-name . "Event")
190         (types . (general-music event note-grouping-event))
191         ))
192     (HyphenEvent
193      . (
194         (description .  "A hyphen between lyric syllables.")
195
196         (internal-class-name . "Event")
197         (types . (general-music hyphen-event event))
198         ))
199     
200     (KeyChangeEvent
201      . (
202         (description .  "Change the key signature. Syntax: @code{\\key } @var{name} @var{scale}.")
203
204         (internal-class-name . "Key_change_ev")
205         (types . (general-music key-change-event event))
206         ))
207     
208     (LigatureEvent
209      . (
210         (description .  "(docme).")
211
212         (internal-class-name . "Event")
213         (span-type . ligature)
214         (types . (general-music span-event ligature-event event))
215         ))
216     
217     (LyricCombineMusic
218      . (
219         (description .  "Align lyrics to the start of notes.
220 Syntax @var{\\addlyrics }@var{music} @var{lyrics}.")
221
222         (internal-class-name . "Lyric_combine_music")
223         (types . (general-music lyric-combine-music))
224         (iterator-ctor . ,Lyric_combine_music_iterator::constructor)
225         ))
226
227     (LyricEvent
228      . (
229         (description .  "A lyric syllable. Must be entered in lyrics mode, i.e.
230 @code{\\lyrics @{ twinkle4 twinkle4 @} } .")
231
232         (internal-class-name . "Event")
233         (types . (general-music rhythmic-event lyric-event event))
234         ))
235     (MarkEvent
236      . (
237         (description .  "Insert a rehearsal mark. Syntax: @code{\mark} @var{marker},
238 e.g. @code{\\mark \"A\"}.")
239
240         (internal-class-name . "Event")
241         (types . (general-music mark-event event))
242         ))
243     (MelismaPlayingEvent
244      . (
245         (description .  "Used internally to signal melismas")
246         (internal-class-name . "Event")
247         (types . (general-music melisma-playing-event event))
248         ))
249     
250     (MultiMeasureRestEvent
251      . (
252         (description . "Rests that may be compressed into Multi rests. Syntax
253 @code{R2.*4} for 4 measures in 3/4 time. Note the capital R.")
254         (internal-class-name . "Event")
255         (types . (general-music event span-event multi-measure-rest-event))
256         ))
257     
258     (MultiMeasureTextEvent
259      . (
260         (description . "Texts on mm rests. Syntax
261 @code{R-\\markup @{ \\roman \"bla\" @}}. Note the explicit font switch.")
262         (internal-class-name . "Event")
263         (types . (general-music event multi-measure-text-event))
264         ))
265
266     (Music
267      . (
268         (description .  "Generic type for music expressions.")
269
270         (internal-class-name . "Music")
271         (types . (general-music)) 
272         ))
273     (NoteEvent
274      . (
275         (description .  "A note.")
276
277         (internal-class-name . "Event")
278         (types . (general-music event note-event rhythmic-event melodic-event))
279         ))
280     
281     (OverrideProperty
282      . (
283         (description .  "Extend the definition of a graphical object.
284
285 SYNTAX
286
287 @code{\\propery Foo.Bar \\override} @var{SYMBOL} = @var{VALUE}
288
289 ")
290
291         (internal-class-name . "Music")
292         (types . (general-music layout-instruction))
293         (iterator-ctor . ,      Push_property_iterator::constructor)
294         ))
295
296     (PartCombineMusic
297      . (
298         (description .  "Combine two parts on a staff, either merged or
299 as separate voices.")
300
301         (internal-class-name . "Simultaneous_music")
302         (types . (general-music part-combine-music))
303         (iterator-ctor . ,Part_combine_music_iterator::constructor)
304         ))
305     
306     (PhrasingSlurEvent
307      . (
308         (description . "Start or end phrasing slur. Syntax NOTE \\(  and \\) NOTE")
309         (internal-class-name . "Event")
310         (types . (general-music span-event phrasing-slur-event))
311         ))
312     
313     (PropertySet
314      . (
315         (description .  "Set a context property.
316
317 Syntax: @code{\property @var{context}.@var{prop} = @var{scheme-val}}.")
318         (internal-class-name . "Music")
319         (types . (layout-instruction general-music))
320         (iterator-ctor . ,Property_iterator::constructor)
321         )
322      )
323     
324     (PropertyUnset
325      . (
326         (description .  "Remove the definition of a context @code{\property}.")
327
328         (internal-class-name . "Music")
329         (types . (layout-instruction general-music))
330         (iterator-ctor . ,Property_unset_iterator::constructor)
331         )
332      )
333     
334     (PesOrFlexaEvent
335      . (
336         (description .  "Within a ligature, mark the previous and the
337 following note to form a pes (if melody goes up) or a flexa (if melody
338 goes down).")
339
340         (internal-class-name . "Event")
341         (types . (general-music pes-or-flexa-event event))
342         ))
343
344     (RepeatedMusic
345      . (
346         (description .  "Repeat music in different ways")
347
348         (type .  repeated-music)
349         (types . (general-music repeated-music))
350         ))
351     
352     (Event
353      . (
354         (description .  "Atomic music event.")
355
356         (internal-class-name . "Event")
357         (types . (general-music event))
358         ))
359     
360     (RestEvent
361      . (
362         (description .  "A Rest. Syntax @code{r4} for a quarter rest. ")
363
364         (internal-class-name . "Event")
365         (types . (general-music event rhythmic-event rest-event))
366         )) 
367     (SequentialMusic
368      . (
369         (description .  "Music expressions concatenated. Syntax \\sequential @{..@} or simply @{..@} .")
370
371         (internal-class-name . "Sequential_music")
372         (iterator-ctor . ,Sequential_music_iterator::constructor)
373         (types . (general-music sequential-music))
374         ))
375     
376     (MultiMeasureRestMusicGroup
377      . (
378         (description .  "Like sequential-music, but specifically intended
379 to group start-mmrest, skip, stop-mmrest sequence. Syntax @code{R2.*5} for 5 measures in 3/4 time.")
380         (internal-class-name . "Sequential_music")
381         (iterator-ctor . ,Sequential_music_iterator::constructor)
382         (types . (general-music sequential-music))
383         ))
384     
385     (SimultaneousMusic
386      . (
387         (description .  "Music playing together.
388
389 SYNTAX
390
391 @code{ \\simultaneous @{ .. @}} or < .. >.")
392
393         (internal-class-name . "Simultaneous_music")
394         (iterator-ctor . ,Simultaneous_music_iterator::constructor)
395         
396         (types . (general-music simultaneous-music))
397         ))
398     
399     (SlurEvent
400      . (
401         (description . "Start or end slur. Syntax NOTE(  and )NOTE")
402         (internal-class-name . "Event")
403         (types . (general-music span-event slur-event))
404         ))
405
406     (RevertProperty
407      . (
408         (description .  "The opposite of @ref{OverrideProperty}: remove a
409 previously added property from a graphical object definition
410  ")
411
412         (internal-class-name . "Music")
413         (types . (general-music layout-instruction))
414         (iterator-ctor . ,      Pop_property_iterator::constructor)
415         ))
416
417     (OutputPropertySetMusic
418      . (
419         (description .  "Set grob properties in objects
420 individually. Syntax @code{\\outputproperty @var{predicate} @var{prop}
421 = @var{val}}.")
422
423         (internal-class-name . "Music")
424         (iterator-ctor . ,Output_property_music_iterator::constructor)
425         (types . (general-music layout-instruction))
426         ))
427     
428     (TextSpanEvent
429      . (
430         (description . "Start a text spanner like 8va.....|")
431         (internal-class-name . "Event")
432         (types . (general-music span-event text-span-event))
433         ))
434     
435     (TranslatorChange
436      . (
437         (description .  "Change staffs in Piano staff. Syntax @code{\\translator Staff = @var{new-id}}.")
438         (internal-class-name . "Music")
439         (iterator-ctor . , Change_iterator::constructor)
440         (types . (general-music translator-change-instruction))
441         ))
442     
443     (TimeScaledMusic
444      . (
445         (description .  "Multiply durations, as in tuplets. Syntax @code{\\times @var{fraction} @var{music}}, e.g.
446 @code{\\times 2/3 @{ ... @}} for triplets.
447  ")
448         (internal-class-name . "Time_scaled_music")
449         (iterator-ctor . ,Time_scaled_music_iterator::constructor)
450         (types . (time-scaled-music music-wrapper-music general-music))
451         ))
452     
453     (TransposedMusic
454      . (
455         (description .  "Music that has been transposed.")
456         (internal-class-name . "Transposed_music")
457         (types . (music-wrapper-music general-music transposed-music))
458         ))
459
460     (UntransposableMusic
461      . (
462         (description .  "Music that can not be transposed.")
463
464         (internal-class-name . "Untransposable_music")
465         (types . (music-wrapper-music general-music untransposable-music)) 
466         ))
467
468     (UnrelativableMusic
469      . (
470         (description .  "Music that can not be converted from relative to absolute notation.
471 For example, transposed music.")
472         (internal-class-name . "Un_relativable_music")
473         (types . (music-wrapper-music general-music unrelativable-music))
474         ))
475
476     (RelativeOctaveMusic
477      . (
478         (description .  "Music that was entered in relative octave notation.")
479
480         (internal-class-name . "Relative_octave_music")
481         (types . (music-wrapper-music general-music relative-octave-music))
482         ))
483     
484     (EventChord
485      . (
486         (description .  "Internally used to group a set of events.")
487         (internal-class-name . "Event_chord")
488         (iterator-ctor . ,Event_chord_iterator::constructor)
489         (types . (general-music event-chord simultaneous-music))
490         )
491      )
492     
493     (ScriptEvent
494      . (
495         (description .  "Add an articulation mark to a note. ")
496
497         (internal-class-name . "Event")
498         (types . (general-music event))
499         ))
500
501     (NonEventSkip
502      . (
503         (description .  "Filler that takes up duration, but does not print anything. This also does not create any event-accepting contexts. ")
504         (internal-class-name . "Music")
505         (length . ,ly:music-duration-length)
506         (iterator-ctor . ,Simple_music_iterator::constructor)
507         (types . (general-music event rhythmic-event skip-event))
508         ))
509      
510     (SkipEvent
511      . (
512         (description .  "Filler that takes up duration, but does not print anything.")
513
514         (internal-class-name . "Event")
515         (types . (general-music event rhythmic-event skip-event))
516         ))
517     
518     (SpanEvent
519      . (
520         (description .  "Event for anything that is started at a different time than stopped.")
521
522         (internal-class-name . "Event")
523         (types . (general-music event))
524         ))
525     
526     (SustainEvent
527      . (
528         (description . "Depress or release sustain pedal. ")
529         (internal-class-name . "Event")
530         (types . (general-music pedal-event sustain-pedal-event))
531         ))
532     
533     (SostenutoEvent
534      . (
535         (description . "Depress or release sostenuto pedal. ")
536         (internal-class-name . "Event")
537         (types . (general-music pedal-event sostenuto-pedal-event))
538         ))
539     
540     (UnaCordaEvent
541      . (
542         (description . "Depress or release una-corda pedal.")
543         (internal-class-name . "Event")
544         (types . (general-music pedal-event una-corda-pedal-event))
545         ))
546     
547     (StringNumberEvent
548      . (
549         (description .  "Specify on which string to play this note. Syntax: @code{\\@var{number}}.")
550
551         (internal-class-name . "Event")
552         (types . (general-music string-number-event event))
553         )) 
554
555     (MetronomeChangeEvent
556      . (
557         (description .  "Change tempo setting (in beats per minute).")
558         (internal-class-name . "Event")
559         (types . (general-music metronome-change-event tempo-event event))
560         ))
561     
562     (TextScriptEvent
563      . (
564         (description .  "")
565         (internal-class-name . "Event")
566         (types . (general-music script-event text-script-event event))
567         )) 
568     (TieEvent
569      . (
570         (description .  "A tie.  Entered as @code{~}.")
571         (internal-class-name . "Event")
572         (types . (general-music tie-event event))
573         ))
574     (NewTieEvent
575      . (
576         (description .  "A tie.  Entered as @var{note}-~.")
577         (internal-class-name . "Event")
578         (types . (general-music new-tie-event event))
579         ))
580     (TremoloEvent
581      . (
582         (description . "Un measured tremolo.")
583         (internal-class-name . "Event")
584         (types . (general-music event tremolo-event))
585         ))
586     
587     (VoiceSeparator
588      . (
589         (description .  "Separate polyphonic voices in simultaneous music. Syntax: @code{\\\\}")
590
591         (internal-class-name . "Music")
592         (types . (separator general-music))
593         ))
594
595     (VoltaRepeatedMusic
596      . (
597         (iterator-ctor . ,Volta_repeat_iterator::constructor)
598         (internal-class-name . "Repeated_music")
599         (description . "")
600         (start-moment-function .  ,Repeated_music::first_start)
601         (length . ,Repeated_music::volta_music_length)
602         (types . (general-music repeated-music volta-repeated-music))
603         ))
604     
605     (UnfoldedRepeatedMusic
606      . (
607         (iterator-ctor . ,Unfolded_repeat_iterator::constructor)
608         (description .  "")
609         (start-moment-function .  ,Repeated_music::first_start)
610         (internal-class-name . "Repeated_music")
611         (types . (general-music repeated-music unfolded-repeated-music))
612         (length . ,Repeated_music::unfolded_music_length)
613         ))
614     (PercentRepeatedMusic
615      . (
616         (internal-class-name . "Repeated_music")
617         (description .  "Repeats encoded by percents.")
618         (iterator-ctor . ,Percent_repeat_iterator::constructor)
619         (start-moment-function .  ,Repeated_music::first_start)
620         (length . ,Repeated_music::unfolded_music_length)
621         (types . (general-music repeated-music percent-repeated-music))
622         ))
623     
624     (TremoloRepeatedMusic
625      . (
626         (iterator-ctor . ,Chord_tremolo_iterator::constructor)
627         (description .  "Repeated notes denoted by tremolo beams.")
628         (internal-class-name . "Repeated_music")
629         (start-moment-function .  ,Repeated_music::first_start)
630
631         ;; the length of the repeat is handled by shifting the note logs
632         (length . ,Repeated_music::folded_music_length)
633         (types . (general-music repeated-music tremolo-repeated-music))
634         
635         ))
636     
637     (FoldedRepeatedMusic
638      . (
639         (internal-class-name . "Repeated_music")
640         (description .  "Repeats with alternatives placed in parallel. ")
641         (iterator-ctor  . ,Folded_repeat_iterator::constructor)
642         (start-moment-function .  ,Repeated_music::minimum_start)
643         (length . ,Repeated_music::folded_music_length)
644         (types . (general-music repeated-music folded-repeated-music))
645         ))
646     ))
647
648 (set! music-descriptions
649       (sort music-descriptions alist<?))
650
651 (define music-name-to-property-table (make-vector 59 '()))
652
653
654 ;; init hash table,
655 ;; transport description to an object property.
656 (set!
657  music-descriptions
658  (map (lambda (x)
659         (set-object-property! (car x)
660                               'music-description
661                               (cdr (assq 'description (cdr x))))
662         (let
663             ((l (cdr x)))
664           (set! l (assoc-set! l 'name (car x)))
665           (set! l (assq-remove!  l 'description))
666           (hashq-set! music-name-to-property-table (car x) l)
667           (cons (car x) l)
668           ))
669       music-descriptions))
670
671
672
673 (define-public (make-music-by-name x)
674   (if (not (symbol? x))
675       (error (format "Not a symbol: ~a" x)))
676   (let*
677       (
678        (props (hashq-ref music-name-to-property-table x '()))
679        (name (if (pair? props)
680                  (cdr (assoc 'internal-class-name props))
681                  (error "Can not find music object" x)))
682        )
683
684     (if (eq? props '())
685         (ly:warn (format "Could not find music type `~a'" x)))  
686     (ly:make-bare-music name props)
687     ))
688
689
690
691 (define-public (make-repeated-music name)
692   (let*
693       (
694        (handle (assoc
695                 name
696                 '(("volta" . VoltaRepeatedMusic)
697                   ("unfold" . UnfoldedRepeatedMusic)
698                   ("percent" . PercentRepeatedMusic)
699                   ("tremolo" . TremoloRepeatedMusic)
700                   ("fold" . FoldedRepeatedMusic)
701                   )))
702        (music-name
703         (if (pair? handle)
704             (cdr handle)
705             (begin
706               (ly:warn
707                (string-append "Unknown repeat type `" name
708                               "'\nSee music-types.scm for supported repeats"))
709               'VoltaRepeatedMusic)
710             )
711         )
712        )
713
714     (make-music-by-name music-name)
715     ))
716