lilypond-user
[Top][All Lists]
Advanced

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

Re: multi-instrument parts


From: Kieren MacMillan
Subject: Re: multi-instrument parts
Date: Fri, 18 Jan 2013 09:40:24 -0500

Hi Jay,

This doesn't Do The Right Thing™ when the key signatures are abstracted, e.g.,

\version "2.17.10"

#(define (adjust-note mus key currkey)
(cond ((or
         (eq? (ly:music-property mus 'name) 'NoteEvent)
         (eq? (ly:music-property mus 'name) 'KeyChangeEvent))
        (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: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)))

global = {
  \time 4/4
  \key c \major
  s1
  \key d \major
  s1
  \key e \major
  s1
}

music = \relative c' {
  \transposition f
  c4 e g c |
  \transposition ees
  c, e g c |
  \transposition g
  c, e g c |
}

\score {
  <<
    \new Staff << \global \music >>
    \new Staff \normalizeTransposition c' << \global \music >>
  >>
}

Any way to easily fix that? If so, this would be a killer solution to my 
multi-instrumentalist problem.

Thanks!
Kieren.


reply via email to

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