From 110379e93c41a5098f85603e3aafce19179c0610 Mon Sep 17 00:00:00 2001 From: Valentin Villenave Date: Tue, 22 Apr 2008 18:30:32 +0200 Subject: [PATCH] Update from Neil Two useful and appreciated snippets! --- ...ing-text-indications-to-metronome-marks.ly | 59 +++++++++++++++++++ .../creating-simultaneous-rehearsal-marks.ly | 40 +++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 input/new/adding-text-indications-to-metronome-marks.ly create mode 100644 input/new/creating-simultaneous-rehearsal-marks.ly diff --git a/input/new/adding-text-indications-to-metronome-marks.ly b/input/new/adding-text-indications-to-metronome-marks.ly new file mode 100644 index 0000000000..630ee5a1df --- /dev/null +++ b/input/new/adding-text-indications-to-metronome-marks.ly @@ -0,0 +1,59 @@ +\version "2.11.43" +\header { + lsrtags = "expressive-marks,text,tweaks-and-overrides" + texidoc = " +Using Scheme code to override the stencil for @code{MetronomeMark} +objects, this example allows the creation of metronome marks which include +text directions. The function @code{\tempoChangeMarkup} is called with three +strings: the text label, note duration, and beats per minute. To print the +new metronome mark, this is followed by the standard @code{\tempo} command. +" + doctitle = "Adding text indications to metronome marks" +} + +% Thanks to Alexander Kobel for this snippet + +tempoMarkLabelSize = #0 +tempoMarkNoteSize = #-6 + +#(define (tempoChangeMarkupFactory grob label noteValue tempo) + (interpret-markup + (ly:grob-layout grob) + (ly:grob-alist-chain grob (ly:output-def-lookup (ly:grob-layout grob) 'text-font-defaults)) + (markup + #:fontsize tempoMarkLabelSize #:italic #:concat (label (if (string-null? label) "(" " (" )) + #:hspace -1 + #:fontsize tempoMarkNoteSize #:general-align Y DOWN #:note noteValue UP + #:fontsize tempoMarkLabelSize #:italic #:concat( "= " tempo ")" ) + ) + )) + +#(define (tempoChangeStencil label noteValue tempo) + (lambda (grob) + (tempoChangeMarkupFactory grob label noteValue tempo) + )) + +tempoChangeMarkup = #(define-music-function (parser location label noteValue tempo) (string? string? string?) + #{ + \once \override Score.MetronomeMark #'stencil = #(tempoChangeStencil $label $noteValue $tempo) + #}) + +\relative c' { + \time 4/4 + \clef treble + % initialize the override + \tempoChangeMarkup #"Moderato" #"4" #"63" + % markup is printed + \tempo 4 = 63 + c4 d e f + g a b c + \time 6/4 + \mark \default + \tempoChangeMarkup #"presto" #"2." #"90" + \tempo 2. = 90 + c2. g \break + e \tempoChangeMarkup #"handling collision with RehearsalMark" #"4" #"120" \tempo 4 = 120 c + \time 4/4 + \mark \default + c1 +} diff --git a/input/new/creating-simultaneous-rehearsal-marks.ly b/input/new/creating-simultaneous-rehearsal-marks.ly new file mode 100644 index 0000000000..c6743d5abe --- /dev/null +++ b/input/new/creating-simultaneous-rehearsal-marks.ly @@ -0,0 +1,40 @@ +\version "2.11.39" +\header { + lsrtags = "expressive-marks,text,tweaks-and-overrides" + texidoc = " +Unlike text scripts, rehearsal marks cannot be stacked at a particular point +in a score: only one @code{RehearsalMark} object is created. Using an +invisible measure and bar line, an extra rehearsal mark can be added, giving +the appearance of two marks in the same column. + +This method may also prove useful for placing rehearsal marks at both the +end of one system and the start of the following system. +" + doctitle = "Creating simultaneous rehearsal marks" +} + +% Thanks to Risto Vääräniemi for this snippet + +\paper { ragged-right = ##t } + +{ + \key a \major + \set Score.markFormatter = #format-mark-box-letters + \once \override Score.RehearsalMark #'outside-staff-priority = #5000 + \once \override Score.RehearsalMark #'self-alignment-X = #LEFT + \once \override Score.RehearsalMark #'break-align-symbols = #'(key-signature) + \mark \markup { \bold "Senza denti" } + + % the hidden measure and bar line + \once \override Score.TimeSignature #'stencil = ##f + \time 1/16 + s16 \bar "" + + \time 4/4 + \once \override Score.RehearsalMark #'self-alignment-X = #LEFT + \once \override Score.RehearsalMark #'break-align-symbols = #'(bar-line) + \mark \markup { \box \bold "Intro" } + d'1 + \mark \default + d' +} -- 2.39.2