Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
LilyPond wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Flexible Transposing a whole score
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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!
This code shows how to transpose a whole score by changing one single piece of code. In the code the Scheme function <code>MyTranspose</code> is defined. If you use it in every <code>Voice</code>, you can transpose the whole score just by setting the arguments to the <code>\transpose</code> call within the function definition. As you see in the example this works with transposed voices as well (in the example I've written the Bb-Trumpet pitches as they sound, so they have to be additionaly transposed by <code>\transpose bes c' {...}</code>). To see the original pitches, you may disable the <code>MyTranspose</code> function by redefining <code>MyTranspose = {}</code>, as shown in the lower part of the snippet. <lilypond version="2.24.0" full> %% http://lsr.di.unimi.it/LSR/Item?id=787 %here starts the snippet: global = { \time 4/4 } MyTranspose = #(define-music-function (m) (ly:music?) #{ \transpose f d $m #}) % In the previous line the transposition of the whole score is defined % (in this case from f major down to d major). \markup "Transposed from F to D" % To deactivate the transposition remove the comment sign from the % following line: %MyTranspose = {} Basekey = { \key f \major } FltPitches = \relative c'' { c d bes c } TrpPitches = \relative c'' { c d bes c } Flt = \new Voice { \set Staff.instrumentName = #"Flute" \MyTranspose { \Basekey \FltPitches } } Trp = \new Voice \transpose bes c' { \set Staff.instrumentName = #"Trumpet" \MyTranspose { \Basekey \TrpPitches } } \score { \new StaffGroup { << \new Staff { << \global \Flt >> } \new Staff { << \global \Trp >> } >> } \layout {} } % End of the example % ============================================================= % The remainder is just for visualisation the deactivation of the % transposition in a single snippet. You don't need this code in % normal use... \markup "The same without transposition:" MyTranspose = {} % The remainder is just a copy of the corresponding lines above: Flt = \new Voice { \set Staff.instrumentName = #"Flute" \MyTranspose { \Basekey \FltPitches } } Trp = \new Voice \transpose bes c' { \set Staff.instrumentName = #"Trumpet" \MyTranspose { \Basekey \TrpPitches } } \new StaffGroup << \new Staff << \global \Flt >> \new Staff << \global \Trp >> >> \paper { tagline = ##f } </lilypond> [[Category:Pitches]] [[Category:Template]]
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)
Search
Search
Editing
Flexible Transposing a whole score
Add topic