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