3

My lilypond snippet generates a score, containing a glissando (slide from one pitch to another) correctly. It generates a midi file, but it doesn't sound like a slide from one pitch to another. It sounds like 2 distinct pitches. My instrument is set to violin.

What is the correct way to generate glissando in midi file?

\version "2.18.2"
\include "articulate.ly"


\score {
  \articulate
  <<
  \new Staff {
    \set Staff.midiInstrument = #"violin"

    \relative a' {
      a4 \glissando d
    }
  }
  >>  
  \layout { }
  \midi { }

}
Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129
john ware
  • 153
  • 1
  • 8

2 Answers2

1

LilyPond unfortunately does not support glissandi in its MIDI output.

gilbertohasnofb
  • 1,984
  • 16
  • 28
1

LilyPond can't produce a midi glissando automatically, (even in the latest version 2.23), but you can make one manually:

The trick is to use seperate score blocks for the pdf and midi, and to use tags that are filtered out of these blocks (with \removeWithTag).

\version "2.18.2"
\include "articulate.ly"

contents = {
    <<
        \new Staff {
            \set Staff.midiInstrument = #"violin"
            \relative a' {
                \tag #'pdfonly {
                    a4 \glissando^\markup{\italic"gliss."} d r2 |
                }
                \tag #'midionly {
                    \tuplet 5/4 {a16 ais b c cis} d4 r2 |
                }
            }
        }
    >>  
}

% PDF
\score {
    \removeWithTag #'midionly
    \contents
    \layout { }
}

% MIDI
\score {
    \removeWithTag #'pdfonly
    \articulate
    \contents
    \midi { }
}

  • I've used a \tuplet to fit in all of the discrete pitches between the notes. A really glissando will not be discrete but this is as good as you can get with a midi.

  • I've also moved the \articulate.ly script into the midi block. It makes sense to apply this script the midi, but it messes up the pdf.

Elements in Space
  • 253
  • 1
  • 3
  • 12