lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Key signatures in MIDI output


From: mskala
Subject: Re: Key signatures in MIDI output
Date: Sat, 11 May 2024 08:40:13 -0400 (EDT)
User-agent: Alpine 2.20 (LNX 67 2015-01-07)

On Sat, 11 May 2024, Giles Boardman wrote:

> When I create MIDI output from Lilypond, if I have imported a MIDI file and
> then resaved it with changes made in LilyPond, the output is like that, too.

Lilypond as such does not import MIDI files.  I think you must be using
some piece of software other than Lilypond, and that is relevant to the
issues you're experiencing.

On the off chance that you might be using midi2ly, I tried round-tripping
my example code through that, and got suggestive results.

I take this code:

\score {
\new Voice {
  \key c \major
  c'4 d'4 e'4 f'4 |
  \key d \minor
  bes4 a4 g4 f4 |
}
\layout { }
\midi { }
}

and run it through Lilypond to get a MIDI file.  Then I take the resulting
MIDI file, which contains key changes at the marked locations, and run it
through midi2ly.  The result is a complicated mess, 74 lines long.  If I
run *that*, the midi2ly output, through Lilypond a second time to get a
PDF file, then the PDF file shows a D-minor key signature at the start of
each of the two bars, no C-major at all.

That seems like it could be relevant to the complaint of Lilypond losing
key changes.  It seems to come about because the control track in the MIDI
file translates into a silent voice in the midi2ly output, and that voice
has a D-minor key signature at the start which overrides the C-major key
signature in the other voice.  But it's an issue on *input*, in that
midi2csv is creating an unusual file structure, nothing to do with MIDI
output or the Lilypond program itself.

I think it's important to understand that Lilypond is not a MIDI file
editor.  MIDI files in Lilypond are treated as final output (much like PDF
files), not as an editable format.

To start with a MIDI file, "import" it with midi2ly, edit the resulting
Lilypond code, and then "resave" it with Lilypond, is not the usual
workflow and is likely to cause problems even if there is some technical
possibility of doing it.  "Importing" and "resaving" are not ordinarily
done with Lilypond.  The intended use of Lilypond is in a one-way flow
from ideas to *.ly source code to PDF or MIDI output, and the midi2ly
utility which creates an exception to that flow is intended only to be
used once, to produce a file parts of which can be cut and pasted into a
new Lilypond source file.  Repeated round-trips between MIDI and Lilypond
source format are asking for trouble.

Of course, you may not actually be using midi2ly at all, in which case the
above is irrelevant.  I'm only guessing based on your description of
"importing" a MIDI file, which stands out as an unusual (indeed,
impossible) thing to do with the main Lilypond program.

-- 
Matthew Skala
mskala@ansuz.sooke.bc.ca                 People before tribes.
https://ansuz.sooke.bc.ca/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]