2

I'm trying to do a MIDI export of existing Lilypond scores, but am unable to do so if there's more than one staff. I'm new to Lilypond but have been through the documentation and forums with no luck.

Wrapping the code below in \score doesn't work. If I take the first \relative c' section and delete everything after it, things appear to work fine, but I need the score in its entirety, including the paper and markup instructions.

Also tried \new Staff, as seen in some of the documentation, but ended up exactly where I started.

\score {

\header{
    title = "Exercise: C, D, E Notes"
}

\paper {
  #(set-paper-size "arch a" 'landscape)
  system-system-spacing #'basic-distance = #20
  markup-system-spacing #'basic-distance = #15
  indent = 0\cm
}

    \markup { \bold "Treble Clef - Right Hand" }
    \markup { \small Fingering }
\relative c' {
    \time 4/4
    \override Staff.TimeSignature #'style = #'() 
    \clef "treble"
    c4 c c c | d d d d | e e e e | e2 e | \break
    e4 e e e | d d d d | c c c c | c2 c  | \bar "|." \break
}


    \markup { \bold "Bass Clef - Left Hand" }
    \markup { \small Fingering }

\relative c, {
    \time 4/4
    \override Staff.TimeSignature #'style = #'() 
    \clef "bass"
    e4 e e e | d d d d | c c c c | c2 c  | \break
    e4 e e e | d d d d | c c c c | c2 c  | \bar "|."
}

  \layout { }
  \midi { }
}

\version "2.18.2"  % necessary for upgrading to future LilyPond versions.

1 Answers1

2

I would assign each of the little sections of music to individual variables and then create separate score blocks for each as well as a unique score block for midi output only:

\version "2.18.2"  % necessary for upgrading to future LilyPond versions.

\header{
    title = "Exercise: C, D, E Notes"
}

\paper{
    #(set-paper-size "arch a" 'landscape)
    system-system-spacing.basic-distance = #20
    markup-system-spacing.basic-distance = #15
    indent = 0\cm
}

mark_A = ^\markup { \bold "Treble Clef - Right Hand" }^\markup { \small Fingering }
mark_B = ^\markup { \bold "Bass Clef - Left Hand" }^\markup { \small Fingering }

music_A = \relative c' {
    \time 4/4
    \override Staff.TimeSignature #'style = #'() 
    \clef "treble"
    c4-\mark_A c c c | d d d d | e e e e | e2 e | \break
    e4 e e e | d d d d | c c c c | c2 c  | \bar "|." \break
}

music_B = \relative c, {
    \time 4/4
    \override Staff.TimeSignature #'style = #'() 
    \clef "bass"
    e4-\mark_B e e e | d d d d | c c c c | c2 c  | \break
    e4 e e e | d d d d | c c c c | c2 c  | \bar "|."
}


\score{
    \new Staff \music_A
    \layout{}
}


\score{
    \new Staff \music_B
    \layout{}
}

\score{
    \new Staff {\music_A \music_B}
    \midi{}
}

More info here: http://lilypond.org/doc/v2.19/Documentation/learning/multiple-staves

gilbertohasnofb
  • 1,984
  • 16
  • 28
  • 1
    Thanks. That helps me get closer (declaring mark_up and mark_down in particular). One key difference is that my intended score is two systems of treble clef only followed by two systems of bass clef only. Your fix results in two systems of grand staff. Any further help would be greatly appreciated. – Graham Porter Aug 21 '19 at 13:46
  • I see, I had misunderstood your original post. If you want two MIDI files, then the easiest way is to have two \score blocks. If you want a single MIDI file, then the trick will be to use separate \score blocks for MIDI and for layout. Let me know if you want one or two MIDI files and I will edit my answer. – gilbertohasnofb Aug 21 '19 at 16:45
  • 1
    I am looking for a single MIDI file in this case. Thanks. – Graham Porter Aug 22 '19 at 14:05
  • I have updated my answer, I hope this helps somehow – gilbertohasnofb Aug 22 '19 at 18:06
  • 1
    Exactly what I was looking for. Thanks! – Graham Porter Aug 23 '19 at 13:32