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