Left: | ||
Right: |
OLD | NEW |
---|---|
1 %%%% This file is part of LilyPond, the GNU music typesetter. | 1 %%%% This file is part of LilyPond, the GNU music typesetter. |
2 %%%% | 2 %%%% |
3 %%%% Copyright (C) 2011--2014 Graham Percival <graham@percival-music.ca> | 3 %%%% Copyright (C) 2011--2014 Graham Percival <graham@percival-music.ca> |
4 %%%% | 4 %%%% |
5 %%%% LilyPond is free software: you can redistribute it and/or modify | 5 %%%% LilyPond is free software: you can redistribute it and/or modify |
6 %%%% it under the terms of the GNU General Public License as published by | 6 %%%% it under the terms of the GNU General Public License as published by |
7 %%%% the Free Software Foundation, either version 3 of the License, or | 7 %%%% the Free Software Foundation, either version 3 of the License, or |
8 %%%% (at your option) any later version. | 8 %%%% (at your option) any later version. |
9 %%%% | 9 %%%% |
10 %%%% LilyPond is distributed in the hope that it will be useful, | 10 %%%% LilyPond is distributed in the hope that it will be useful, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 (ly:moment-main-denominator moment)))) | 59 (ly:moment-main-denominator moment)))) |
60 | 60 |
61 #(define (moment-grace->string moment) | 61 #(define (moment-grace->string moment) |
62 "Prints a moment without grace note(s) as a float such as | 62 "Prints a moment without grace note(s) as a float such as |
63 0.25000. Grace notes are written with the grace duration as a | 63 0.25000. Grace notes are written with the grace duration as a |
64 separate \"dashed\" number, i.e. 0.25000-0.12500. This allows any | 64 separate \"dashed\" number, i.e. 0.25000-0.12500. This allows any |
65 program using the output of this function to interpret grace notes | 65 program using the output of this function to interpret grace notes |
66 however they want (half duration, quarter duration? before beat, | 66 however they want (half duration, quarter duration? before beat, |
67 after beat? etc.)." | 67 after beat? etc.)." |
68 (if | 68 (if |
69 (zero? (ly:moment-grace-numerator moment)) | 69 (eq? 0 (ly:moment-grace-numerator moment)) |
dak
2017/03/22 10:24:21
Why this change for the worse? Numbers need to be
| |
70 (ly:format "~a" (format-moment moment)) | 70 (ly:format "~a" (format-moment moment)) |
71 ;; grace notes have a negative numerator, so no "-" necessary | 71 ;; grace notes have a negative numerator, so no "-" necessary |
72 (ly:format | 72 (ly:format |
73 "~a~a" | 73 "~a~a" |
74 (format-moment moment) | 74 (format-moment moment) |
75 (format-moment | 75 (format-moment |
76 (ly:make-moment | 76 (ly:make-moment |
77 (ly:moment-grace-numerator moment) | 77 (ly:moment-grace-numerator moment) |
78 (ly:moment-grace-denominator moment)))))) | 78 (ly:moment-grace-denominator moment)))))) |
79 | 79 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 (ly:event-property event 'duration)) | 119 (ly:event-property event 'duration)) |
120 (format-moment (ly:duration-length | 120 (format-moment (ly:duration-length |
121 (ly:event-property event 'duration))))) | 121 (ly:event-property event 'duration))))) |
122 | 122 |
123 #(define (format-note engraver event) | 123 #(define (format-note engraver event) |
124 (let* ((origin (ly:input-file-line-char-column | 124 (let* ((origin (ly:input-file-line-char-column |
125 (ly:event-property event 'origin)))) | 125 (ly:event-property event 'origin)))) |
126 (print-line engraver | 126 (print-line engraver |
127 "note" | 127 "note" |
128 ;; get a MIDI pitch value. | 128 ;; get a MIDI pitch value. |
129 (+ 60 (ly:pitch-semitones | 129 » » (+ 60 (ly:pitch-semitones |
Valentin Villenave
2014/10/17 06:40:23
AFAICS, .ly files use spaces, not tabs. Check the
| |
130 (ly:event-property event 'pitch))) | 130 (ly:event-property event 'pitch))) |
131 (ly:duration->string | 131 (ly:duration->string |
132 (ly:event-property event 'duration)) | 132 (ly:event-property event 'duration)) |
133 (format-moment (ly:duration-length | 133 (format-moment (ly:duration-length |
134 (ly:event-property event 'duration))) | 134 (ly:event-property event 'duration))) |
135 ;; point and click info | 135 ;; point and click info |
136 (ly:format "point-and-click ~a ~a" | 136 (ly:format "point-and-click ~a ~a" |
137 (caddr origin) | 137 (caddr origin) |
138 (cadr origin))))) | 138 (cadr origin))))) |
139 | 139 |
140 #(define (format-drumnote engraver event) | |
141 (let* ((origin (ly:input-file-line-char-column | |
142 (ly:event-property event 'origin)))) | |
143 (print-line engraver | |
144 "note" | |
Valentin Villenave
2014/10/17 06:40:24
Strictly speaking, this isn't a "note". "Drumnote"
dak
2017/03/22 10:24:21
Well, it's called "drum-type" so what about just "
| |
145 ;; get a drum name value. | |
146 (ly:event-property event 'drum-type) | |
147 (ly:duration->string | |
148 (ly:event-property event 'duration)) | |
149 (format-moment (ly:duration-length | |
150 (ly:event-property event 'duration))) | |
151 ;; point and click info | |
152 (ly:format "point-and-click ~a ~a" | |
153 (caddr origin) | |
154 (cadr origin))))) | |
155 | |
140 #(define (format-tempo engraver event) | 156 #(define (format-tempo engraver event) |
141 (print-line engraver | 157 (print-line engraver |
142 "tempo" | 158 "tempo" |
143 ; get length of quarter notes, in seconds | 159 ; get length of quarter notes, in seconds |
144 (/ (ly:event-property event 'metronome-count) | 160 (/ (ly:event-property event 'metronome-count) |
145 (format-moment (ly:duration-length (ly:event-property | 161 (format-moment (ly:duration-length (ly:event-property |
146 event | 162 event |
147 'tempo-unit)))))) | 163 'tempo-unit)))))) |
148 | 164 |
149 | 165 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 (text-script-event . format-text) | 234 (text-script-event . format-text) |
219 (slur-event . format-slur) | 235 (slur-event . format-slur) |
220 (breathing-event . format-breathe) | 236 (breathing-event . format-breathe) |
221 (dynamic-event . format-dynamic) | 237 (dynamic-event . format-dynamic) |
222 (crescendo-event . format-cresc) | 238 (crescendo-event . format-cresc) |
223 (decrescendo-event . format-decresc) | 239 (decrescendo-event . format-decresc) |
224 (text-span-event . format-textspan) | 240 (text-span-event . format-textspan) |
225 (glissando-event . format-glissando) | 241 (glissando-event . format-glissando) |
226 (tie-event . format-tie))) | 242 (tie-event . format-tie))) |
227 } | 243 } |
244 | |
245 \context { | |
246 \DrumVoice | |
247 \consists #(make-engraver | |
248 (listeners | |
249 (tempo-change-event . format-tempo) | |
250 (rest-event . format-rest) | |
251 (note-event . format-drumnote) | |
dak
2017/03/22 10:24:21
I don't think that having separate engravers for \
| |
252 (articulation-event . format-articulation) | |
253 (text-script-event . format-text) | |
254 (slur-event . format-slur) | |
255 (breathing-event . format-breathe) | |
256 (dynamic-event . format-dynamic) | |
257 (crescendo-event . format-cresc) | |
258 (decrescendo-event . format-decresc) | |
259 (text-span-event . format-textspan) | |
260 (glissando-event . format-glissando) | |
261 (tie-event . format-tie))) | |
262 } | |
228 } | 263 } |
OLD | NEW |