]> git.donarmstrong.com Git - lilypond.git/blob - scm/define-music-types.scm
* mf/feta18.mf: design size is 18 not 22.5
[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 span-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     
315     (PhrasingSlurEvent
316      . (
317         (description . "Start or end phrasing slur. Syntax NOTE \\(  and \\) NOTE")
318         (internal-class-name . "Event")
319         (types . (general-music span-event phrasing-slur-event))
320         ))
321     
322     (PropertySet
323      . (
324         (description .  "Set a context property.
325
326 Syntax: @code{\\property @var{context}.@var{prop} = @var{scheme-val}}.")
327         (internal-class-name . "Music")
328         (types . (layout-instruction general-music))
329         (iterator-ctor . ,Property_iterator::constructor)
330         )
331      )
332     
333     (PropertyUnset
334      . (
335         (description .  "Remove the definition of a context @code{\\property}.")
336
337         (internal-class-name . "Music")
338         (types . (layout-instruction general-music))
339         (iterator-ctor . ,Property_unset_iterator::constructor)
340         )
341      )
342     
343     (PesOrFlexaEvent
344      . (
345         (description .  "Within a ligature, mark the previous and the
346 following note to form a pes (if melody goes up) or a flexa (if melody
347 goes down).")
348
349         (internal-class-name . "Event")
350         (types . (general-music pes-or-flexa-event event))
351         ))
352
353     (RelativeOctaveCheck
354      . ((description . "Check if a pitch is in the correct octave.")
355         (internal-class-name . "Relative_octave_check")
356         (types . (general-music relative-octave-check))
357         ))
358     
359     (RepeatedMusic
360      . (
361         (description .  "Repeat music in different ways")
362
363         (type .  repeated-music)
364         (types . (general-music repeated-music))
365         ))
366     
367     (Event
368      . (
369         (description .  "Atomic music event.")
370
371         (internal-class-name . "Event")
372         (types . (general-music event))
373         ))
374     
375     (RestEvent
376      . (
377         (description .  "A Rest. Syntax @code{r4} for a quarter rest. ")
378
379         (internal-class-name . "Event")
380         (types . (general-music event rhythmic-event rest-event))
381         )) 
382     (SequentialMusic
383      . (
384         (description .  "Music expressions concatenated. Syntax \\sequential @{..@} or simply @{..@} .")
385
386         (internal-class-name . "Sequential_music")
387         (iterator-ctor . ,Sequential_music_iterator::constructor)
388         (types . (general-music sequential-music))
389         ))
390     
391     (MultiMeasureRestMusicGroup
392      . (
393         (description .  "Like sequential-music, but specifically intended
394 to group start-mmrest, skip, stop-mmrest sequence. Syntax @code{R2.*5} for 5 measures in 3/4 time.")
395         (internal-class-name . "Sequential_music")
396         (iterator-ctor . ,Sequential_music_iterator::constructor)
397         (types . (general-music sequential-music))
398         ))
399     
400     (SimultaneousMusic
401      . (
402         (description .  "Music playing together.
403
404 SYNTAX
405
406 @code{ \\simultaneous @{ .. @}} or < .. >.")
407
408         (internal-class-name . "Simultaneous_music")
409         (iterator-ctor . ,Simultaneous_music_iterator::constructor)
410         
411         (types . (general-music simultaneous-music))
412         ))
413     
414     (SlurEvent
415      . (
416         (description . "Start or end slur. Syntax NOTE(  and )NOTE")
417         (internal-class-name . "Event")
418         (types . (general-music span-event slur-event))
419         ))
420
421     (RevertProperty
422      . (
423         (description .  "The opposite of @ref{OverrideProperty}: remove a
424 previously added property from a graphical object definition
425  ")
426
427         (internal-class-name . "Music")
428         (types . (general-music layout-instruction))
429         (iterator-ctor . ,      Pop_property_iterator::constructor)
430         ))
431
432     (OutputPropertySetMusic
433      . (
434         (description .  "Set grob properties in objects
435 individually. Syntax @code{\\outputproperty @var{predicate} @var{prop}
436 = @var{val}}.")
437
438         (internal-class-name . "Music")
439         (iterator-ctor . ,Output_property_music_iterator::constructor)
440         (types . (general-music layout-instruction))
441         ))
442     
443     (TextSpanEvent
444      . (
445         (description . "Start a text spanner like 8va.....|")
446         (internal-class-name . "Event")
447         (types . (general-music span-event text-span-event))
448         ))
449     
450     (TranslatorChange
451      . (
452         (description .  "Change staffs in Piano staff. Syntax @code{\\translator Staff = @var{new-id}}.")
453         (internal-class-name . "Music")
454         (iterator-ctor . , Change_iterator::constructor)
455         (types . (general-music translator-change-instruction))
456         ))
457     
458     (TimeScaledMusic
459      . (
460         (description .  "Multiply durations, as in tuplets. Syntax @code{\\times @var{fraction} @var{music}}, e.g.
461 @code{\\times 2/3 @{ ... @}} for triplets.
462  ")
463         (internal-class-name . "Time_scaled_music")
464         (iterator-ctor . ,Time_scaled_music_iterator::constructor)
465         (types . (time-scaled-music music-wrapper-music general-music))
466         ))
467     
468     (TransposedMusic
469      . (
470         (description .  "Music that has been transposed.")
471         (internal-class-name . "Transposed_music")
472         (types . (music-wrapper-music general-music transposed-music))
473         ))
474
475     (UntransposableMusic
476      . (
477         (description .  "Music that can not be transposed.")
478
479         (internal-class-name . "Untransposable_music")
480         (types . (music-wrapper-music general-music untransposable-music)) 
481         ))
482
483     (UnrelativableMusic
484      . (
485         (description .  "Music that can not be converted from relative to absolute notation.
486 For example, transposed music.")
487         (internal-class-name . "Un_relativable_music")
488         (types . (music-wrapper-music general-music unrelativable-music))
489         ))
490
491     (RelativeOctaveMusic
492      . (
493         (description .  "Music that was entered in relative octave notation.")
494
495         (internal-class-name . "Relative_octave_music")
496         (types . (music-wrapper-music general-music relative-octave-music))
497         ))
498     
499     (EventChord
500      . (
501         (description .  "Internally used to group a set of events.")
502         (internal-class-name . "Event_chord")
503         (iterator-ctor . ,Event_chord_iterator::constructor)
504         (types . (general-music event-chord simultaneous-music))
505         )
506      )
507     
508     (ScriptEvent
509      . (
510         (description .  "Add an articulation mark to a note. ")
511
512         (internal-class-name . "Event")
513         (types . (general-music event))
514         ))
515
516     (NonEventSkip
517      . (
518         (description .  "Filler that takes up duration, but does not print anything. This also does not create any event-accepting contexts. ")
519         (internal-class-name . "Music")
520         (length . ,ly:music-duration-length)
521         (iterator-ctor . ,Simple_music_iterator::constructor)
522         (types . (general-music event rhythmic-event skip-event))
523         ))
524      
525     (SkipEvent
526      . (
527         (description .  "Filler that takes up duration, but does not print anything.")
528
529         (internal-class-name . "Event")
530         (types . (general-music event rhythmic-event skip-event))
531         ))
532     
533     (SpanEvent
534      . (
535         (description .  "Event for anything that is started at a different time than stopped.")
536
537         (internal-class-name . "Event")
538         (types . (general-music event))
539         ))
540     
541     (SustainEvent
542      . (
543         (description . "Depress or release sustain pedal. ")
544         (internal-class-name . "Event")
545         (types . (general-music pedal-event sustain-pedal-event))
546         ))
547     
548     (SostenutoEvent
549      . (
550         (description . "Depress or release sostenuto pedal. ")
551         (internal-class-name . "Event")
552         (types . (general-music pedal-event sostenuto-pedal-event))
553         ))
554     
555     (UnaCordaEvent
556      . (
557         (description . "Depress or release una-corda pedal.")
558         (internal-class-name . "Event")
559         (types . (general-music pedal-event una-corda-pedal-event))
560         ))
561     
562     (StringNumberEvent
563      . (
564         (description .  "Specify on which string to play this note. Syntax: @code{\\@var{number}}.")
565
566         (internal-class-name . "Event")
567         (types . (general-music string-number-event event))
568         )) 
569
570     (MetronomeChangeEvent
571      . (
572         (description .  "Change tempo setting (in beats per minute).")
573         (internal-class-name . "Event")
574         (types . (general-music metronome-change-event tempo-event event))
575         ))
576     
577     (TextScriptEvent
578      . (
579         (description .  "")
580         (internal-class-name . "Event")
581         (types . (general-music script-event text-script-event event))
582         )) 
583     (TieEvent
584      . (
585         (description .  "A tie.  Entered as @var{note}-~.")
586         (internal-class-name . "Event")
587         (types . (general-music tie-event event))
588         ))
589     (TremoloEvent
590      . (
591         (description . "Un measured tremolo.")
592         (internal-class-name . "Event")
593         (types . (general-music event tremolo-event))
594         ))
595     
596     (VoiceSeparator
597      . (
598         (description .  "Separate polyphonic voices in simultaneous music. Syntax: @code{\\\\}")
599
600         (internal-class-name . "Music")
601         (types . (separator general-music))
602         ))
603
604     (VoltaRepeatedMusic
605      . (
606         (iterator-ctor . ,Volta_repeat_iterator::constructor)
607         (internal-class-name . "Repeated_music")
608         (description . "")
609         (start-moment-function .  ,Repeated_music::first_start)
610         (length . ,Repeated_music::volta_music_length)
611         (types . (general-music repeated-music volta-repeated-music))
612         ))
613     
614     (UnfoldedRepeatedMusic
615      . (
616         (iterator-ctor . ,Unfolded_repeat_iterator::constructor)
617         (description .  "")
618         (start-moment-function .  ,Repeated_music::first_start)
619         (internal-class-name . "Repeated_music")
620         (types . (general-music repeated-music unfolded-repeated-music))
621         (length . ,Repeated_music::unfolded_music_length)
622         ))
623     (PercentRepeatedMusic
624      . (
625         (internal-class-name . "Repeated_music")
626         (description .  "Repeats encoded by percents.")
627         (iterator-ctor . ,Percent_repeat_iterator::constructor)
628         (start-moment-function .  ,Repeated_music::first_start)
629         (length . ,Repeated_music::unfolded_music_length)
630         (types . (general-music repeated-music percent-repeated-music))
631         ))
632     
633     (TremoloRepeatedMusic
634      . (
635         (iterator-ctor . ,Chord_tremolo_iterator::constructor)
636         (description .  "Repeated notes denoted by tremolo beams.")
637         (internal-class-name . "Repeated_music")
638         (start-moment-function .  ,Repeated_music::first_start)
639
640         ;; the length of the repeat is handled by shifting the note logs
641         (length . ,Repeated_music::folded_music_length)
642         (types . (general-music repeated-music tremolo-repeated-music))
643         
644         ))
645     
646     (FoldedRepeatedMusic
647      . (
648         (internal-class-name . "Repeated_music")
649         (description .  "Repeats with alternatives placed in parallel. ")
650         (iterator-ctor  . ,Folded_repeat_iterator::constructor)
651         (start-moment-function .  ,Repeated_music::minimum_start)
652         (length . ,Repeated_music::folded_music_length)
653         (types . (general-music repeated-music folded-repeated-music))
654         ))
655     ))
656
657 (set! music-descriptions
658       (sort music-descriptions alist<?))
659
660 (define music-name-to-property-table (make-vector 59 '()))
661
662
663 ;; init hash table,
664 ;; transport description to an object property.
665 (set!
666  music-descriptions
667  (map (lambda (x)
668         (set-object-property! (car x)
669                               'music-description
670                               (cdr (assq 'description (cdr x))))
671         (let
672             ((l (cdr x)))
673           (set! l (assoc-set! l 'name (car x)))
674           (set! l (assq-remove!  l 'description))
675           (hashq-set! music-name-to-property-table (car x) l)
676           (cons (car x) l)
677           ))
678       music-descriptions))
679
680
681
682 (define-public (make-music-by-name x)
683   (if (not (symbol? x))
684       (error (format "Not a symbol: ~a" x)))
685   (let*
686       (
687        (props (hashq-ref music-name-to-property-table x '()))
688        (name (if (pair? props)
689                  (cdr (assoc 'internal-class-name props))
690                  (error "Can not find music object" x)))
691        )
692
693     (if (eq? props '())
694         (ly:warn (format "Could not find music type `~a'" x)))  
695     (ly:make-bare-music name props)
696     ))
697
698
699
700 (define-public (make-repeated-music name)
701   (let*
702       (
703        (handle (assoc
704                 name
705                 '(("volta" . VoltaRepeatedMusic)
706                   ("unfold" . UnfoldedRepeatedMusic)
707                   ("percent" . PercentRepeatedMusic)
708                   ("tremolo" . TremoloRepeatedMusic)
709                   ("fold" . FoldedRepeatedMusic)
710                   )))
711        (music-name
712         (if (pair? handle)
713             (cdr handle)
714             (begin
715               (ly:warn
716                (string-append "Unknown repeat type `" name
717                               "'\nSee music-types.scm for supported repeats"))
718               'VoltaRepeatedMusic)
719             )
720         )
721        )
722
723     (make-music-by-name music-name)
724     ))
725