lilypond-user
[Top][All Lists]
Advanced

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

scheme: troubles adding an octave...


From: Matthew Hanna
Subject: scheme: troubles adding an octave...
Date: Sun, 15 Apr 2007 21:20:14 -0400

As an exercise in learning to write lilypond scheme extensions, I've been trying to write a music-function that, given an EventChord or SequentialMusic, will return the passage in octaves, so c would return <c c,>.  I've run into a problem, though.

When I run the following:

\version "2.10.20"
\relative c' {
  \displayMusic <c' c,>
}
\relative c'' {
  \displayMusic <c c,>
}

While the music it generates is the same, the scheme it generates is different.  In the first case, the scheme pitches generated are:
(ly:make-pitch 0 0 0)
(ly:make-pitch -2 0 0)

But in the second case, it returns:
(ly:make-pitch -1 0 0)
(ly:make-pitch -2 0 0)

But the music it generates is the same.  This seems to conflict with the docs for ly:make-pitch as I understand it: " octave is specified by an integer, zero for the octave containing middle C."  It seems to somehow relate to the current relative pitch, not necessarily middle c.  Unless I don't understand how the doc is defining 'middle c'?

The problem I've hit is that, whenever I try to add the lower octave to the EventChord, I don't know whether to subtract the octave of the pitch passed in by 1 or 2 (or something else).  I've also tried using ly:pitch-transpose, but I wind up with the same result. 

Is there some other way that I can find the absolute pitch of the note?  Or some other approach I can use?


reply via email to

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