Correction: no negative fret numbers in snippet
[lilypond/mpolesky.git] / ly / property-init.ly
blob613ea511341373b98732761eb3ab6ae140e9d61d
1 % property-init.ly
3 \version "2.12.0"
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)))
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)))
18 %% arpeggios
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.
25 arpeggio = #(make-music 'ArpeggioEvent)
26 arpeggioArrowUp = {
27 \revert Arpeggio #'stencil
28 \revert Arpeggio #'X-extent
29 \override Arpeggio #'arpeggio-direction = #UP
31 arpeggioArrowDown = {
32 \revert Arpeggio #'stencil
33 \revert Arpeggio #'X-extent
34 \override Arpeggio #'arpeggio-direction = #DOWN
36 arpeggioNormal = {
37 \revert Arpeggio #'stencil
38 \revert Arpeggio #'X-extent
39 \revert Arpeggio #'arpeggio-direction
40 \revert Arpeggio #'dash-definition
42 arpeggioBracket = {
43 \revert Arpeggio #'X-extent
44 \override Arpeggio #'stencil = #ly:arpeggio::brew-chord-bracket
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
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))
58 %% auto beaming
60 autoBeamOn = \set autoBeaming = ##t
61 autoBeamOff = \set autoBeaming = ##f
64 %% balloon length
66 balloonLengthOn = {
67 \override BalloonTextItem #'extra-spacing-width = #'(0 . 0)
68 \override BalloonTextItem #'extra-spacing-height = #'(-inf.0 . +inf.0)
70 balloonLengthOff = {
71 \override BalloonTextItem #'extra-spacing-width = #'(+inf.0 . -inf.0)
72 \override BalloonTextItem #'extra-spacing-height = #'(0 . 0)
76 %% bass figures
78 bassFigureExtendersOn = {
79 \set useBassFigureExtenders = ##t
80 \set Staff.useBassFigureExtenders = ##t
82 bassFigureExtendersOff = {
83 \set useBassFigureExtenders = ##f
84 \set Staff.useBassFigureExtenders = ##f
86 bassFigureStaffAlignmentDown =
87 \override Staff.BassFigureAlignmentPositioning #'direction = #DOWN
88 bassFigureStaffAlignmentUp =
89 \override Staff.BassFigureAlignmentPositioning #'direction = #UP
90 bassFigureStaffAlignmentNeutral =
91 \revert Staff.BassFigureAlignmentPositioning #'direction
94 %% cadenzas
96 cadenzaOn = \set Timing.timing = ##f
97 cadenzaOff = {
98 \set Timing.timing = ##t
99 \set Timing.measurePosition = #ZERO-MOMENT
103 %% chord names
105 frenchChords = {
106 \set chordRootNamer = #(chord-name->italian-markup #t)
107 \set chordPrefixSpacer = #0.4
109 germanChords = {
110 \set chordRootNamer = #(chord-name->german-markup #t)
111 \set chordNoteNamer = #note-name->german-markup
113 semiGermanChords = {
114 \set chordRootNamer = #(chord-name->german-markup #f)
115 \set chordNoteNamer = #note-name->german-markup
117 italianChords = {
118 \set chordRootNamer = #(chord-name->italian-markup #f)
119 \set chordPrefixSpacer = #0.4
123 %% compressFullBarRests
125 compressFullBarRests = \set Score.skipBars = ##t
126 expandFullBarRests = \set Score.skipBars = ##f
129 %% dots
131 dotsUp = \override Dots #'direction = #UP
132 dotsDown = \override Dots #'direction = #DOWN
133 dotsNeutral = \revert Dots #'direction
136 %% dynamics
138 dynamicUp = {
139 \override DynamicText #'direction = #UP
140 \override DynamicLineSpanner #'direction = #UP
142 dynamicDown = {
143 \override DynamicText #'direction = #DOWN
144 \override DynamicLineSpanner #'direction = #DOWN
146 dynamicNeutral = {
147 \revert DynamicText #'direction
148 \revert DynamicLineSpanner #'direction
152 %% easy heads
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
160 easyHeadsOff = {
161 \revert NoteHead #'stencil
162 \revert NoteHead #'font-size
163 \revert NoteHead #'font-family
164 \revert NoteHead #'font-series
168 %% endincipit
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 ""
179 %% fermata markup
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)))
192 %% font sizes
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
202 %% glissando
204 glissando = #(make-music 'GlissandoEvent)
207 %% harmonics
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))
220 %% hideNotes
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
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
241 %% improvisation
243 improvisationOn = {
244 \set squashedPosition = #0
245 \override NoteHead #'style = #'slash
246 \override Accidental #'stencil = ##f
248 improvisationOff = {
249 \unset squashedPosition
250 \revert NoteHead #'style
251 \revert Accidental #'stencil
255 %% merging
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
267 %% numeric time signature
269 numericTimeSignature = \override Staff.TimeSignature #'style = #'numbered
270 defaultTimeSignature = \revert Staff.TimeSignature #'style
273 %% palm mutes
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))
286 %% phrasing slurs
288 % directions
289 phrasingSlurUp = \override PhrasingSlur #'direction = #UP
290 phrasingSlurDown = \override PhrasingSlur #'direction = #DOWN
291 phrasingSlurNeutral = \revert PhrasingSlur #'direction
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.")
300 \override PhrasingSlur #'dash-definition =
301 $(make-simple-dash-definition dash-fraction dash-period)
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
317 %% point and click
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))
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))
335 %% predefined fretboards
337 predefinedFretboardsOff =
338 \set predefinedDiagramTable = ##f
339 predefinedFretboardsOn =
340 \set predefinedDiagramTable = #fretboard-table
343 %% shape note heads
345 aikenHeads = \set shapeNoteStyles = #'#(do re mi fa #f la ti)
346 sacredHarpHeads = \set shapeNoteStyles = #'#(fa #f la fa #f la mi)
349 %% shifts
351 shiftOn = \override NoteColumn #'horizontal-shift = #1
352 shiftOnn = \override NoteColumn #'horizontal-shift = #2
353 shiftOnnn = \override NoteColumn #'horizontal-shift = #3
354 shiftOff = \revert NoteColumn #'horizontal-shift
357 %% slurs
359 % directions
360 slurUp = \override Slur #'direction = #UP
361 slurDown = \override Slur #'direction = #DOWN
362 slurNeutral = \revert Slur #'direction
364 % dash-patterns (make-simple-dash-definition defined at top of file)
365 slurDashPattern =
366 #(define-music-function (parser location dash-fraction dash-period)
367 (number? number?)
369 \override Slur #'dash-definition =
370 $(make-simple-dash-definition dash-fraction dash-period)
372 slurDashed = \override Slur #'dash-definition = #'((0 1 0.4 0.75))
373 slurDotted = \override Slur #'dash-definition = #'((0 1 0.1 0.75))
374 slurHalfDashed = \override Slur #'dash-definition = #'((0 0.5 0.4 0.75)
375 (0.5 1 1 1))
376 slurHalfSolid = \override Slur #'dash-definition = #'((0 0.5 1 1)
377 (0.5 1 0.4 0.75))
378 slurSolid = \revert Slur #'dash-definition
381 %% staff switches
383 showStaffSwitch = \set followVoice = ##t
384 hideStaffSwitch = \set followVoice = ##f
387 %% stems
389 stemUp = \override Stem #'direction = #UP
390 stemDown = \override Stem #'direction = #DOWN
391 stemNeutral = \revert Stem #'direction
394 %% tablature
396 % switch to full notation
397 tabFullNotation = {
398 % time signature
399 \revert TabStaff.TimeSignature #'stencil
400 % stems (the half note gets a double stem)
401 \revert TabVoice.Stem #'length
402 \revert TabVoice.Stem #'no-stem-extend
403 \revert TabVoice.Stem #'flag-style
404 \revert TabVoice.Stem #'details
405 \revert TabVoice.Stem #'transparent
406 \override TabVoice.Stem #'stencil = #tabvoice::draw-double-stem-for-half-notes
407 \set autoBeaming = ##t
408 \revert NoteColumn #'ignore-collision
409 % beams, dots
410 \revert TabVoice.Beam #'stencil
411 \revert TabVoice.Dots #'stencil
412 \revert TabVoice.Tie #'stencil
413 \revert TabVoice.Tie #'after-line-breaking
414 \revert TabVoice.RepeatTie #'stencil
415 \revert TabVoice.RepeatTie #'after-line-breaking
416 \revert TabVoice.LaissezVibrerTie #'stencil
417 \revert TabVoice.Slur #'stencil
418 \revert TabVoice.PhrasingSlur #'stencil
419 % tuplet stuff
420 \revert TabVoice.TupletBracket #'stencil
421 \revert TabVoice.TupletNumber #'stencil
422 % dynamic signs
423 \revert TabVoice.DynamicText #'transparent
424 \revert TabVoice.DynamicTextSpanner #'stencil
425 \revert TabVoice.DynamicTextSpanner #'stencil
426 \revert TabVoice.Hairpin #'transparent
427 % rests
428 \revert TabVoice.Rest #'stencil
429 \revert TabVoice.MultiMeasureRest #'stencil
430 \revert TabVoice.MultiMeasureRestNumber #'transparent
431 % markups etc.
432 \revert TabVoice.Script #'stencil
433 \revert TabVoice.TextScript #'stencil
434 \revert TabStaff.Arpeggio #'stencil
435 \revert TabStaff.NoteColumn #'ignore-collision
438 %tie/repeat tie behaviour
439 hideSplitTiedTabNotes = {
440 \override TabVoice.TabNoteHead #'(details tied-properties break-visibility) = #all-invisible
441 \override TabVoice.TabNoteHead #'(details tied-properties parenthesize) = ##f
442 \override TabVoice.TabNoteHead #'(details repeat-tied-properties note-head-visible) = ##f
443 \override TabVoice.TabNoteHead #'(details repeat-tied-properties parenthesize) = ##f
446 showSplitTiedTabNotes = {
447 \override TabVoice.TabNoteHead #'(details tied-properties break-visibility) = #begin-of-line-visible
448 \override TabVoice.TabNoteHead #'(details tied-properties parenthesize) = ##t
449 \override TabVoice.TabNoteHead #'(details repeat-tied-properties note-head-visible) = ##t
450 \override TabVoice.TabNoteHead #'(details repeat-tied-properties parenthesize) = ##t
453 %% text length
455 textLengthOn = {
456 \override TextScript #'extra-spacing-width = #'(0 . 0)
457 \override TextScript #'extra-spacing-height = #'(-inf.0 . +inf.0)
459 textLengthOff = {
460 \override TextScript #'extra-spacing-width = #'(+inf.0 . -inf.0)
461 \override TextScript #'extra-spacing-height = #'(0 . 0)
465 %% text spanners
467 textSpannerUp = \override TextSpanner #'direction = #UP
468 textSpannerDown = \override TextSpanner #'direction = #DOWN
469 textSpannerNeutral = \revert TextSpanner #'direction
472 %% ties
474 % directions
475 tieUp = \override Tie #'direction = #UP
476 tieDown = \override Tie #'direction = #DOWN
477 tieNeutral = \revert Tie #'direction
479 % dash-patterns (make-simple-dash-definition defined at top of file)
480 tieDashPattern =
481 #(define-music-function (parser location dash-fraction dash-period)
482 (number? number?)
484 \override Tie #'dash-definition =
485 $(make-simple-dash-definition dash-fraction dash-period)
487 tieDashed = \override Tie #'dash-definition = #'((0 1 0.4 0.75))
488 tieDotted = \override Tie #'dash-definition = #'((0 1 0.1 0.75))
489 tieHalfDashed = \override Tie #'dash-definition = #'((0 0.5 0.4 0.75)
490 (0.5 1 1 1))
491 tieHalfSolid = \override Tie #'dash-definition = #'((0 0.5 1 1)
492 (0.5 1 0.4 0.75))
493 tieSolid = \revert Tie #'dash-definition
496 %% tuplets
498 tupletUp = \override TupletBracket #'direction = #UP
499 tupletDown = \override TupletBracket #'direction = #DOWN
500 tupletNeutral = \revert TupletBracket #'direction
503 %% voice properties
505 % dynamic ly:dir? text script, articulation script ly:dir?
506 voiceOne = #(context-spec-music (make-voice-props-set 0) 'Voice)
507 voiceTwo = #(context-spec-music (make-voice-props-set 1) 'Voice)
508 voiceThree = #(context-spec-music (make-voice-props-set 2) 'Voice)
509 voiceFour = #(context-spec-music (make-voice-props-set 3) 'Voice)
510 oneVoice = #(context-spec-music (make-voice-props-revert) 'Voice)
513 %% voice styles
515 voiceOneStyle = {
516 \override NoteHead #'style = #'diamond
517 \override NoteHead #'color = #red
518 \override Stem #'color = #red
519 \override Beam #'color = #red
521 voiceTwoStyle = {
522 \override NoteHead #'style = #'triangle
523 \override NoteHead #'color = #blue
524 \override Stem #'color = #blue
525 \override Beam #'color = #blue
527 voiceThreeStyle = {
528 \override NoteHead #'style = #'xcircle
529 \override NoteHead #'color = #green
530 \override Stem #'color = #green
531 \override Beam #'color = #green
533 voiceFourStyle = {
534 \override NoteHead #'style = #'cross
535 \override NoteHead #'color = #magenta
536 \override Stem #'color = #magenta
537 \override Beam #'color = #magenta
539 voiceNeutralStyle = {
540 \revert NoteHead #'style
541 \revert NoteHead #'color
542 \revert Stem #'color
543 \revert Beam #'color
547 %% x notes
549 xNotesOn =
550 #(define-music-function (parser location) ()
551 (_i "Set the default note head style to a cross-shaped style.")
552 (override-head-style '(TabNoteHead NoteHead) 'cross))
553 xNotesOff = \defaultNoteHeads
554 xNote =
555 #(define-music-function (parser location note) (ly:music?)
556 (_i "Print @var{note} with a cross-shaped note head.")
557 (style-note-heads '(TabNoteHead NoteHead) 'cross note))
560 %% dead notes (these need to come after "x notes")
562 % Define aliases of cross-head notes for specific purposes
563 deadNotesOn = \xNotesOn
564 deadNotesOff = \xNotesOff
565 deadNote = #xNote