Is there a way/command-line option, to make LilyPond only compile the \midi {} output, even though there is a \layout {} block in the source.ly file?

Just been going through The Command Line Options in the Documentary and the only thing I can find for "midi" is the option to change the output file extension with:

midi-extension  "midi"  Set the default file extension for MIDI output file to given string.

1 Answer 1


You can add -dbackend null to your command, which will suppress the output of a printed score. Alternatively, you can use -dno-print-pages. A midi file will still be generated, as long as a \midi{} block is defined in your score.

So, you command should look like this:

lilypond -dbackend=null my_file.ly

Or like this:

lilypond -dno-print-pages my_file.ly

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.