Jump to content

Remove named chords from MIDI output: Difference between revisions

From LilyPond wiki
Import snippet from LSR
 
m New category
 
(2 intermediate revisions by 2 users not shown)
Line 7: Line 7:
Note that the working part of the snippet is not visible in the generated score. This is as should be, since this is only about MIDI behaviour.
Note that the working part of the snippet is not visible in the generated score. This is as should be, since this is only about MIDI behaviour.


<lilypond version="2.24.0">
<lilypond version="2.24">
%% http://lsr.di.unimi.it/LSR/Item?id=783
%% http://lsr.di.unimi.it/LSR/Item?id=783


Line 33: Line 33:
[[Category:Midi]]
[[Category:Midi]]
[[Category:Chords]]
[[Category:Chords]]
[[Category:Snippet]]

Latest revision as of 23:27, 21 November 2025

When using a \new Chordnames {} section, chords will be included in MIDI output. When chord names are only included to ease reading but should not sound, possibly because they are already included in the score, this is a problem.

The sound can be changed using \set Chordnames.midiInstrument = "(whatever)", but cannot be removed by using a non-existent instrument: Lilypond will default to acoustic grand in such a case.

The solution is to act at the MIDI level instead of the Chordnames: remove the MIDI performer used for that specific voice.

Note that the working part of the snippet is not visible in the generated score. This is as should be, since this is only about MIDI behaviour.

\version "2.24"

%% http://lsr.di.unimi.it/LSR/Item?id=783

\score {
  <<
  \new ChordNames {
    \chordmode {
      d:min
    }
  }
  \new Staff {
    d'4 f'4 a'4 d''4
  }
  >>
  \layout {
  }  
  \midi {
    \context { 
      \ChordNames \remove Note_performer 
    }
  }
}