From 8377992f4bbc88a888eebe08dcf9bd3161f7bfe2 Mon Sep 17 00:00:00 2001 From: Keith OHara Date: Fri, 13 May 2011 17:27:23 -0700 Subject: [PATCH] MIDI: default midiChannelMapping to 'staff Fix issue 1648, with regtest --- Documentation/changes.tely | 6 +++--- input/regression/midi-notes.ly | 21 +++++++++++++++++++ input/regression/midi/key-initial.ly | 8 ++++++- input/regression/midi/key-option.ly | 8 ++++++- input/regression/midi/lyrics-addlyrics.ly | 8 ++++++- input/regression/midi/partcombine.ly | 8 ++++++- input/regression/midi/quantize-duration-2.ly | 8 ++++++- input/regression/midi/quantize-duration.ly | 8 ++++++- input/regression/midi/quantize-start.ly | 8 ++++++- input/regression/midi/rest.ly | 8 ++++++- input/regression/midi/staff-map-instrument.ly | 5 ++--- input/regression/midi/staff-map-voice.ly | 2 +- input/regression/midi/voice-2.ly | 8 ++++++- input/regression/midi/voice-4.ly | 8 ++++++- input/regression/midi/voice-5.ly | 8 ++++++- ly/performer-init.ly | 2 +- 16 files changed, 105 insertions(+), 19 deletions(-) create mode 100644 input/regression/midi-notes.ly diff --git a/Documentation/changes.tely b/Documentation/changes.tely index b180ec54e5..150f603288 100644 --- a/Documentation/changes.tely +++ b/Documentation/changes.tely @@ -115,9 +115,9 @@ Lilypond now engraves woodwind fingering charts. @item MIDI output has been improved @itemize @bullet -@item voices are kept separated, which makes the MIDI file much more useful for postprocessing -@item optimal channel distribution: identical instruments share the same channel. This means that e.g. for a full orchestral score there are always 16 (15 plus percussion) diffently sounding instruments available, unrestricted by the number of staves or voices. -@item @code{\set Score.midiChannelMapping = #'staff} assigns one MIDI channel per staff, previously the default behavior. This setting is required if you want instrument changes to create MIDI program changes on a single MIDI channel. +@item the option @code{\set Score.midiChannelMapping = #'voice} puts each voice on its own midi MIDI channel +@item the option @code{\set Score.midiChannelMapping = #'instrument} puts identical instruments on the same MIDI channel. This means that e.g. for a full orchestral score there are always 16 (15 plus percussion) differently sounding instruments available, unrestricted by the number of staves or voices. (Some MIDI players will cut off notes, however, if two voices play the same pitch simultaneously on the same channel.) This option also stores each voice in a separate track in the MIDI file. +@item the default, @code{\set Score.midiChannelMapping = #'staff}, assigns one MIDI channel per staff. This setting allows instrument changes (implemented as MIDI program changes) to re-use single MIDI channel. @item dynamics are now rendered as note velocities, no longer as midi volume. This improves the sound on [high end] midi renderers. @end itemize diff --git a/input/regression/midi-notes.ly b/input/regression/midi-notes.ly new file mode 100644 index 0000000000..bb6dbe7f46 --- /dev/null +++ b/input/regression/midi-notes.ly @@ -0,0 +1,21 @@ +\header { + + texidoc = "A MIDI note-off event precedes a simultaneous note-on event +for the same pitch in the same MIDI channel, so that all notes are heard. +Run @code{timidity -idvvv file.midi |grep Midi} to see midi events." + +} + +\version "2.12.0" + +\score { + << + \new Staff << + {r4 g' r2 | r2 a'4 r } \\ + {g'4 r r2 | r2 r4 a' } + >> + \new Staff { r2 g'2 | a'2 r2 } + >> + \midi {} + \layout {} +} diff --git a/input/regression/midi/key-initial.ly b/input/regression/midi/key-initial.ly index f4cbcb77b0..4a169cbfd9 100644 --- a/input/regression/midi/key-initial.ly +++ b/input/regression/midi/key-initial.ly @@ -1,5 +1,5 @@ % Lily was here -- automatically converted by ../../../scripts/midi2ly.py from out/initial-key.midi -\version "2.13.53" +\version "2.13.54" \layout { \context { @@ -10,6 +10,12 @@ \consists "Completion_rest_engraver" } } +\midi { + \context { + \Score + midiChannelMapping = #'instrument + } +} % included from ./out/initial-key.header \header { diff --git a/input/regression/midi/key-option.ly b/input/regression/midi/key-option.ly index 044251bc2b..50b2cb388a 100644 --- a/input/regression/midi/key-option.ly +++ b/input/regression/midi/key-option.ly @@ -1,5 +1,5 @@ % Lily was here -- automatically converted by ../../../scripts/midi2ly.py from out-www/option-key.midi -\version "2.13.53" +\version "2.13.54" \layout { \context { @@ -10,6 +10,12 @@ \consists "Completion_rest_engraver" } } +\midi { + \context { + \Score + midiChannelMapping = #'instrument + } +} % included from ./out-www/option-key.header \header { diff --git a/input/regression/midi/lyrics-addlyrics.ly b/input/regression/midi/lyrics-addlyrics.ly index c8a08e4479..97d688ff38 100644 --- a/input/regression/midi/lyrics-addlyrics.ly +++ b/input/regression/midi/lyrics-addlyrics.ly @@ -1,5 +1,5 @@ % Lily was here -- automatically converted by ../../../scripts/midi2ly.py from out/initial-key.midi -\version "2.13.53" +\version "2.13.54" \layout { \context { @@ -10,6 +10,12 @@ \consists "Completion_rest_engraver" } } +\midi { + \context { + \Score + midiChannelMapping = #'instrument + } +} % included from ./out/initial-key.header \header { diff --git a/input/regression/midi/partcombine.ly b/input/regression/midi/partcombine.ly index dd5a38b12c..1bfed81a13 100644 --- a/input/regression/midi/partcombine.ly +++ b/input/regression/midi/partcombine.ly @@ -1,4 +1,4 @@ -\version "2.13.53" +\version "2.13.54" \layout { \context { @@ -9,6 +9,12 @@ \consists "Completion_rest_engraver" } } +\midi { + \context { + \Score + midiChannelMapping = #'instrument + } +} \header { texidoc="Partcombined music is preserved" diff --git a/input/regression/midi/quantize-duration-2.ly b/input/regression/midi/quantize-duration-2.ly index 1944b2d4ae..faaff0de89 100644 --- a/input/regression/midi/quantize-duration-2.ly +++ b/input/regression/midi/quantize-duration-2.ly @@ -1,5 +1,5 @@ % Lily was here -- automatically converted by out/bin/midi2ly from /home/janneke/testmidi.mid -\version "2.13.53" +\version "2.13.54" \layout { \context { @@ -10,6 +10,12 @@ \consists "Completion_rest_engraver" } } +\midi { + \context { + \Score + midiChannelMapping = #'instrument + } +} \header { texidoc="midi2ly @code{--duration-quant} preserves first note length (16)" diff --git a/input/regression/midi/quantize-duration.ly b/input/regression/midi/quantize-duration.ly index 051f7c96b5..f7fe531676 100644 --- a/input/regression/midi/quantize-duration.ly +++ b/input/regression/midi/quantize-duration.ly @@ -1,5 +1,5 @@ % Lily was here -- automatically converted by ../../../scripts/midi2ly.py from out-www/voice-2.midi -\version "2.13.53" +\version "2.13.54" \layout { \context { @@ -10,6 +10,12 @@ \consists "Completion_rest_engraver" } } +\midi { + \context { + \Score + midiChannelMapping = #'instrument + } +} % included from ./out-www/voice-2.header \header { diff --git a/input/regression/midi/quantize-start.ly b/input/regression/midi/quantize-start.ly index 708d57918e..d2e8f100b8 100644 --- a/input/regression/midi/quantize-start.ly +++ b/input/regression/midi/quantize-start.ly @@ -1,5 +1,5 @@ % Lily was here -- automatically converted by ../../../scripts/midi2ly.py from out-www/voice-2.midi -\version "2.13.53" +\version "2.13.54" \layout { \context { @@ -10,6 +10,12 @@ \consists "Completion_rest_engraver" } } +\midi { + \context { + \Score + midiChannelMapping = #'instrument + } +} % included from ./out-www/voice-2.header \header { diff --git a/input/regression/midi/rest.ly b/input/regression/midi/rest.ly index 4013296015..372ded5c96 100644 --- a/input/regression/midi/rest.ly +++ b/input/regression/midi/rest.ly @@ -1,5 +1,5 @@ % Lily was here -- automatically converted by ../../../scripts/midi2ly.py from out-www/rest.midi -\version "2.13.53" +\version "2.13.54" \layout { \context { @@ -10,6 +10,12 @@ \consists "Completion_rest_engraver" } } +\midi { + \context { + \Score + midiChannelMapping = #'instrument + } +} % included from ./out-www/rest.header \header { diff --git a/input/regression/midi/staff-map-instrument.ly b/input/regression/midi/staff-map-instrument.ly index 8d90c9d29f..10011a7a0a 100644 --- a/input/regression/midi/staff-map-instrument.ly +++ b/input/regression/midi/staff-map-instrument.ly @@ -1,4 +1,4 @@ -\version "2.13.53" +\version "2.13.54" \header { texidoc="Midi2ly remaps voices correctly to staves in MIDI-files that use instrument<->channel mapping when combined with voice<->track mapping. TODO: pianostaff" @@ -9,8 +9,7 @@ options="" %% TODO:PIANOSTAFF \context PianoStaff << << \context Staff = "treble" << - %% the default - %% \set Score.midiChannelMapping = #'instrument + \set Score.midiChannelMapping = #'instrument \context Voice="one" \relative c'' { \time 4/4 \key c \minor diff --git a/input/regression/midi/staff-map-voice.ly b/input/regression/midi/staff-map-voice.ly index ea4583652d..4e4cfc0024 100644 --- a/input/regression/midi/staff-map-voice.ly +++ b/input/regression/midi/staff-map-voice.ly @@ -1,4 +1,4 @@ -\version "2.13.53" +\version "2.13.54" \header { texidoc="Midi2ly remaps voices correctly to staves in MIDI-files that use voice<->channel mapping when combined with staff<->track mapping. TODO: pianostaff" diff --git a/input/regression/midi/voice-2.ly b/input/regression/midi/voice-2.ly index 63d6c0581f..383764b097 100644 --- a/input/regression/midi/voice-2.ly +++ b/input/regression/midi/voice-2.ly @@ -1,5 +1,5 @@ % Lily was here -- automatically converted by ../../../scripts/midi2ly.py from out-www/voice-2.midi -\version "2.13.53" +\version "2.13.54" \layout { \context { @@ -10,6 +10,12 @@ \consists "Completion_rest_engraver" } } +\midi { + \context { + \Score + midiChannelMapping = #'instrument + } +} % included from ./out-www/voice-2.header \header { diff --git a/input/regression/midi/voice-4.ly b/input/regression/midi/voice-4.ly index a615933e67..1c71d09221 100644 --- a/input/regression/midi/voice-4.ly +++ b/input/regression/midi/voice-4.ly @@ -1,5 +1,5 @@ % Lily was here -- automatically converted by ../../../scripts/midi2ly.py from out-www/voice-4.midi -\version "2.13.53" +\version "2.13.54" \layout { \context { @@ -10,6 +10,12 @@ \consists "Completion_rest_engraver" } } +\midi { + \context { + \Score + midiChannelMapping = #'instrument + } +} % included from ./out-www/voice-4.header \header { diff --git a/input/regression/midi/voice-5.ly b/input/regression/midi/voice-5.ly index 297e39f9fa..17ab81a0ba 100644 --- a/input/regression/midi/voice-5.ly +++ b/input/regression/midi/voice-5.ly @@ -1,5 +1,5 @@ % Lily was here -- automatically converted by ../../../scripts/midi2ly.py from out-www/voice-4.midi -\version "2.13.53" +\version "2.13.54" \layout { \context { @@ -10,6 +10,12 @@ \consists "Completion_rest_engraver" } } +\midi { + \context { + \Score + midiChannelMapping = #'instrument + } +} % included from ./out-www/voice-5.header \header { diff --git a/ly/performer-init.ly b/ly/performer-init.ly index 1b9e18665a..6e0deaf976 100644 --- a/ly/performer-init.ly +++ b/ly/performer-init.ly @@ -137,7 +137,7 @@ melismaBusyProperties = #default-melisma-properties instrumentName = #"bright acoustic" - midiChannelMapping = #'instrument + midiChannelMapping = #'staff %% quarter = 60 tempoWholesPerMinute = #(ly:make-moment 15 1) -- 2.39.2