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: Fri, 10 May 2024 15:50:50 -0400 (EDT)
User-agent: Alpine 2.20 (LNX 67 2015-01-07)

On Fri, 10 May 2024, Hans Åberg wrote:

> Programs like ABC work so that one writes the music without accidentals,
> and then apply a key signature to get them. It was my reading that the
> OP asked for that.

Okay.  I didn't read it that way because the OP said he was getting
correct output in the PDF, and if he'd misunderstood the input format in
the way you describe, then the PDF would be wrong too.

But something else that occurred to me is that there may be a further
misunderstanding of MIDI format in play here:  MIDI never contains
"accidentals" at all.  It only contains note numbers.  In my example code:

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

The MIDI output will contain roughly this information:

key change, C major
note 60
note 62
note 64
note 65
key change, D minor
note 58
note 57
note 55
note 53

If some other software, reading the MIDI file, displays these as notes
with or without accidentals, and does or doesn't make the key-change
events visible, then that has very little to do with Lilypond, which only
generates the above data.  Note 60, for instance, might be a C or a
B-sharp.  Even if it is B-sharp, it might be displayed with or without a
sharp sign depending on whether there is one in the displayed key
signature.  The MIDI file does not contain that information; it is up to
whatever software reads the MIDI file, to display it appropriately.

-- 
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]