1

When I am evoking lilypond in order to produce midi output, I comment in an empty midi block in the score block. Then, lilypond produces a midifile instead of a PDF file. I want to create both outputs simultaneously to be able to listen to the changes and see the changes in the pdf file. Is this possible? Commenting the midi block in and out becomes a bit cumbersome after a while, and an option to produce both outputs at the same time would help me a lot!

This is an example ly file to demonstrate my workflow:


\score {
  \midi {} % Commented out each time I want to produce PDF
  
  \new PianoStaff << 
    \new Staff {
      \key f \minor
      \mp
      \relative c''' {
        c
      }
    }

    \new Staff {
      \relative c {
       c
      }
    }
  >>
}

mutableVoid
  • 1,284
  • 2
  • 11
  • 29
  • 2
    Isn’t that a question of also including a `\layout` block? I’m sure it’s something simple. – Ole V.V. Aug 31 '22 at 19:12
  • 2
    While I still think that including a `\layout` block works, what I usually do is having two master `.ly` files for PDF and midi respectively and just `\include`ing the same music material in both. – Ole V.V. Aug 31 '22 at 19:45
  • Thanks @OleV.V. this does the trick: I added a layout{} block in the score block and it produces both outputs :) – mutableVoid Aug 31 '22 at 20:05
  • I am sorry to read that, I really appreciate your help and I hope that the mods in question stop with that behavior. I posted your suggestion as an answer and will mark it accepted tomorrow when it's possible. – mutableVoid Sep 01 '22 at 07:56

1 Answers1

2

As Ole V.V suggested in his comment, it is possible to create both outputs simultaneously by adding a layout block in the score block as follows:


\score {
  \midi {} % Commented out each time I want to produce PDF
  
  \layout{} % Adding this does the trick, thanks to Ole V.V's comment

  \new PianoStaff << 
    \new Staff {
      \key f \minor
      \mp
      \relative c''' {
        c
      }
    }

    \new Staff {
      \relative c {
       c
      }
    }
  >>
}
mutableVoid
  • 1,284
  • 2
  • 11
  • 29