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