]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/new/score-for-diatonic-accordion.ly
Imported Upstream version 2.18.2
[lilypond.git] / Documentation / snippets / new / score-for-diatonic-accordion.ly
1 \version "2.17.30"
2
3 \header {
4   lsrtags = "template, real-music, specific-notation"
5
6   texidoc = "
7 A template to write a score for a diatonic accordion.
8
9 - There is a horizontal staff indicating if the accordion must be
10 pushed (thick line) or pulled (thin line)
11
12 - There is a small rhythmic staff with lyrics that describes the bass
13 buttons to press. The bar lines are made from gridlines
14
15 - The tabulator staff for diatonic accordions shows the geographic
16 position of the buttons and not (as for every other instrument) the
17 pitch of the notes; the keys on the melody-side of the accordion are
18 placed in three columns and about 12 rows
19
20
21 In the tabulator staff notation the outermost column is described with
22 notes between lines, the innermost column is described with notes
23 between lines and a cross as accidental, and the middle column is
24 described with notes on a line, whereby the row in the middle is
25 represented on the middle line in the staff.
26
27
28 Some words to transpose piano notes to the diatonic accordion:
29
30
31 1. Every diatonic accordion is built for some keys only (for example,
32 for the keys of C major and F major), so it is important to transpose a
33 piano melody to match one of these keys. Transpose the source code, not
34 only the output because this code is required later on to translate it
35 once more to the tabulator staff. This can be done with the command
36 @code{displayLilyMusic}.
37
38
39 2. You have to alternate the push- and pull-direction of the accordion
40 regularly. If the player has a too long part to pull the accordion gets
41 broken. On the other hand, some harmonies are only available in one
42 direction. Considering this, decide which parts of the melody are the
43 push-parts and which the pull-parts.
44
45
46 3. For each pull- or push-part translate the piano notes to the
47 according tabulature representation.
48
49
50 This snippet comes with a useful optional macro for the jEdit text
51 editor.
52
53 "
54   doctitle = "Score for diatonic accordion"
55 }
56
57 verse = \lyricmode { Wie gross bist du! Wie gross bist du! }
58
59 harmonies = \new ChordNames \chordmode {
60   \germanChords
61   \set chordChanges = ##t
62   bes8 bes8 bes8
63   es2 f
64   bes1
65 }
66
67 NoStem = { \hide Stem }
68 NoNoteHead = \hide NoteHead
69 ZeroBeam = \override Beam.positions = #'(0 . 0)
70
71 staffTabLine = \new Staff \with {
72   \remove "Time_signature_engraver"
73   \remove "Clef_engraver"
74 } {
75   \override Staff.StaffSymbol.line-positions = #'(0)
76   % Shows one horizontal line. The vertical line (simulating a bar-line) is simulated with a gridline
77   \set Staff.midiInstrument = #"choir aahs"
78   \key c \major
79   \relative c''
80   {
81     % disable the following line to see the the noteheads while writing the song
82     \NoNoteHead
83     \override NoteHead.no-ledgers = ##t
84
85     % The beam between 8th-notes is used to draw the push-line
86     %How to fast write the push-lines:
87     %  1. write repeatedly 'c c c c c c c c |' for the whole length of the song
88     %  2. uncomment the line \NoNoteHead
89     %  3. compile
90     %  4. Mark the positions on which push/pull changes.
91     %     In the score-picture click on the position the push- or pull-part starts
92     %           (on the noteHead, the cursor will change to a hand-icon).
93     %     The cursor in the source code will jump just at this position.
94     %   a) If a push-part starts there, replace the 'c' by an 'e['
95     %   b) If a pull-part starts there, replace the 'c' by an 's'
96     %  5. Switch into 'overwrite-mode' by pressing the 'ins' key.
97     %  6. For the pull-parts overwrite the 'c' with 's'
98     %  7. For every push-part replace the last 'c' with 'e]'
99     %        8. Switch into 'insert-mode' again
100     %  9. At last it should look lik e.g. (s s e[ c | c c c c c c c c | c c c c c c e] s s)
101     % 10. re-enable the line \NoNoteHead
102     \autoBeamOff
103     \ZeroBeam
104     s8 s s e[ c c c c c c e] | s s s s s
105   }
106 }
107
108 %{
109 %}
110
111 % Accordion melody in tabulator score
112 % 1. Place a copy of the piano melody below
113 % 2. Separate piano melody into pull- and push-parts according to the staffTabLine you've already made
114 % 3. For each line: Double the line. Remark the 1st one (Keeps unchanged as reference) and then change the second line using the transformation paper
115 %    or the macros 'conv2diaton push.bsh' and 'conv2diaton pull.bsh'
116 % Tips:
117 % - In jEdit Search & Replace mark the Option 'Keep Dialog'
118
119 AccordionTabTwoCBesDur = {
120   % pull 1
121   %<f' bes'>8 <f' a'>8 <d' bes'>8 |
122   <g'' a''>8 <g'' b''>8 <e'' a''>8 |
123   % push 2
124   %<g' c''>4 <f' d''> <g' ees''> <f' a'> |
125   <g'' a''>4 <d'' eisis''> <g'' bisis''> <d'' f''> |
126   % pull 3
127   % <f' bes'>2 r8 }
128   <g'' a''>2 r8 }
129
130 AccordionTab= { \dynamicUp
131   % 1. Place a copy of the piano melody above
132   % 2. Separate piano melody into pull- and push-parts according to the staffTabLine you've already made
133   % 3. For each line: Double the line. Remark the 1st one (Keeps unchanged as reference) and then
134   %    change the second line using the transformation paper
135   % Tips:
136   % - In jEdit Search & Replace mark the Option 'Keep Dialog'
137   % -
138   \AccordionTabTwoCBesDur
139 }
140
141
142
143 \layout {
144   \context {
145     \Score
146     % The vertical line (simulating a bar-line) in
147     % the staffBassRhytm is a gridline
148     \consists "Grid_line_span_engraver"
149   }
150   \context {
151     \Staff
152     \consists "Grid_point_engraver"
153     gridInterval = #(ly:make-moment 4/4) % 4/4 - tact. How many beats per bar
154     % The following line has to be adjusted O-F-T-E-N.
155     \override GridPoint.Y-extent = #'(-2 . -21)
156   }
157   \context {
158     \ChoirStaff
159     \remove "System_start_delimiter_engraver"
160   }
161 }
162
163 staffVoice = \new Staff = astaffvoice  {
164   \time 4/4
165   \set Staff.instrumentName = "Voice"
166   \set Staff.midiInstrument = "voice oohs"
167   \key bes \major
168   \partial 8*3
169   \clef treble
170   {
171     \context Voice = "melodyVoi"
172     { <f' bes'>8 <f' a'>8 <d' bes'>8 | <g' c''>4 <f' d''> <g' es''> <f' a'> | <f' bes'>2 r8 }
173     \bar "|."
174   }
175 }
176
177 staffAccordionMel =
178 \new Staff  \with { \remove "Clef_engraver" } {
179   \accidentalStyle forget %Set the accidentals (Vorzeichen) for each note,
180   %do not remember them for the rest of the measure.
181   \time 4/4
182   \set Staff.instrumentName="Accordion"
183   \set Staff.midiInstrument="voice oohs"
184   \key c \major
185   \clef treble
186   { \AccordionTab \bar "|." }
187 }
188
189 AltOn =
190 #(define-music-function (parser location mag) (number?)
191   #{ \override Stem.length = #(* 7.0 mag)
192       \override NoteHead.font-size =
193 #(inexact->exact (* (/ 6.0 (log 2.0)) (log mag))) #})
194
195 AltOff = {
196   \revert Stem.length
197   \revert NoteHead.font-size
198 }
199
200 BassRhytm = {s4 s8 | c2 c2 | c2 s8 }
201 LyricBassRhythmI=  \lyricmode { c b | c }
202
203 staffBassRhytm =
204 \new Staff = staffbass \with { \remove "Clef_engraver" } {
205   % This is not a RhythmicStaff  because it must be possible to append lyrics.
206
207   \override Score.GridLine.extra-offset = #'( 13.0 . 0.0 ) % x.y
208   \override Staff.StaffSymbol.line-positions = #'( 0 )
209   % Shows one horizontal line. The vertical line (simulating a bar-line) is simulated by a grid
210   % Search for 'grid' in this page to find all related functions
211   \time 4/4
212   {
213     \context Voice = "VoiceBassRhytm"
214     \stemDown \AltOn #0.6
215     \relative c''
216     {
217       \BassRhytm
218     }
219     \AltOff
220     \bar "|."
221   }
222 }
223
224 \score {
225   \new ChoirStaff <<
226     \harmonies
227     \staffVoice
228     \context Lyrics = "lmelodyVoi"
229       \with { alignBelowContext = astaffvoice }
230       \lyricsto melodyVoi \verse
231     \staffAccordionMel
232     \staffTabLine
233     \staffBassRhytm
234     \context Lyrics = "lBassRhytmAboveI"
235       \with { alignAboveContext = staffbass }
236       \lyricsto VoiceBassRhytm \LyricBassRhythmI
237   >>
238 }
239 %}
240