]> git.donarmstrong.com Git - lilypond.git/blob - ly/property-init.ly
Add improved shape note support
[lilypond.git] / ly / property-init.ly
1 % property-init.ly
2
3 \version "2.12.0"
4
5 %% for dashed slurs, phrasing slurs, and ties
6 #(define (make-simple-dash-definition dash-fraction dash-period)
7     (list (list 0 1 dash-fraction dash-period)))
8
9 %% common definition for all note head styles reverting
10 %% (palm mute, harmonics, dead notes, ...)
11 defaultNoteHeads =
12 #(define-music-function (parser location) ()
13    (_i "Revert to the default note head style.")
14    (revert-head-style '(NoteHead TabNoteHead)))
15
16
17
18 %% arpeggios
19
20 % For drawing vertical chord brackets with \arpeggio
21 % This is a shorthand for the value of the print-function property
22 % of either Staff.Arpeggio or PianoStaff.Arpeggio, depending whether
23 % cross-staff brackets are desired.
24
25 arpeggio = #(make-music 'ArpeggioEvent)
26 arpeggioArrowUp = {
27   \revert Arpeggio  #'stencil
28   \revert Arpeggio #'X-extent
29   \override Arpeggio  #'arpeggio-direction = #UP
30 }
31 arpeggioArrowDown = {
32   \revert Arpeggio #'stencil
33   \revert Arpeggio #'X-extent
34   \override Arpeggio  #'arpeggio-direction = #DOWN
35 }
36 arpeggioNormal = {
37   \revert Arpeggio #'stencil
38   \revert Arpeggio #'X-extent
39   \revert Arpeggio #'arpeggio-direction
40   \revert Arpeggio #'dash-definition
41 }
42 arpeggioBracket = {
43   \revert Arpeggio #'X-extent
44   \override Arpeggio #'stencil = #ly:arpeggio::brew-chord-bracket
45 }
46 arpeggioParenthesis = {
47   \override Arpeggio #'stencil = #ly:arpeggio::brew-chord-slur
48   \override Arpeggio #'X-extent = #ly:grob::stencil-width
49   \revert Arpeggio #'dash-definition
50 }
51 arpeggioParenthesisDashed = {
52   \override Arpeggio #'stencil = #ly:arpeggio::brew-chord-slur
53   \override Arpeggio #'X-extent = #ly:grob::stencil-width
54   \override Arpeggio #'dash-definition = #'((0 1 0.4 0.75))
55 }
56
57
58 %% auto beaming
59
60 autoBeamOn  = \set autoBeaming = ##t
61 autoBeamOff = \set autoBeaming = ##f
62
63
64 %% balloon length
65
66 balloonLengthOn = {
67   \override BalloonTextItem #'extra-spacing-width = #'(0 . 0)
68   \override BalloonTextItem #'extra-spacing-height = #'(-inf.0 . +inf.0)
69 }
70 balloonLengthOff = {
71   \override BalloonTextItem #'extra-spacing-width = #'(+inf.0 . -inf.0)
72   \override BalloonTextItem #'extra-spacing-height = #'(0 . 0)
73 }
74
75
76 %% bass figures
77
78 bassFigureExtendersOn = {
79   \set useBassFigureExtenders = ##t
80   \set Staff.useBassFigureExtenders = ##t
81 }
82 bassFigureExtendersOff = {
83   \set useBassFigureExtenders = ##f
84   \set Staff.useBassFigureExtenders = ##f
85 }
86 bassFigureStaffAlignmentDown =
87   \override Staff.BassFigureAlignmentPositioning #'direction = #DOWN
88 bassFigureStaffAlignmentUp =
89   \override Staff.BassFigureAlignmentPositioning #'direction = #UP
90 bassFigureStaffAlignmentNeutral =
91   \revert Staff.BassFigureAlignmentPositioning #'direction
92
93
94 %% cadenzas
95
96 cadenzaOn  = \set Timing.timing = ##f
97 cadenzaOff = {
98   \set Timing.timing = ##t
99   \set Timing.measurePosition = #ZERO-MOMENT
100 }
101
102
103 %% chord names
104
105 frenchChords = {
106   \set chordRootNamer = #(chord-name->italian-markup #t)
107   \set chordPrefixSpacer = #0.4
108 }
109 germanChords = {
110   \set chordRootNamer = #(chord-name->german-markup #t)
111   \set chordNoteNamer = #note-name->german-markup
112 }
113 semiGermanChords = {
114   \set chordRootNamer = #(chord-name->german-markup #f)
115   \set chordNoteNamer = #note-name->german-markup
116 }
117 italianChords = {
118   \set chordRootNamer = #(chord-name->italian-markup #f)
119   \set chordPrefixSpacer = #0.4
120 }
121
122
123 %% compressFullBarRests
124
125 compressFullBarRests = \set Score.skipBars = ##t
126 expandFullBarRests   = \set Score.skipBars = ##f
127
128
129 %% dots
130
131 dotsUp      = \override Dots #'direction = #UP
132 dotsDown    = \override Dots #'direction = #DOWN
133 dotsNeutral = \revert Dots #'direction
134
135
136 %% dynamics
137
138 dynamicUp = {
139   \override DynamicText #'direction = #UP
140   \override DynamicLineSpanner #'direction = #UP
141 }
142 dynamicDown = {
143   \override DynamicText #'direction = #DOWN
144   \override DynamicLineSpanner #'direction = #DOWN
145 }
146 dynamicNeutral = {
147   \revert DynamicText #'direction
148   \revert DynamicLineSpanner #'direction
149 }
150
151
152 %% easy heads
153
154 easyHeadsOn = {
155   \override NoteHead #'stencil = #note-head::brew-ez-stencil
156   \override NoteHead #'font-size = #-8
157   \override NoteHead #'font-family = #'sans
158   \override NoteHead #'font-series = #'bold
159 }
160 easyHeadsOff = {
161   \revert NoteHead #'stencil
162   \revert NoteHead #'font-size
163   \revert NoteHead #'font-family
164   \revert NoteHead #'font-series
165 }
166
167
168 %% endincipit
169
170 %% End the incipit and print a ``normal line start''.
171 endincipit = \context Staff {
172   \partial 16 s16  % Hack to handle e.g. \bar ".|" \endincipit
173   \once \override Staff.Clef #'full-size-change = ##t
174   \once \override Staff.Clef #'non-default = ##t
175   \bar ""
176 }
177
178
179 %% fermata markup
180
181 fermataMarkup =
182 #(make-music 'MultiMeasureTextEvent
183              'tweaks (list
184                       ;; Set the 'text based on the 'direction
185                       (cons 'text (lambda (grob)
186                                     (if (eq? (ly:grob-property grob 'direction) DOWN)
187                                         (markup #:musicglyph "scripts.dfermata")
188                                         (markup #:musicglyph "scripts.ufermata"))))
189                       (cons 'outside-staff-priority 40)
190                       (cons 'outside-staff-padding 0)))
191
192 %% font sizes
193
194 teeny      = \set fontSize = #-3
195 tiny       = \set fontSize = #-2
196 small      = \set fontSize = #-1
197 normalsize = \set fontSize = #0
198 large      = \set fontSize = #1
199 huge       = \set fontSize = #2
200
201
202 %% glissando
203
204 glissando = #(make-music 'GlissandoEvent)
205
206
207 %% harmonics
208
209 harmonicsOn =
210 #(define-music-function (parser location) ()
211    (_i "Set the default note head style to a diamond-shaped style.")
212    (override-head-style 'NoteHead 'harmonic))
213 harmonicsOff = \defaultNoteHeads
214 harmonicNote =
215 #(define-music-function (parser location note) (ly:music?)
216    (_i "Print @var{note} with a diamond-shaped note head.")
217    (style-note-heads 'NoteHead 'harmonic note))
218
219
220 %% hideNotes
221
222 hideNotes = {
223   % hide notes, accidentals, etc.
224   \override Dots #'transparent = ##t
225   \override NoteHead #'transparent = ##t
226   \override NoteHead #'no-ledgers = ##t
227   \override Stem #'transparent = ##t
228   \override Beam #'transparent = ##t
229   \override Accidental #'transparent = ##t
230 }
231 unHideNotes = {
232   \revert Accidental #'transparent
233   \revert Beam #'transparent
234   \revert Stem #'transparent
235   \revert NoteHead #'transparent
236   \revert NoteHead #'no-ledgers
237   \revert Dots #'transparent
238 }
239
240
241 %% improvisation
242
243 improvisationOn = {
244   \set squashedPosition = #0
245   \override NoteHead #'style = #'slash
246   \override Accidental #'stencil = ##f
247 }
248 improvisationOff = {
249   \unset squashedPosition
250   \revert NoteHead #'style
251   \revert Accidental #'stencil
252 }
253
254
255 %% merging
256
257 mergeDifferentlyDottedOn =
258   \override Staff.NoteCollision #'merge-differently-dotted = ##t
259 mergeDifferentlyDottedOff =
260   \revert Staff.NoteCollision #'merge-differently-dotted
261 mergeDifferentlyHeadedOn =
262   \override Staff.NoteCollision #'merge-differently-headed = ##t
263 mergeDifferentlyHeadedOff =
264   \revert Staff.NoteCollision #'merge-differently-headed
265
266
267 %% numeric time signature
268
269 numericTimeSignature = \override Staff.TimeSignature #'style = #'numbered
270 defaultTimeSignature = \revert Staff.TimeSignature #'style
271
272
273 %% palm mutes
274
275 palmMuteOn =
276 #(define-music-function (parser location) ()
277    (_i "Set the default note head style to a triangle-shaped style.")
278    (override-head-style 'NoteHead 'do))
279 palmMuteOff = \defaultNoteHeads
280 palmMute =
281 #(define-music-function (parser location note) (ly:music?)
282    (_i "Print @var{note} with a triangle-shaped note head.")
283    (style-note-heads 'NoteHead 'do note))
284
285
286 %% phrasing slurs
287
288 % directions
289 phrasingSlurUp      = \override PhrasingSlur #'direction = #UP
290 phrasingSlurDown    = \override PhrasingSlur #'direction = #DOWN
291 phrasingSlurNeutral = \revert PhrasingSlur #'direction
292
293 % dash-patterns (make-simple-dash-definition defined at top of file)
294 phrasingSlurDashPattern =
295 #(define-music-function (parser location dash-fraction dash-period)
296    (number? number?)
297    (_i "Set up a custom style of dash pattern for @var{dash-fraction} ratio of
298 line to space repeated at @var{dash-period} interval.")
299   #{
300      \override PhrasingSlur #'dash-definition =
301        $(make-simple-dash-definition dash-fraction dash-period)
302   #})
303 phrasingSlurDashed =
304   \override PhrasingSlur #'dash-definition = #'((0 1 0.4 0.75))
305 phrasingSlurDotted =
306   \override PhrasingSlur #'dash-definition = #'((0 1 0.1 0.75))
307 phrasingSlurHalfDashed =
308   \override PhrasingSlur #'dash-definition = #'((0 0.5 0.4 0.75)
309                                                 (0.5 1 1 1))
310 phrasingSlurHalfSolid =
311   \override PhrasingSlur #'dash-definition = #'((0 0.5 1 1)
312                                                 (0.5 1 0.4 0.75))
313 phrasingSlurSolid =
314   \revert PhrasingSlur #'dash-definition
315
316
317 %% point and click
318
319 pointAndClickOn  =
320 #(define-music-function (parser location) ()
321    (_i "Enable generation of code in final-format (e.g. pdf) files to reference the
322 originating lilypond source statement;
323 this is helpful when developing a score but generates bigger final-format files.")
324    (ly:set-option 'point-and-click #t)
325    (make-music 'SequentialMusic 'void #t))
326
327 pointAndClickOff =
328 #(define-music-function (parser location) ()
329    (_i "Suppress generating extra code in final-format (e.g. pdf) files to point
330 back to the lilypond source statement.")
331    (ly:set-option 'point-and-click #f)
332    (make-music 'SequentialMusic 'void #t))
333
334
335 %% predefined fretboards
336
337 predefinedFretboardsOff =
338   \set predefinedDiagramTable = ##f
339 predefinedFretboardsOn =
340   \set predefinedDiagramTable = #fretboard-table
341
342
343 %% shape note heads
344
345 aikenHeads      = \set shapeNoteStyles = #'#(do re miMirror fa sol la ti)
346 aikenHeadsMinor = \set shapeNoteStyles = #'#(la ti do re miMirror fa sol)
347 sacredHarpHeads = \set shapeNoteStyles = #'#(fa sol la fa sol la mi)
348 sacredHarpHeadsMinor = \set shapeNoteStyles = #'#(la mi fa sol la fa sol)
349 southernHarmonyHeads = 
350   \set shapeNoteStyles = #'#(faThin sol laThin faThin sol laThin miThin)
351 southernHarmonyHeadsMinor =
352   \set shapeNoteStyles = #'#(laThin miThin faThin sol laThin faThin sol)
353
354
355
356 %% shifts
357
358 shiftOn   = \override NoteColumn #'horizontal-shift = #1
359 shiftOnn  = \override NoteColumn #'horizontal-shift = #2
360 shiftOnnn = \override NoteColumn #'horizontal-shift = #3
361 shiftOff  = \revert NoteColumn #'horizontal-shift
362
363
364 %% slurs
365
366 % directions
367 slurUp         = \override Slur #'direction = #UP
368 slurDown       = \override Slur #'direction = #DOWN
369 slurNeutral    = \revert Slur #'direction
370
371 % dash-patterns (make-simple-dash-definition defined at top of file)
372 slurDashPattern =
373 #(define-music-function (parser location dash-fraction dash-period)
374   (number? number?)
375   #{
376      \override Slur #'dash-definition =
377        $(make-simple-dash-definition dash-fraction dash-period)
378   #})
379 slurDashed     = \override Slur #'dash-definition = #'((0 1 0.4 0.75))
380 slurDotted     = \override Slur #'dash-definition = #'((0 1 0.1 0.75))
381 slurHalfDashed = \override Slur #'dash-definition = #'((0 0.5 0.4 0.75)
382                                                        (0.5 1 1 1))
383 slurHalfSolid  = \override Slur #'dash-definition = #'((0 0.5 1 1)
384                                                        (0.5 1 0.4 0.75))
385 slurSolid      = \revert Slur #'dash-definition
386
387
388 %% staff switches
389
390 showStaffSwitch = \set followVoice = ##t
391 hideStaffSwitch = \set followVoice = ##f
392
393
394 %% stems
395
396 stemUp      = \override Stem #'direction = #UP
397 stemDown    = \override Stem #'direction = #DOWN
398 stemNeutral = \revert Stem #'direction
399
400
401 %% tablature
402
403 % switch to full notation
404 tabFullNotation = {
405   % time signature
406   \revert TabStaff.TimeSignature #'stencil
407   % stems (the half note gets a double stem)
408   \revert TabVoice.Stem #'length
409   \revert TabVoice.Stem #'no-stem-extend
410   \revert TabVoice.Stem #'flag-style
411   \revert TabVoice.Stem #'details
412   \revert TabVoice.Stem #'transparent
413   \override TabVoice.Stem #'stencil = #tabvoice::draw-double-stem-for-half-notes
414   \set autoBeaming = ##t
415   \revert NoteColumn #'ignore-collision
416   % beams, dots
417   \revert TabVoice.Beam #'stencil
418   \revert TabVoice.Dots #'stencil
419   \revert TabVoice.Tie #'stencil
420   \revert TabVoice.Tie #'after-line-breaking
421   \revert TabVoice.RepeatTie #'stencil
422   \revert TabVoice.RepeatTie #'after-line-breaking
423   \revert TabVoice.LaissezVibrerTie #'stencil
424   \revert TabVoice.Slur #'stencil
425   \revert TabVoice.PhrasingSlur #'stencil
426   % tuplet stuff
427   \revert TabVoice.TupletBracket #'stencil
428   \revert TabVoice.TupletNumber #'stencil
429   % dynamic signs
430   \revert TabVoice.DynamicText #'transparent
431   \revert TabVoice.DynamicTextSpanner #'stencil
432   \revert TabVoice.DynamicTextSpanner #'stencil
433   \revert TabVoice.Hairpin #'transparent
434   % rests
435   \revert TabVoice.Rest #'stencil
436   \revert TabVoice.MultiMeasureRest #'stencil
437   \revert TabVoice.MultiMeasureRestNumber #'transparent
438   % markups etc.
439   \revert TabVoice.Script #'stencil
440   \revert TabVoice.TextScript #'stencil
441   \revert TabStaff.Arpeggio #'stencil
442   \revert TabStaff.NoteColumn #'ignore-collision
443 }
444
445 %tie/repeat tie behaviour
446 hideSplitTiedTabNotes = {
447   \override TabVoice.TabNoteHead #'(details tied-properties break-visibility) = #all-invisible
448   \override TabVoice.TabNoteHead #'(details tied-properties parenthesize) = ##f
449   \override TabVoice.TabNoteHead #'(details repeat-tied-properties note-head-visible) = ##f
450   \override TabVoice.TabNoteHead #'(details repeat-tied-properties parenthesize) = ##f
451 }
452
453 showSplitTiedTabNotes = {
454   \override TabVoice.TabNoteHead #'(details tied-properties break-visibility) = #begin-of-line-visible
455   \override TabVoice.TabNoteHead #'(details tied-properties parenthesize) = ##t
456   \override TabVoice.TabNoteHead #'(details repeat-tied-properties note-head-visible) = ##t
457   \override TabVoice.TabNoteHead #'(details repeat-tied-properties parenthesize) = ##t
458 }
459
460 %% text length
461
462 textLengthOn = {
463   \override TextScript #'extra-spacing-width = #'(0 . 0)
464   \override TextScript #'extra-spacing-height = #'(-inf.0 . +inf.0)
465 }
466 textLengthOff = {
467   \override TextScript #'extra-spacing-width = #'(+inf.0 . -inf.0)
468   \override TextScript #'extra-spacing-height = #'(0 . 0)
469 }
470
471
472 %% text spanners
473
474 textSpannerUp      = \override TextSpanner #'direction = #UP
475 textSpannerDown    = \override TextSpanner #'direction = #DOWN
476 textSpannerNeutral = \revert TextSpanner #'direction
477
478
479 %% ties
480
481 % directions
482 tieUp      = \override Tie #'direction = #UP
483 tieDown    = \override Tie #'direction = #DOWN
484 tieNeutral = \revert Tie #'direction
485
486 % dash-patterns (make-simple-dash-definition defined at top of file)
487 tieDashPattern =
488 #(define-music-function (parser location dash-fraction dash-period)
489   (number? number?)
490   #{
491      \override Tie #'dash-definition =
492        $(make-simple-dash-definition dash-fraction dash-period)
493   #})
494 tieDashed     = \override Tie #'dash-definition = #'((0 1 0.4 0.75))
495 tieDotted     = \override Tie #'dash-definition = #'((0 1 0.1 0.75))
496 tieHalfDashed = \override Tie #'dash-definition = #'((0 0.5 0.4 0.75)
497                                                      (0.5 1 1 1))
498 tieHalfSolid  = \override Tie #'dash-definition = #'((0 0.5 1 1)
499                                                      (0.5 1 0.4 0.75))
500 tieSolid      = \revert Tie #'dash-definition
501
502
503 %% tuplets
504
505 tupletUp      = \override TupletBracket #'direction = #UP
506 tupletDown    = \override TupletBracket #'direction = #DOWN
507 tupletNeutral = \revert TupletBracket #'direction
508
509
510 %% voice properties
511
512 % dynamic ly:dir?  text script, articulation script ly:dir?
513 voiceOne   = #(context-spec-music (make-voice-props-set 0)  'Voice)
514 voiceTwo   = #(context-spec-music (make-voice-props-set 1)  'Voice)
515 voiceThree = #(context-spec-music (make-voice-props-set 2)  'Voice)
516 voiceFour  = #(context-spec-music (make-voice-props-set 3)  'Voice)
517 oneVoice   = #(context-spec-music (make-voice-props-revert) 'Voice)
518
519
520 %% voice styles
521
522 voiceOneStyle = {
523   \override NoteHead #'style = #'diamond
524   \override NoteHead #'color = #red
525   \override Stem #'color = #red
526   \override Beam #'color = #red
527 }
528 voiceTwoStyle = {
529   \override NoteHead #'style = #'triangle
530   \override NoteHead #'color = #blue
531   \override Stem #'color = #blue
532   \override Beam #'color = #blue
533 }
534 voiceThreeStyle = {
535   \override NoteHead #'style = #'xcircle
536   \override NoteHead #'color = #green
537   \override Stem #'color = #green
538   \override Beam #'color = #green
539 }
540 voiceFourStyle = {
541   \override NoteHead #'style = #'cross
542   \override NoteHead #'color = #magenta
543   \override Stem #'color = #magenta
544   \override Beam #'color = #magenta
545 }
546 voiceNeutralStyle = {
547   \revert NoteHead #'style
548   \revert NoteHead #'color
549   \revert Stem #'color
550   \revert Beam #'color
551 }
552
553
554 %% x notes
555
556 xNotesOn =
557 #(define-music-function (parser location) ()
558    (_i "Set the default note head style to a cross-shaped style.")
559    (override-head-style '(TabNoteHead NoteHead) 'cross))
560 xNotesOff = \defaultNoteHeads
561 xNote =
562 #(define-music-function (parser location note) (ly:music?)
563    (_i "Print @var{note} with a cross-shaped note head.")
564    (style-note-heads '(TabNoteHead NoteHead) 'cross note))
565
566
567 %% dead notes (these need to come after "x notes")
568
569 % Define aliases of cross-head notes for specific purposes
570 deadNotesOn  = \xNotesOn
571 deadNotesOff = \xNotesOff
572 deadNote     = #xNote