[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ottavation

From: address@hidden
Subject: Re: ottavation
Date: Wed, 6 Apr 2011 14:34:20 -0400

On Apr 6, 2011, at 9:26 AM, Peter O'Doherty wrote:

The code you sent applies \ottava #1 to the whole score, whereas I also have instances of 8vb and 15va etc. All I need is a way to change the property to print only 8 or 15 without va, vb etc. to save me typing \set Staff.ottavation = #"8" each time.

\score { \new Staff {
  \ottava #1
  %\set Staff.ottavation = #"8"
  \ottava #-1
  %\set Staff.ottavation = #"8"

\layout {
  \context { 
    % \Score ottavation=#"8" % this does not work
} }}

On 04/06/2011 01:51 PM, address@hidden wrote:
On Apr 6, 2011, at 7:22 AM, James Lowe wrote:

From: Peter O'Doherty [mailto:address@hidden] 
Sent: 06 April 2011 12:21
To: James Lowe
Subject: Re: ottavation

Thanks for your reply, James. My question wasn't very clear - there are numerous instances of ottava passages in the score, but not the whole score so \clef "treble_8" is not suitable. It's not the ottava instruction as such I want to use in the \layout { } but the format, i.e. just an "8" instead of "8va".

On Wed, Apr 6, 2011 at 12:27 PM, James Lowe <address@hidden> wrote:

)-----Original Message-----
)From: address@hidden
)[mailto:address@hidden] On
)Behalf Of Peter O'Doherty
)Sent: 06 April 2011 09:51
)To: lilypond-user
)Subject: ottavation
)How can I adjust \set Staff.ottavation = #"8" to include it in the layout
)section so it applies to the whole score?
Can't you just use

\clef "treble_8" in your score

Instead of using a \layout { } construct?

\score { \new Staff {
\relative c'' {
a b c d
\layout { \context { \Score ottavation=#"8" } }}

lilypond-user mailing list

Kinda kludgy, but it works!  Automating this type of truncating can likely become part of LilyPond for 2.15/2.16.  In the meantime, this should do the trick.

#(define (make-ottava-set-short music)
  (let ((octavation (ly:music-property music 'ottava-number)))

    (list (context-spec-music
            (lambda (context)
              (let ((offset (* -7 octavation))
                    (string (assoc-get octavation '((2 . "15")
                                                    (1 . "8")
                                                    (0 . #f)
                                                    (-1 . "8")
                                                    (-2 . "15")))))
                (set! (ly:context-property context 'middleCOffset) offset)
                (set! (ly:context-property context 'ottavation) string)
                (ly:set-middle-C! context))))

shortOttava = #(define-music-function (parser location octave) (integer?)
(make-music 'OttavaMusic 'ottava-number octave 'elements-callback make-ottava-set-short))

\score { \new Staff {
\relative c'' {
\shortOttava #1 a b c d \shortOttava #0 a b c d

reply via email to

[Prev in Thread] Current Thread [Next in Thread]