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