[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: \transposition normalized
From: |
Jay Anderson |
Subject: |
Re: \transposition normalized |
Date: |
Fri, 20 Jun 2008 16:50:10 -0700 |
Here's a little snippet which does what I want. If there's a standard
way to do this let me know.
-----Jay
\version "2.11.49"
#(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:pitch-negate (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:music? 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 (ly:music-property (car (ly:music-property key
'elements)) 'pitch))))
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 {}
}
On Thu, Jun 19, 2008 at 7:32 PM, Jay Anderson <address@hidden> wrote:
> If I have a section like:
>
> \relative c'
> {
> \time 4/4
> \transposition f
> c e g c |
> \transposition ees
> c, e g c |
> \transposition d
> c, e g c |
> }
>
> Is there an easy way to change it all to the same key for printing?
>
> Something like '\normalizeTransposition f \music' would be equivalent to:
>
> \relative c'
> {
> \time 4/4
> \transposition f
> c e g c |
> bes, d f bes |
> a, cis e a |
> }
>
> Thanks.
>
> -----Jay
>