[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: scheme: troubles adding an octave...
From: |
Carl Sorensen |
Subject: |
Re: scheme: troubles adding an octave... |
Date: |
Mon, 16 Apr 2007 01:53:02 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Matthew Hanna <mhanna <at> gmail.com> writes:
>
> 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.
I think the problem you're having is that you're displaying only part of the
music; the displayMusic is only operating on the chord which is inside the
relative music expression.
If you change your code as follows:
\version "2.10.20"
{{\displayMusic \relative c' {
<c' c,>
}
\displayMusic \relative c'' {
<c c,>
}}
}
You will then get the music expressions that include the RelativeMusic output:
(make-music
'RelativeOctaveMusic
'element
(make-music
'SequentialMusic
'elements
(list (make-music
'EventChord
'elements
(list (make-music
'NoteEvent
'duration
(ly:make-duration 2 0 1 1)
'pitch
(ly:make-pitch 1 0 0))
(make-music
'NoteEvent
'duration
(ly:make-duration 2 0 1 1)
'pitch
(ly:make-pitch 0 0 0)))))))
(make-music
'RelativeOctaveMusic
'element
(make-music
'SequentialMusic
'elements
(list (make-music
'EventChord
'elements
(list (make-music
'NoteEvent
'duration
(ly:make-duration 2 0 1 1)
'pitch
(ly:make-pitch 1 0 0))
(make-music
'NoteEvent
'duration
(ly:make-duration 2 0 1 1)
'pitch
(ly:make-pitch 0 0 0)))))))
And you can see that the pitches are the same in both expressions.
In your example, you were passing the displayMusic function just <c' c,> and <c
c,>, which are absolute pitches as far as the displayMusic function could tell.
Carl Sorensen