lilypond-user
[Top][All Lists]
Advanced

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

Re: GDP: NR 1.1 Pitches vastly improved, more comments sought


From: Mats Bengtsson
Subject: Re: GDP: NR 1.1 Pitches vastly improved, more comments sought
Date: Mon, 21 Jan 2008 12:36:32 +0100
User-agent: Thunderbird 2.0.0.5 (X11/20070716)



Graham Percival wrote:
On Mon, 21 Jan 2008 11:24:22 +0100
Mats Bengtsson <address@hidden> wrote:

Graham Percival wrote:
Some sections have been completely rewritten (particularly Octave
check).  Please read the new Pitches section and send comments.
- The text in "Octave corrections and checks" is contradictory.

Whoops!  My initial impression of these commands was completely
incorrect; after creating the example shown on the page, I
realized my mistake and fixed them... but apparently not
everywhere.

As far as I can see, the true difference between the two
commands is that the
octave correction is specified as a attribute to the note itself in the input, whereas
  the octave check is a separate "command" to be inserted between
notes in the input.
Both have the same effect of correcting the octave (not the pitch, right?) if it's wrong.

Not true; with = the d's octave is changed; with \octave the d's
octave is not changed.
No! The difference is that = modifies the pitch on the current note, whereas
the \octave changes the pitch first on the note after the command, i.e.
\octave d' d is the same as d='


- The transposing-pitches-with-minimum-accidentals-smart-transpose.ly LSR example,
  included in "Transpose" didn't work, since the internal
representation for
alterations has changed between 2.10 and 2.11. I have just tried to submit a 2.11 version to LSR, but since it doesn't compile in 2.10, I'm not sure it
  was accepted in the LSR database. I'll send it by email otherwise.

Please send it to me.  (I've complained to Valentin about this,
but if you already have the solution, great)

Attached! (It's not the most beautiful solution,but it should work.)
 /Mats
\version "2.11.33"
#(define  (naturalise-pitch p)
  (let* ((o (ly:pitch-octave p))
         (a (* 4 (ly:pitch-alteration p))) 
    ; alteration, a, in quarter tone steps, for historical reasons
         (n (ly:pitch-notename p)))

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

    (cond
     ((> a 2) (set! a (- a 4)) (set! n (+ n 1)))
     ((< a -2) (set! a (+ a 4)) (set! n (- n 1))))

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

    (ly:make-pitch o n (/ a 4))))

#(define (naturalise music)
  (let* ((es (ly:music-property music 'elements))
         (e (ly:music-property music 'element))
         (p (ly:music-property music 'pitch)))

    (if (pair? es)
        (ly:music-set-property!
         music 'elements
         (map (lambda (x) (naturalise x)) es)))

    (if (ly:music? e)
        (ly:music-set-property!
         music 'element
         (naturalise e)))

    (if (ly:pitch? p)
        (begin
          (set! p (naturalise-pitch p))
          (ly:music-set-property! music 'pitch p)))

    music))

music =  \relative c' { c4 d  e f g a b  c }

naturaliseMusic =
#(define-music-function (parser location m)
                                        (ly:music?)
                        (naturalise m))

\score {
   \new Staff {
     \transpose c ais \music
     \naturaliseMusic \transpose c ais \music 
    \break
    \transpose c deses \music
    \naturaliseMusic \transpose c deses \music
  }
  \layout { ragged-right = ##t}
}


reply via email to

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