# Lilypond: \transpose syntax for an entire song

I am trying to transpose an entire song from B Flat Major to A Major. There is only one part for a "C" instrument. I have it tagged as "flute", but it could just as easily function with a C Melody saxophone, the melody line for a piano, etc. I have tried placing the command in my song in a number of places, but unless the syntax needs to be changed, there is only one place that I can get this to work:

    }

\transpose bf a { \flute }

\score {
\new Staff \with {
instrumentName = "Flute"
midiInstrument = "flute"
} \flute
\layout { }
\midi {
\tempo 4=80
}


The code above the first "}" is the music score.

My problem is that the music score gets transposed, but there is also an original non-transposed score that appears below the transposed score. What am I doing wrong? I am using Frescobaldi for entering most of the code.

• I'm a little bit confused with your question. \transpose bf a { c4 d e f } should work fine, so I'm assuming this isn't what you're looking for. Are you just trying to transpose a single line and only print that single line? – Richard Apr 15 '17 at 21:27

Your example produces two scores because that's what it contains.

The first \transpose command is a music expression, so it creates a score with the default clef, time signature, etc.

And the \score creates another score, (of course!) which doesn't specify any transposition, so you don't get any.

Presumably you didn't try the option which does work (I turned it into a complete working input file):

\version "2.18.2"
\include "english.ly"

flute = \relative c'' { bf c d ef f g a bf }

\score {
\new Staff \with {
instrumentName = "Flute"
midiInstrument = "flute"
}
\transpose bf a { \flute }
\layout { }
\midi {
\tempo 4=80
}
}


I don't use Frescobaldi, so I don't know if that won't let you create the correct input for some reason.

• Works fine on Frescobaldi for me! – Richard Apr 15 '17 at 23:23
• Errors: Processing /tmp/frescobaldi-kbdlnaun/tmpufygf22v/my_immortal.ly' Parsing... /tmp/frescobaldi-kbdlnaun/tmpufygf22v/my_immortal.ly:66:3: error: syntax error, unexpected MUSIC_FUNCTION \transpose bf a { \flute } /tmp/frescobaldi-kbdlnaun/tmpufygf22v/my_immortal.ly:71:1: error: syntax error, unexpected '}' } fatal error: failed files: "/tmp/frescobaldi-kbdlnaun/tmpufygf22v/my_immortal.ly" Exited with return code 1. – globetrotterdk Apr 16 '17 at 13:33
• The entire score is at lilybin.com/sj1qh2/2 – globetrotterdk Apr 16 '17 at 13:47

The solution that I found was the following:

    }

flutePart = \new Staff \with {
instrumentName = "Flute"
midiInstrument = "flute"
} \flute

\score {
<<
\transpose bf a \flutePart
>>
\layout { }
\midi {
\tempo 4=80
}
}


I am not sure why that works and other solutions don't, but this solution certainly works for me with Frescobaldi.

Here's another example:

\score {
<<
\new ChordNames {
\set chordChanges = ##t
\transpose e c { \harmonies }
}
\new PianoStaff {
<<
\new Voice = "voice" { \transpose e c { \melody } }
\new Lyrics \lyricsto "words" \text
\new Voice = "accordion" { \transpose e c { \harmony } }
>>
}
>>

\layout {
#(layout-set-staff-size 16)
}
\midi {
\tempo 4 = 125
}

}
`