From e8d93b89cb4e8c70404cf6213894fc606b69639e Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Sat, 28 Jun 2008 14:07:25 +0200 Subject: [PATCH] New function: \ottava #oct, replaces #(set-octavation oct) --- Documentation/es/user/pitches.itely | 6 ++-- Documentation/es/user/tweaks.itely | 8 +++--- Documentation/fr/user/pitches.itely | 14 ++++++------ Documentation/user/pitches.itely | 6 ++-- Documentation/user/tweaks.itely | 8 +++--- input/regression/backend-excercise.ly | 6 ++-- input/regression/clef-ottava.ly | 8 +++--- input/regression/line-dash-small-period.ly | 4 +- input/regression/ottava-broken.ly | 6 ++-- input/regression/ottava-edge.ly | 18 ++++++++-------- input/regression/ottava.ly | 30 ++++++++++++++-------------- ly/music-functions-init.ly | 7 +++++- python/convertrules.py | 8 ++++++- python/musicexp.py | 4 +- 14 files changed, 72 insertions(+), 61 deletions(-) diff --git a/Documentation/es/user/pitches.itely b/Documentation/es/user/pitches.itely index 0813a7a..ba4e733 100644 --- a/Documentation/es/user/pitches.itely +++ b/Documentation/es/user/pitches.itely @@ -918,14 +918,14 @@ de una octava para el pentagrama. @lilypond[verbatim,quote,ragged-right,fragment,relative=2] a'2 b -#(set-octavation 1) +\ottava #1 a b -#(set-octavation 0) +\ottava #0 a b @end lilypond -La función @code{set-octavation} también admite los valores -1 (para +La función @code{ottava} también admite los valores -1 (para 8va bassa), address@hidden(para 15ma) y -2 (para 15ma bassa) como argumentos. diff --git a/Documentation/es/user/tweaks.itely b/Documentation/es/user/tweaks.itely index 82aaf3b..b4e9b29 100644 --- a/Documentation/es/user/tweaks.itely +++ b/Documentation/es/user/tweaks.itely @@ -1777,7 +1777,7 @@ de ellos. % Place dynamics above staff \dynamicUp % Start Ottava Bracket -#(set-octavation 1) +\ottava #1 c' \startTextSpan % Add Dynamic Text c\pp @@ -1789,7 +1789,7 @@ c c % Add Dynamic Text c\ff c \stopTextSpan % Stop Ottava Bracket -#(set-octavation 0) +\ottava #0 c, c c c @end lilypond @@ -1842,7 +1842,7 @@ recordando que @code{OttavaBracket} se crea dentro del contexto de %Place following Ottava Bracket below Text Spanners \once \override Staff.OttavaBracket #'outside-staff-priority = #340 % Start Ottava Bracket -#(set-octavation 1) +\ottava #1 c' \startTextSpan % Add Dynamic Text c\pp @@ -1854,7 +1854,7 @@ c c % Add Dynamic Text c\ff c \stopTextSpan % Stop Ottava Bracket -#(set-octavation 0) +\ottava #0 c, c c c @end lilypond diff --git a/Documentation/fr/user/pitches.itely b/Documentation/fr/user/pitches.itely index 94f0f8e..65cd2db 100644 --- a/Documentation/fr/user/pitches.itely +++ b/Documentation/fr/user/pitches.itely @@ -669,7 +669,7 @@ Référence du programme : @rinternals{KeyCancellation}, Les marques d'octaviation, @emph{Ottava}, permettent d'introduire une transposition spécifique d'une octave pour la portée en cours. C'est -la fonction @code{set-octavation} qui s'en charge. +la fonction @code{ottava} qui s'en charge. @cindex ottava @cindex 15ma @@ -678,24 +678,24 @@ la fonction @code{set-octavation} qui s'en charge. @lilypond[quote,ragged-right,verbatim,fragment] \relative c''' { a2 b - #(set-octavation 1) + \ottava #1 a b - #(set-octavation 0) + \ottava #0 a b } @end lilypond -La fonction @code{set-octavation} peut aussi prendre en argument les +La fonction @code{ottava} peut aussi prendre en argument les valeurs address@hidden(pour 8va bassa), address@hidden(pour 15ma --- 2 octaves) ou address@hidden(pour 15ma bassa). En interne, cette fonction détermine les propriétés @code{ottavation} (p.ex. en @code{"8va"} ou @code{"8vb"}) et @code{centralCPosition}. Vous pouvez modifier le texte d'une marque d'octaviation en définissant @code{ottavation} aprÚs avoir fait appel -à @code{set-octavation} : +à @code{ottava} : @lilypond[quote,ragged-right,verbatim] { - #(set-octavation 1) + \ottava #1 \set Staff.ottavation = #"8" c''' } @@ -709,7 +709,7 @@ Référence du programme : @rinternals{OttavaBracket}. @knownissues address@hidden gÚre difficilement les changements de clé qui address@hidden gÚre difficilement les changements de clé qui pourraient intervenir alors qu'elle est effective. diff --git a/Documentation/user/pitches.itely b/Documentation/user/pitches.itely index e96bdb0..883d226 100644 --- a/Documentation/user/pitches.itely +++ b/Documentation/user/pitches.itely @@ -904,13 +904,13 @@ octave for the staff: @lilypond[verbatim,quote,relative=2] a'2 b -#(set-octavation 1) +\ottava #1 a b -#(set-octavation 0) +\ottava #0 a b @end lilypond -The @code{set-octavation} function also takes -1 (for 8va bassa), +The @code{ottava} function also takes -1 (for 8va bassa), address@hidden(for 15ma), and -2 (for 15ma bassa) as arguments. diff --git a/Documentation/user/tweaks.itely b/Documentation/user/tweaks.itely index 5914c6b..160053d 100644 --- a/Documentation/user/tweaks.itely +++ b/Documentation/user/tweaks.itely @@ -1753,7 +1753,7 @@ these. % Place dynamics above staff \dynamicUp % Start Ottava Bracket -#(set-octavation 1) +\ottava #1 c' \startTextSpan % Add Dynamic Text c\pp @@ -1765,7 +1765,7 @@ c c % Add Dynamic Text c\ff c \stopTextSpan % Stop Ottava Bracket -#(set-octavation 0) +\ottava #0 c, c c c @end lilypond @@ -1816,7 +1816,7 @@ that @code{OttavaBracket} is created in the @code{Staff} context: %Place following Ottava Bracket below Text Spanners \once \override Staff.OttavaBracket #'outside-staff-priority = #340 % Start Ottava Bracket -#(set-octavation 1) +\ottava #1 c' \startTextSpan % Add Dynamic Text c\pp @@ -1828,7 +1828,7 @@ c c % Add Dynamic Text c\ff c \stopTextSpan % Stop Ottava Bracket -#(set-octavation 0) +\ottava #0 c, c c c @end lilypond diff --git a/input/regression/backend-excercise.ly b/input/regression/backend-excercise.ly index 6848b4e..38e1179 100644 --- a/input/regression/backend-excercise.ly +++ b/input/regression/backend-excercise.ly @@ -2,7 +2,7 @@ texidoc = "Excercise all output functions" } -\version "2.11.38" +\version "2.11.50" \paper { ragged-right = ##t } @@ -10,9 +10,9 @@ \new StaffGroup \new PianoStaff << \new Staff { - #(set-octavation 1) + \ottava #1 \times 2/3 { c'8[\< f]( f''\!) } - #(set-octavation 0) + \ottava #0 4 \override TextScript #'color = #red diff --git a/input/regression/clef-ottava.ly b/input/regression/clef-ottava.ly index d01e6c9..c2a24a8 100644 --- a/input/regression/clef-ottava.ly +++ b/input/regression/clef-ottava.ly @@ -5,21 +5,21 @@ but they don't confuse one another." } -\version "2.11.36" +\version "2.11.50" \layout { ragged-right = ##t} \relative c'' { \clef "alto" a b c a - #(set-octavation 1) + \ottava #1 a b c a \clef "bass" a b c a - #(set-octavation 2) + \ottava #2 a b c a \clef "treble" - #(set-octavation -1) + \ottava #-1 a b c a } diff --git a/input/regression/line-dash-small-period.ly b/input/regression/line-dash-small-period.ly index 8bbb1cb..ac35c20 100644 --- a/input/regression/line-dash-small-period.ly +++ b/input/regression/line-dash-small-period.ly @@ -5,12 +5,12 @@ } -\version "2.11.29" +\version "2.11.50" \relative { \override Staff.OttavaBracket #'dash-period = #0.1 \override Score.OttavaBracket #'dash-fraction = #1 - #(set-octavation 1) + \ottava #1 c4 c } diff --git a/input/regression/ottava-broken.ly b/input/regression/ottava-broken.ly index 5c16a4a..5191450 100644 --- a/input/regression/ottava-broken.ly +++ b/input/regression/ottava-broken.ly @@ -10,16 +10,16 @@ the end of the line (regardless of prefatory matter). } -\version "2.10.0" +\version "2.11.50" \layout { ragged-right = ##t } \relative c''' { a2 b - #(set-octavation 1) + \ottava #1 a2 b \time 3/4 \break c''2. \break a - #(set-octavation 0) + \ottava #0 g,,2 b4 c2 a4 } diff --git a/input/regression/ottava-edge.ly b/input/regression/ottava-edge.ly index 314d5f9..bd8fdfe 100644 --- a/input/regression/ottava-edge.ly +++ b/input/regression/ottava-edge.ly @@ -4,7 +4,7 @@ texidoc = "Both edge heights of an ottava bracket can be specified." } -\version "2.11.45" +\version "2.11.50" \layout { ragged-right = ##t} @@ -12,30 +12,30 @@ \relative c''' { %standard ottavation - #(set-octavation 1) + \ottava #1 a b c - #(set-octavation 0) + \ottava #0 a %override the left edge height to produce standard text with a left edge - #(set-octavation 1) + \ottava #1 \once \override Staff.OttavaBracket #'edge-height = #'(1.2 . 1.2) a b c - #(set-octavation 0) + \ottava #0 a % Look! we can make them go up! - #(set-octavation 1) + \ottava #1 \once \override Staff.OttavaBracket #'edge-height = #'(-1 . -1) a b c - #(set-octavation 0) + \ottava #0 a % and have them go in different directions - #(set-octavation 1) + \ottava #1 \once \override Staff.OttavaBracket #'edge-height = #'(-1.2 . 1.2) a b c - #(set-octavation 0) + \ottava #0 a } diff --git a/input/regression/ottava.ly b/input/regression/ottava.ly index 3950eef..75a7d49 100644 --- a/input/regression/ottava.ly +++ b/input/regression/ottava.ly @@ -2,7 +2,7 @@ \header { texidoc = "Ottava brackets are supported, through the -use of the scheme function @code{set-octavation}. +use of the music function @code{\\ottava}. The spanner should go below a staff for 8va bassa, and the ottavation markup can be tuned with @code{Staff.ottavation}. @@ -10,7 +10,7 @@ markup can be tuned with @code{Staff.ottavation}. " } -\version "2.11.47" +\version "2.11.50" %% . There must be a minimum distance between the octavation line and the %% topmost staff line, taking into account the height of the closing @@ -36,33 +36,33 @@ markup can be tuned with @code{Staff.ottavation}. \relative c''' { a b c a - #(set-octavation 1) + \ottava #1 a b c a - #(set-octavation 0) - #(set-octavation 2) + \ottava #0 + \ottava #2 a b c a - #(set-octavation 0) - #(set-octavation -1) + \ottava #0 + \ottava #-1 a b c a - #(set-octavation 0) + \ottava #0 \break a, - #(set-octavation 1) + \ottava #1 \set Staff.ottavation = #"8" b - #(set-octavation 0) + \ottava #0 c a - #(set-octavation -1) + \ottava #-1 \set Staff.ottavation = \markup { \concat { 8 \tiny \raise #0.8 vb }} b a g - #(set-octavation 0) + \ottava #0 c - #(set-octavation -1) + \ottava #-1 \set Staff.ottavation = #"8" c,,16 - #(set-octavation 0) + \ottava #0 c'16 - #(set-octavation -1) + \ottava #-1 \set Staff.ottavation = #"8" g,,16 } diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index 129f6a3..1eeb6e5 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -438,7 +438,12 @@ octave = (make-music 'RelativeOctaveCheck 'origin location 'pitch (pitch-of-note pitch-note) - )) + )) + +ottava = #(define-music-function (parser location octave) (number?) + (_i "set the octavation ") + (make-ottava-set octave)) + partcombine = #(define-music-function (parser location part1 part2) (ly:music? ly:music?) (make-part-combine-music parser diff --git a/python/convertrules.py b/python/convertrules.py index 28577d9..a881e86 100644 --- a/python/convertrules.py +++ b/python/convertrules.py @@ -3064,4 +3064,10 @@ def conv (str): "\t(format-metronome-markup text dur count context)\n") return str -conversions.append (((2, 11, 50), conv, """metronomeMarkFormatter uses text markup as second argument""")) \ No newline at end of file +conversions.append (((2, 11, 50), conv, """metronomeMarkFormatter uses text markup as second argument""")) + +def conv (str): + str = re.sub (r"#\(set-octavation (-*[0-9]+)\)", r"\\ottava #\1", str) + return str + +conversions.append (((2, 11, 50), conv, """#(set-octavation oct) -> \ottava #oct""")) diff --git a/python/musicexp.py b/python/musicexp.py index c653c5c..705fcf2 100644 --- a/python/musicexp.py +++ b/python/musicexp.py @@ -901,10 +901,10 @@ class OctaveShiftEvent (SpanEvent): dir = self.ly_octave_shift_indicator () value = '' if dir: - value = '#(set-octavation %s)' % dir + value = '\ottava #%s' % dir return { -1: value, - 1: '#(set-octavation 0)'}.get (self.span_direction, '') + 1: '\ottava #0'}.get (self.span_direction, '') class TrillSpanEvent (SpanEvent): def ly_expression (self): -- 1.5.4.3