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

> Thanks. 
> 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.
> Thanks,
> Peter
> 
> \score { \new Staff {
>  {
> {
>   \ottava #1
>   %\set Staff.ottavation = #"8"
>   c''1
>   \ottava #-1
>   %\set Staff.ottavation = #"8"
>   c,1
> }
> 
> }}
> \layout { 
>   \context {  
>     % \Score ottavation=#"8" % this does not work
> } }}
> 
> 
> 
> 
> On 04/06/2011 01:51 PM, m...@apollinemike.com wrote:
>> 
>> On Apr 6, 2011, at 7:22 AM, James Lowe wrote:
>> 
>>> From: Peter O'Doherty [mailto:k.p.odohe...@gmail.com] 
>>> 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".
>>> Regards,
>>> Peter
>>> 
>>> On Wed, Apr 6, 2011 at 12:27 PM, James Lowe <james.l...@datacore.com> wrote:
>>> Hello,
>>> 
>>> )-----Original Message-----
>>> )From: lilypond-user-bounces+james.lowe=datacore....@gnu.org
>>> )[mailto:lilypond-user-bounces+james.lowe=datacore....@gnu.org] On
>>> )Behalf Of Peter O'Doherty
>>> )Sent: 06 April 2011 09:51
>>> )To: lilypond-user
>>> )Subject: ottavation
>>> )
>>> )Hi,
>>> )
>>> )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
>>> 
>>> http://lilypond.org/doc/v2.13/Documentation/notation/displaying-pitches#clef
>>> 
>>> Instead of using a \layout { } construct?
>>> 
>>> james
>> \score { \new Staff {
>> \relative c'' {
>> a b c d
>> }}
>> \layout { \context { \Score ottavation=#"8" } }}
>> 
>> Cheers,
>> MS
>> _______________________________________________
>> lilypond-user mailing list
>> lilypond-user@gnu.org
>> http://lists.gnu.org/mailman/listinfo/lilypond-user
>> 

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
           (make-apply-context
            (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))))
           'Staff))))


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
}}}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to