Yes, this fixes the problem!  By adding \layout {} inside my \score next to 
\midi I now get both outputs.  Thank you.


________________________________
From: William Rehwinkel
Sent: Sunday, May 12, 2024 9:22 PM
To: Peter Baughman; lilypond-user@gnu.org
Subject: Re: Can I output PNG and midi from the same file?

Dear Peter,

Assuming you wrote something like

% -----
\version "2.25.7"

\score {
   c'4
   \midi {}
}
% -----

and then ran lilypond --PNG midi.ly, then there would be no PNG output.
This is because if you only include the \midi block, then lilypond
produces no visual output at all. But if you don't include either
\layout or \midi then lilypond defaults to visual output only.

If you add \layout {} next to \midi {} then it should produce both
visual and midi output.

Thanks,
-William

On 5/12/24 23:21, Peter Baughman wrote:
> Greetings,
>
> I have a few .ly files that work great and produce lovely pictures when
> I build then with a command like:
>
> |lilypond --png my_song.ly|​
>
> I started to play around with midi output and was a little suprised to
> find that I needed to add a \midi code block to my file (instead of some
> other command-line flag when building) but this was not a big deal -
> After 20 or 30 minutes I figured out how to do it and got some lovely
> sound output.
>
> I was surprised, though to discover that when I built my songs they were
> no longer producing png output.
>
> Is there a way to get both PNG and midi output from the same .ly file,
> or do I need to invent some preprocessor step that adds a |\midi|​ block
> to a file or perhaps removes one from a file to get png output?
>
> Thank you,
> Pete Baughman

--
William Rehwinkel - Oberlin College and Conservatory '24

will...@williamrehwinkel.net

PGP key: https://ftp.williamrehwinkel.net/pubkey.txt

Reply via email to