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: Giles Boardman
Subject: Re: Key signatures in MIDI output
Date: Sat, 11 May 2024 13:14:39 +0000

Thank you for your efforts, Matt, and everyone else who has spent any time looking into this. 

To answer Matt, I did use Midi2ly by way of Frescobaldi and I must also have previously found a way to run a command line batch (if only a repetitive list) because I have way to many files to have done it manually and they don't have names I would have chosen.

I absolutely understand that LilyPond is not intended as a MIDI editor, but it's a pretty good one in a lot of ways. I am more productive on the MIDI side as well as the publishing side when using some of its features, hence my questions are about what LilyPond can and cannot do, rather than asking for it to do things it isn't intended for.

The scope of its intended use is also hard to limit! I just read a script that conditionally determines layout based on content, which is pretty advanced for a "mere" engraver!

I have now been more systematic in my approach and conclude that \key is not reflected in MIDI output. I tried various positions for events and in each case I got Time Signature information in my MID file but not Key Signature when viewed in Staff View. 

But the conclusive evidence  for me is that when I use MIDIDSM to create a TXT file the Time Sig event is missing.
I must have been mistaken in thinking I had seen the information in some output and not in other. 

My apologies.







From: mskala@ansuz.sooke.bc.ca <mskala@ansuz.sooke.bc.ca>
Sent: 11 May 2024 13:40
To: Giles Boardman <giles.boardman@hotmail.co.uk>
Cc: Hans Åberg <haberg-1@telia.com>; lilypond-user@gnu.org <lilypond-user@gnu.org>
Subject: Re: Key signatures in MIDI output
 
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.

reply via email to

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