Yes. You essentially create two scores (use \score twice). In one you do whatever needs to be done for printing (and possibly omit \midi{}) and in the other you omit \layout{} but add all stuff for midi like adding click tracks/voices, unfolding repeats, apply articulation etc
BTW: The same technique is used to create special practice files for voices (e.g. with the practice voice being somewhat emphasised etc for those not wanting to manipulate the midi files) Best wishes Michael Mobil gesendet > Am 03.01.2025 um 07:32 schrieb David R <davidandrewrog...@gmail.com>: > > > Hello > > I'd like to make my midi file with a metronome sound or click track, but for > this part to be completely absent from the PDF. I'd also prefer to avoid > custom-made solutions if I can, because of their tendency to "rot" as new > versions of Lilypond make them obsolete. Can I just add an ordinary > percussion part that sounds but is prevented from being printed? > > -- > Thanks > David Rogers