# Recognise anacrusis in MuseScore, from Lilypond's midi files

I generate midi files in LilyPond and import them into MuseScore for playback.

When there is an anacrusis in the piece, I use LilyPond's \partial command:

\version "2.21.0"
\score {
{
\time 4/4
\partial 4
%  0
a'8 b' |
%  1
c''4 4 4 c''8 b' |
%  2
a'4 4 4
\bar "||"
}
\layout {}
\midi {}
}


Compiling the code generates a midi file. Opening this file with MuseScore will render the score, and a "MIDI import panel" will also pop up. Several settings (such as "MuseScore instrument", "Max. Quantisation", etc.) can be adjusted, then clicking "Apply" will re-import the file.

The setting called:
"Recognise anacrusis" [English (GB)] / "Recognize pickup measure" [English (US)]
seems like it should be just what I need to get the anacrusis to render correctly, but it doesn't work. Whether selected or not, MuseScore continues to render the score as if there isn't an anacrusis.

LilyPonds \partial command apparently isn't effecting the midi file in a way that MuseScore understands.

I do know how to fix the anacrusis manually:

• Selecting everything, and Cutting,
• Right clicking the first measure and selecting "Bar Properties" / "Measure Properties",
• Changing the setting in "Bar Duration" / "Measure Duration" - "Actual" (e.g. from 4/4 to 1/4),
• Then Pasting everything back in.

This works, but is so tedious.

To get MuseScore's "Recognise anacrusis" setting to work, I need to change the LilyPond code:

I have to explicitly write a "bar" with a time signature that corresponds to the length of the anacrusis, and then set the real time signature for the first complete bar. (This makes the \partial command unnecessary.)

To get the pdf to look right, I also have to adjust their appearance of the time signature, and to set the first bar number to zero.

\version "2.21.0"
\score {
{
\time 1/4
\set Staff.timeSignatureFraction = 4/4
\set Score.currentBarNumber = #0
%  0
a'8 b' |
%  1
\time 4/4
c''4 4 4 c''8 b' |
%  2
a'4 4 4
\bar "||"
}
\layout {}
\midi {}
}


This does work; the code compiles, the pdf is accurate, and MuseScore can recognise the anacrusis. But my problems with this method are, that it isn't really right from a music theory perspective (it's not a bar of 1/4), and it's compromising my LilyPond code.

Why won't LilyPond's \partial command effect the midi file in a way that MuseScore's "Recognise anacrusis" setting will understand?

Is there a simpler way to get MuseScore to understand an anacrusis from LilyPond?

• My understanding from working with the Musescore program is that Musescore indeed does treat the anacrusis as a measure in 1/4 time, and you will need to work around this. musescore.org/en/handbook/3/measure-operations#properties displays how an anacrusis can get treated as a measure with a nominal duration matching the overall time signature but an actual duration of 1/4. Jan 29 at 16:27
• @Dekkadeci — That link shows documentation for the method suggested in the dot points of my question. But I think you're right: this is the only way that MuseScore can encode an anacrusis. Feb 5 at 9:31

Unfortunately LilyPond's \partial command doesn't actually encode the anacrusis into the midi file. This is because midi files don't even have a way to encode a "real" anacrusis.