You are, of course, right. Your evidence is clear. The position of the \key 
command seems a strong candidate but I can't get it into the .MID even in the 
simplest of snippet.

As I mentioned I also have other behaviour I can't explain so it could also be 
version related. I reinstalled the latest version I could find before the 
release date of Windows 10, but it hasn't changed anything. I prefer to keep my 
music-related work on a Windows 8.1 machine but that can  change .

What I am trying to do is this:

I have a big "library" of small, simple tunes that are variables, named for 
their name and reference.
I have "compiled" the library and found errors, which I have corrected.
Now I can create medleys and audition them much more quickly than otherwise 
possible by referring to the pieces by their variable name.
Like this .....

\version "2.18.2"
% \include "C:\[lilify]\+progress\jukeboxpart1v2.ly"
% \include "C:\[lilify]\+progress\jukeboxpart2v1.ly"

"1K002-1a-_WILLIE_SHAW" = { \mark "1K002-1a-" \time 4/4 \key d\major { \time 
1/8 \partial 8  g''8 \time 4/4 fis''16 d''8. b'8. d''16 a'4 fis'4 fis'16 a'8. 
d''8. fis''16 g''16 e''8. e''8. g''16 fis''16 d''8. b'8. d''16 a'4 fis'4 \time 
7/8 fis'16 a'8. d''8. e''16 fis''16 d''8. d''8 \bar ":|." } }
\score {
{
\key d\major
\"1K002-1a-_WILLIE_SHAW"
}

 \layout { }

  \midi { }
}

or without the variable, but with the includes activated - the first one 
contains "1K002-1a-_WILLIE_SHAW" and its notes etc.


I have also explicitly pasted the notes into the score:

\version "2.18.2"
% \include "C:\[lilify]\+progress\jukeboxpart1v2.ly"
% \include "C:\[lilify]\+progress\jukeboxpart2v1.ly"

\score {

 { \mark "1K002-1a-" { \time 4/4 \key d\major \time 1/8 \partial 8  g''8 \time 
4/4 fis''16 d''8. b'8. d''16 a'4 fis'4 fis'16 a'8. d''8. fis''16 g''16 e''8. 
e''8. g''16 fis''16 d''8. b'8. d''16 a'4 fis'4 \time 7/8 fis'16 a'8. d''8. 
e''16 fis''16 d''8. d''8 \bar ":|." } }
}

 \layout { }

  \midi { }
}

With and without the braces and with and without my \time to mimic anacrusis 
for the benefit of Cakewalk - ideally, I'd like to hide them but haven't 
figured that out.

Lastly, I've taken all the \key and \time out of the explicit notes

\version "2.18.2"
% \include "C:\[lilify]\+progress\jukeboxpart1v2.ly"
% \include "C:\[lilify]\+progress\jukeboxpart2v1.ly"

\score {
\time 4/4
\key d\major
 { \mark "1K002-1a-" {  \partial 8  g''8  fis''16 d''8. b'8. d''16 a'4 fis'4 
fis'16 a'8. d''8. fis''16 g''16 e''8. e''8. g''16 fis''16 d''8. b'8. d''16 a'4 
fis'4 fis'16 a'8. d''8. e''16 fis''16 d''8. d''8 \bar ":|." } }
}

 \layout { }

  \midi { }
}

I read that SectionLabel and other marks are supported in MIDI output, but I 
can't get Section Label to work at all, and my \mark doesn't come through and 
neither does the default rehearsal mark, which appears in the layout. I've also 
failed in other attempts to get the same effect by other means (not necessarily 
for MIDI) like instrumentName =

Thanks again for your support.

________________________________
From: msk...@ansuz.sooke.bc.ca <msk...@ansuz.sooke.bc.ca>
Sent: 11 May 2024 15:46
To: Giles Boardman <giles.board...@hotmail.co.uk>
Cc: Hans Åberg <haber...@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:

> 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

Well, it definitely is reflected in the output in my own tests.  The
example code I posted, when run through Lilypond 2.24.1, produces a MIDI
file containing key change events.  There may be some relevant
distinctions in terms of which version of Lilypond you're running and
exactly where you put the \key commands in the input.

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

Reply via email to