]> git.donarmstrong.com Git - lilypond.git/blob - input/regression/accidental-voice.ly
patch::: 1.5.43.rz1: 1.5.43.rz1
[lilypond.git] / input / regression / accidental-voice.ly
1 \version "1.5.43.rz1"
2
3 \header{
4 texidoc="
5 This shows how modern cross voice auto cautionary accidentals are handled.
6 The first two fisses get accidentals because they belong to different voices.
7 The first f gets cautionary natural because of previous measure.
8 The last f gets cautionary natural because fis was only in the other voice.
9 "
10 }
11
12 #(define  (lo-octave p)
13   (let* ((a (pitch-alteration p))
14          (n (pitch-notename p)))
15     (make-pitch -1 n a)))
16
17 #(define (no-octaves music)
18   (let* ((es (ly-get-mus-property music 'elements))
19          (e (ly-get-mus-property music 'element))
20          (p (ly-get-mus-property music 'pitch)))
21
22     (if (pair? es)
23         (ly-set-mus-property
24          music 'elements
25          (map no-octaves es)))
26
27     (if (music? e)
28         (ly-set-mus-property
29          music 'element
30          (no-octaves e)))
31
32     (if (pitch? p)
33         (begin
34           (set! p (lo-octave p))
35           (ly-set-mus-property music 'pitch p)))
36
37
38     music))
39
40 voicea = \notes \transpose c'' {
41     \stemUp
42     fis2 a2 f4 fis a2
43 }
44 voiceb = \notes \transpose c'' {
45     \stemDown
46     c2 fis2  f4 c   f2
47 }
48
49 \score {
50     <
51         \notes
52         \context NoteNames=namesa \apply #no-octaves \voicea
53         \context Staff < 
54             \modernVoiceCautionaries
55             \context Voice = voicea \voicea
56             \context Voice = voiceb \voiceb
57         >
58         \context NoteNames=namesb \apply #no-octaves \voiceb
59     >
60 }