9

I am trying to make Lilypond create a MIDI output file whose name corresponds song title, but I didn't succeed so far. Maybe someone can help?

From the Lilypond notation reference (https://lilypond.org/doc/v2.20/Documentation/notation/creating-output-file-metadata):

For each type of output file, only the \header definitions of blocks that define separate files of that type, and blocks higher in the block hierarchy, will be consulted. Therefore, [...] for MIDI files, all headers above or at the \score level are used.

Here is my code:

\music = { \relative c'4 d e f}

\bookpart {
  \header {
    title = "my Title"
  }
  \score {
    \music
    \midi { }
  }
}

I expected to get a midi file named my Title.midi, but instead, I get a file whose name is the name of the lilypond file (so if myLilypondFile.ly, then myLilypondFile.midi).

From the same source:

The title variable sets also the sequence name for MIDI. The midititle variable can be used to set the sequence name independently of the value used for typeset output.

So I tried adding midititle to my existing header:

\header {
    title = "my Title"
    midititle = "my midi Title"
}

but it did not change anything. It seems the midititle variable isn't even known (I use Frescobaldi and it does not syntax highlight that variable).

My lilypond file is version 2.20.0 and I have also installed GNU lilypond 2.20.0.

4
  • May I ask how that would help you? For me, getting myLilypondFile.midi out of myLilypondFile.ly sounds very reasonable (apart from myLilypondFile being a very unhelpful file name). I don't even think Lilypond can put things into arbitrarily named files. Btw. "sequence name" is a name stored within the MIDI. Some MIDI players, like timidity, will show it while playing, some (most?) will not.
    – Ramillies
    Sep 6 at 20:21
  • 1
    Don't put too much stock into whether Frescobaldi recognizes things like "midititle". The syntax highlighting sometimes lags behind the latest version, and somethings are just missing.
    – ksnortum
    Sep 7 at 13:30
  • @Ramillies My file contains several songs and I want to create midi files for each of them in order to check if I wrote the scores correctly. Standard behaviour is the creation of myLilypondFile.midi, myLilypondFile-1.midi, myLilypondFile-2.midi and so on. But with this, it is hard to find the right file for a certain song.
    – Kjara
    Sep 8 at 19:12
  • @Kjara: Then I would tell you to use \bookOutputSuffix (which would change the -1, -2 etc. to something else -- one use could be mySong-soprano.midi, mySong-alto.midi etc.), but the answer below is more universal.
    – Ramillies
    Sep 8 at 19:17
11

You're on the right track for sheet music title and midi file title, but you should use \bookOutputName to control the resulting filename:

\header {
  title = "File title"
  midititle = "midi title"
}
music = \relative c' {
  c1
}
\book {
  \bookOutputName "pdf_file_only"
  \score {
    \new Staff \music
  \layout {}
  }
}
\book {
  \bookOutputName "midi_file_only"
  \score {
    \new Staff \music
  \midi {}
  }
}

enter image description here enter image description here

1
  • Wow, I knew about \bookOutputSuffix but I didn't know (or think) this would exist...
    – Ramillies
    Sep 7 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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