I'm trying to figure out how to include a Lilypond \transpose function within a Scheme function. I'm not even sure if it makes sense to do that, but I haven't thought of a better way. Here's an example of what I'm trying to do:

overtones = #(define-music-function (parser location numbers fundamental) (list? ly:music?)
; For each of the numbers in the given list,
(for-each (lambda (number)
            ; transpose the given fundamental by a certain amount,
            ; and append that new note to a list called "notes".
            (case number
; (Currently, it only checks for the first overtone, which is trivial.) ((1) (append notes (ly:export \transpose c c { $fundamental } ))))
          numbers)
)

This is incomplete, but eventually I want to be able to type something like:
\overtones #'(1 5 6) {b,,}

And have it return:
<\transpose c c {b,,} \transpose c e'' {b,,} \tranpspose c g'' {b,,}>

...i.e., the 1st, 5th, and 6th overtones of the given note.

The case function would be expanded to accomodate whichever overtones I wanted to be able to use (here, 1 5 and 6); the "notes" variable would be a list of notes (as \transpose functions) which I would then combine into a chord and export to Lilypond for inclusion in the score.

Hopefully I can figure out the rest, but can someone at least give me a tip on how to use the \tranpose function within Scheme (currently it complains that "transpose" is an "unbound variable"), or if there's a better way to do tranposition from within Scheme?

I also tried surrounding it with #{ #}, but then it complained about an "Unknown # object".

Thanks in advance,
Marcus


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to