Hello,
        I use lily a lot for transposing my score.
        Transposing is one of the borest tging in music (and I play a Bb instrument, 
so I know the problem).
        With lily the \transpose commande work fine but I often have B#, E#, and 
other boring note.
        I tied to use smart-transpose has describe in the smart-transpose.ly fille 
but the result is not what I whant.
        Is it possible (before 1.4, it would be great, but I understand that we must 
decided to stop at one moment :o) to have a command \smart-transpose, working 
like \transpose (and maybe \smart-transpose instead of \transpose, who like 
B# ? or Cx ?)
        If it's not possible to include this feature yet, I send one of my .ly file 
I'd like to transpose, if anyone can explain me how it work... I understand 
that I would normaly give me a .dvi with the same musique one transpose and 
the other not, but it's not what append... In fact, of course, I only want 
the transpose one :o)
        Thank's,        
                nemo. 
        
PS : Laurent, if you can make me an explanation in FRENCH !!! Ce serait 
vraiment cool... 
-- 
Olivier Guéry   [EMAIL PROTECTED]
\include "english.ly"
\header {
         "composer" = ""
         "title" = "Bb Minor Bulgar"
         }

#(define  (unhair-pitch p)
  (let* ((o (pitch-octave p))
         (a (pitch-alteration p))
         (n (pitch-notename p)))

    (cond
     ((and (> a 0) (or (eq? n 6) (eq? n 2)))
      (set! a (- a 1)) (set! n (+ n 1)))
     ((and (< a 0) (or (eq? n 0) (eq? n 3)))
      (set! a (+ a 1)) (set! n (- n 1))))

    (cond
     ((eq? a 2)  (set! a 0) (set! n (+ n 1)))
     ((eq? a -2) (set! a 0) (set! n (- n 1))))

    (if (< n 0) (begin (set!  o (- o 1)) (set! n (+ n 7))))
    (if (> n 7) (begin (set!  o (+ o 1)) (set! n (- n 7))))

    (make-pitch o n a)))

#(define (smart-transpose music pitch)
  (let* ((es (ly-get-mus-property music 'elements))
         (e (ly-get-mus-property music 'element))
         (p (ly-get-mus-property music 'pitch))
         (body (ly-get-mus-property music 'body))
         (alts (ly-get-mus-property music 'alternatives)))

    (if (pair? es)
        (ly-set-mus-property
         music 'elements
         (map (lambda (x) (smart-transpose x pitch)) es)))

    (if (music? alts)
        (ly-set-mus-property
         music 'alternatives
         (smart-transpose alts pitch)))

    (if (music? body)
        (ly-set-mus-property
         music 'body
         (smart-transpose body pitch)))

    (if (music? e)
        (ly-set-mus-property
         music 'element
         (smart-transpose e pitch)))

    (if (pitch? p)
        (begin
          (set! p (unhair-pitch (Pitch::transpose p pitch)))
          (ly-set-mus-property music 'pitch p)))

    music))


        
music = \notes  
        \relative c'
        {
          \time 2/4
          \key df \major
        \tempo 4=180
        \partial 8 
        f8
        \repeat "volta" 2 {
                [e8 f gf f] | [df a bf b] | c1(|)c4 r8 f8 |
                [e8 f gf f] | e8 df16 e \times 2/3 {df8 c bf} | c8 df( )df4( | )df4 r8 
f8 |
                [e8 f df' a] | [bf f gf d] | ef1 | gf4. f8 | [gf8 f e f] | [df' c f, 
c'] | 
        }
                \alternative { {bf1( | )b4 r8 f8} {bf4 a | af4. af8} } 
        
        \repeat "volta" 2 {
                df,8. f16 af8 df | [af8 f df ef] | f1 | r8 [af,8 bf c] |
                df8. f16 af8 df | [af8 f df ef] | gf4. ef16 f | \times 2/3 {gf8 f ef} 
\times 2/3 {df8 c bf} |
                af8. bf16 c8 df | [ef8 c bf' a] | a1 | g1 | \times 2/3 {gf8 f ef} 
\times 2/3 {bf'8 af gf} |
                \times 2/3 {ef' df c} bf8 c |
                }
                \alternative { {df1 | r8 af,8 bf c} {df8. df16 ef8 e | [f8 f, g a]} }

        \repeat "volta" 2 {
                b1 | r8 [a8 bf b] | c1( | )c1 | c1 | r8 c8 ef d | df1 | r8 [a8 bf f] | 
gf8 gf ef4 | r8 [a8 bf gf]
                f8 f df4 | r8 [df8 c bf] | [c df e f] | e8. df16 c8 df
                }
                \alternative {{bf1 | r8 [f'8 g a] }{bf1( | )b4. s8}} 
        }
\score {
     \notes \context Staff { 
     \transpose cs' \music
        \apply #(lambda (x) (smart-transpose x (make-pitch 0 5 1)))
        \music
}
\paper{
 \translator {
       \ScoreContext
       SpacingSpanner \override #'arithmetic-basicspace = #3
        }
}
\midi{}
}

Reply via email to