]> git.donarmstrong.com Git - lilypond.git/blob - input/lsr/changing-midi-output-to-one-channel-per-voice.ly
Merge branch 'master' into dev/texi2html
[lilypond.git] / input / lsr / changing-midi-output-to-one-channel-per-voice.ly
1 %% Do not edit this file; it is auto-generated from LSR http://lsr.dsi.unimi.it
2 %% This file is in the public domain.
3 \version "2.11.51"
4
5 \header {
6   lsrtags = "contexts-and-engravers, midi"
7
8   texidoc = "
9 When outputting MIDI, the default behavior is for each staff to
10 represent one MIDI channel, with all the voices on a staff amalgamated.
11 This minimizes the risk of running out of MIDI channels, since there
12 are only 16 available per track.
13
14 However, by moving the @code{Staff_performer} to the @code{Voice}
15 context, each voice on a staff can have its own MIDI channel, as is
16 demonstrated by the following example: despite being on the same staff,
17 two MIDI channels are created, each with a different
18 @code{midiInstrument}. 
19
20 "
21   doctitle = "Changing MIDI output to one channel per voice"
22 } % begin verbatim
23 \score {
24   \new Staff <<
25     \new Voice \relative c''' {
26       \set midiInstrument = #"flute"
27       \voiceOne
28       \key g \major
29       \time 2/2
30       r2 g-"Flute" ~
31       g fis ~
32       fis4 g8 fis e2 ~
33       e4 d8 cis d2
34     }
35     \new Voice \relative c'' {
36       \set midiInstrument = #"clarinet"
37       \voiceTwo
38       b1-"Clarinet"
39       a2. b8 a
40       g2. fis8 e
41       fis2 r
42     }
43   >>
44   \layout { }
45   \midi {
46     \context {
47       \Staff
48       \remove "Staff_performer"
49     }
50     \context {
51       \Voice
52       \consists "Staff_performer"      
53     }
54     \context {
55       \Score
56       tempoWholesPerMinute = #(ly:make-moment 72 2)
57     }
58   }
59 }