lilypond-user
[Top][All Lists]
Advanced

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

Re: scheme function for transposition


From: Gilles THIBAULT
Subject: Re: scheme function for transposition
Date: Mon, 1 Jun 2009 11:27:49 +0200



   \transpose c $trans { \firstNotes }
<string>:2:17: error: syntax error, unexpected MUSIC_IDENTIFIER,
expecting NOTENAME_PITCH or TONICNAME_PITCH

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
 >>
}

%%%%%%%%%%%%%%%%%%%%%%%

Gilles






reply via email to

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