Home
Random
Log in
Settings
About LilyPond wiki
LilyPond wiki
Search
Editing
Normalized \transposition
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
The \transposition command allows to typeset transposing parts. However, when multiple transposing instruments are used, one may want to normalize these transpositions to print the score in one single key. Here is how to achieve it. <lilypond version="2.24"> %% http://lsr.di.unimi.it/LSR/Item?id=697 %% see also http://lilypond.1069038.n5.nabble.com/LSR-v2-18-quot-Normalized-transposition-quot-does-not-compile-tc159368.html %LSR contributed by Jay Anderson http://lists.gnu.org/archive/html/lilypond-user/2008-06/msg00426.html %% see upraded version by David Kastrup on Feb. 15, 2014. %% "it might be worth just using quoted music for that: it automatically transforms itself into concert pitch." #(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 (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 {} } </lilypond> [[Category:Pitches]] [[Category:Scheme]] [[Category:Snippet]]
Summary:
Please note that all contributions to LilyPond wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Meta:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)