[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [LSR v2.18] "Normalized \transposition" does not compile
From: |
David Kastrup |
Subject: |
Re: [LSR v2.18] "Normalized \transposition" does not compile |
Date: |
Sat, 15 Feb 2014 23:20:27 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Pierre Perol-Schneider <address@hidden> writes:
> Dear Squad,
>
> The following snippet :
> http://lsr.dsi.unimi.it/LSR/Item?id=697
> Does not compile after a v.218 nor v2.16 upgrade.
> Originally made by Jay Anderson (see.
> http://lists.gnu.org/archive/html/lilypond-user/2008-06/msg00426.html)
> Last try for updating by Kieren MacMillan (see.
> http://lists.gnu.org/archive/html/lilypond-user/2013-01/msg00749.html)
>
> Terminal says :
> .../all/normalized--transposition.ly'
> .../all/normalized--transposition.ly:22:40: In procedure car in expression
> (car (ly:music-property key #)):
> .../all/normalized--transposition.ly:22:40: Wrong type (expecting pair): ()
Well, here is a working adaption:
%LSR contributed by Jay Anderson
http://lists.gnu.org/archive/html/lilypond-user/2008-06/msg00426.html
#(define (adjust-note mus key currkey)
(cond ((eq? (ly:music-property mus 'name) 'NoteEvent)
(ly:music-transpose mus (car currkey)))
((and
(eq? (ly:music-property mus 'name) 'PropertySet)
(eq? (ly:music-property mus 'symbol) 'instrumentTransposition))
(set-car! currkey (ly:music-property mus 'value))
(ly:music-set-property! mus 'value (ly:make-pitch 0 0 0))
mus)
(else mus)))
normalizeTransposition =
#(define-music-function (parser location key music) (ly:pitch? ly:music?)
(ly:music-transpose
(let ((currkey (list (ly:make-pitch 0 0 0))))
(music-map (lambda (x) (adjust-note x key currkey)) music))
(ly:pitch-negate key)))
music = \relative c' {
\time 4/4
\transposition f
c e g c |
\transposition ees
c, e g c |
\transposition d
c, e g c |
}
\score {
<<
\new Staff {
\music
}
\new Staff {
\normalizeTransposition f \music
}
>>
\layout {}
\midi {}
}
But it might be worth just using quoted music for that: it automatically
transforms itself into concert pitch.
--
David Kastrup