lilypond-user
[Top][All Lists]
Advanced

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

\transpose within a Scheme function?


From: Marcus Macauley
Subject: \transpose within a Scheme function?
Date: Thu, 19 Oct 2006 18:38:21 -0400
User-agent: Opera Mail/9.00 (Linux)

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




reply via email to

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