]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/replacing-default-midi-instrument-equalization.ly
Run makelsr
[lilypond.git] / Documentation / snippets / replacing-default-midi-instrument-equalization.ly
1 % DO NOT EDIT this file manually; it is automatically
2 % generated from Documentation/snippets/new
3 % Make any changes in Documentation/snippets/new/
4 % and then run scripts/auxiliar/makelsr.py
5 %
6 % This file is in the public domain.
7 %% Note: this file works from version 2.18.0
8 \version "2.18.0"
9
10 \header {
11
12   lsrtags = "scheme-language, midi"
13
14   texidoc = "The default MIDI instrument equalizer can be replaced by
15   setting the @code{instrumentEqualizer} property in the @code{Score}
16   context to a user-defined Scheme procedure that uses a MIDI instrument
17   name as its argument along with a pair of fractions indicating the
18   minimum and maximum volumes respectively to be applied to that
19   specific instrument.
20
21   The following example sets the minimum and maximum volumes for flute
22   and clarinet respectively."
23
24   doctitle = "Replacing default MIDI instrument equalization"
25 } % begin verbatim
26
27
28 #(define my-instrument-equalizer-alist '())
29
30 #(set! my-instrument-equalizer-alist
31   (append
32     '(
33       ("flute" . (0.7 . 0.9))
34       ("clarinet" . (0.3 . 0.6)))
35     my-instrument-equalizer-alist))
36
37 #(define (my-instrument-equalizer s)
38   (let ((entry (assoc s my-instrument-equalizer-alist)))
39     (if entry
40       (cdr entry))))
41
42 \score {
43   <<
44     \new Staff {
45       \key g \major
46       \time 2/2
47       \set Score.instrumentEqualizer = #my-instrument-equalizer
48       \set Staff.midiInstrument = #"flute"
49       \new Voice \relative c''' {
50         r2 g\mp g fis~
51         4 g8 fis e2~
52         4 d8 cis d2
53       }
54     }
55     \new Staff {
56       \key g \major
57       \set Staff.midiInstrument = #"clarinet"
58       \new Voice \relative c'' {
59         b1\p a2. b8 a
60         g2. fis8 e
61         fis2 r
62       }
63     }
64   >>
65   \layout { }
66   \midi {  }
67 }