[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: scheme function for transposition
From: |
Josiah Boothby |
Subject: |
Re: scheme function for transposition |
Date: |
Mon, 1 Jun 2009 10:48:33 -0700 |
> The only solution i know is to use the scheme equivalent of \transpose :
> ly:music-transpose
> But it is a bit harder...
>
> %%%%%%%%%%%%%%%%%%%%%%%%
>
> firstNotes = \relative c' { c4 d e f }
>
> first = #(define-music-function (parser location trans)(ly:music?)
> (let* (
> (trans-note (car (ly:music-property trans 'elements)))
> (trans-pitch (ly:music-property trans-note 'pitch))
> (delta-pitch (ly:pitch-diff trans-pitch (ly:make-pitch -1 0 0))))
> ;% (display delta-pitch)(newline)
> (ly:music-transpose (ly:music-deep-copy firstNotes) delta-pitch)
> ))
>
> \score {<<
> \new Staff \firstNotes \new Staff \first d \new Staff \first e
> >>
> }
>
> %%%%%%%%%%%%%%%%%%%%%%%
Thank you, this works well. I'm trying to understand what's going on
in the scheme code. Transposition normally takes the two pitch names
as parameters (e.g., \transpose c es \notes). Is the above code
something flexible enough that it could work with the first of those
being something other than c? (e.g., \transpose f g \notes)
Thanks again,
Josiah