1 ;;;; fret-diagrams.scm --
3 ;;;; source file of the GNU LilyPond music typesetter
5 ;;;; (c) 2004 Carl D. Sorensen <c_sorensen@byu.edu>
7 (define ly:paper-lookup ly:output-def-lookup) ; compat for 2.3, remove when using 2.2
8 (define my-font-encoding 'TeX-text )
10 (define (fret-parse-marking-list marking-list fret-count)
11 (let* ((fret-range (list 1 fret-count))
16 (let parse-item ((mylist marking-list))
17 (if (not (null? mylist))
18 (let* ((my-item (car mylist)) (my-code (car my-item)))
20 ((or (eq? my-code 'open)(eq? my-code 'mute))
21 (set! xo-list (cons* my-item xo-list)))
23 (set! barre-list (cons* (cdr my-item) barre-list)))
24 ((eq? my-code 'place-fret)
25 (set! dot-list (cons* (cdr my-item) dot-list))))
26 (parse-item (cdr mylist)))))
27 ; calculate fret-range
28 (let ((maxfret 0) (minfret 99))
29 (let updatemax ((fret-list dot-list))
32 (let ((fretval (second (car fret-list))))
33 (if (> fretval maxfret) (set! maxfret fretval))
34 (if (< fretval minfret) (set! minfret fretval))
35 (updatemax (cdr fret-list)))))
36 (if (> maxfret fret-count)
37 (set! fret-range (list minfret
38 (let ((upfret (- (+ minfret fret-count) 1)))
39 (if (> maxfret upfret) maxfret upfret)))))
40 ; subtract fret from dots
41 (set! dot-list (subtract-base-fret (- (car fret-range) 1) dot-list)))
42 (acons 'fret-range fret-range
43 (acons 'barre-list barre-list
44 (acons 'dot-list dot-list
45 (acons 'xo-list xo-list '()))))))
47 (define (subtract-base-fret base-fret dot-list)
48 "Subtract @var{base-fret} from every fret in @var{dot-list}"
51 (let ((this-list (car dot-list)))
52 (cons* (list (car this-list) (- (second this-list) base-fret) (if (null? (cddr this-list))
55 (subtract-base-fret base-fret (cdr dot-list))))))
57 (define (draw-strings string-count fret-range th size)
58 "Draw the strings (vertical lines) for a fret diagram with @var{string-count} strings and frets as indicated
59 in @var{fret-range}. Line thickness is given by @var{th}, fret & string spacing by @var{size}. "
60 (let* ((fret-count (+ (- (cadr fret-range) (car fret-range)) 1))
61 (sl (* (+ fret-count 1) size))
63 (half-thickness (* sth 0.5))
65 (string-stencil (ly:make-stencil (list 'draw-line sth 0 0 0 sl)
66 (cons (- half-thickness) half-thickness)
67 (cons (- half-thickness) (+ sl half-thickness)))))
68 (if (= string-count 1)
70 (ly:stencil-combine-at-edge
71 (draw-strings (- string-count 1) fret-range th size) X RIGHT
75 (define (draw-fret-lines fret-count string-count th size)
76 "Draw @var{fret-count} frets (horizontal lines) for a fret diagram with @var{string-count} strings.
77 Line thickness is given by @var{th}, fret & string spacing by @var{size}. "
78 (let* ((fret-length (* (- string-count 1) size))
80 (half-thickness (* sth 0.5))
82 (fret-line (ly:make-stencil (list 'draw-line sth half-thickness size (- fret-length half-thickness) size)
84 (cons (- size half-thickness) (+ size half-thickness)))))
87 (ly:stencil-combine-at-edge fret-line Y UP
88 (draw-fret-lines (- fret-count 1) string-count th size)
91 (define (draw-thick-top-fret props string-count th size)
92 "Draw a thick top fret for a fret diagram whose base fret is not 1."
93 (let* ((sth (* th size))
94 ; (top-fret-thick (* sth (chain-assoc-get 'top-fret-thickness props 3.0)))
95 (top-fret-thick (* sth 3.0))
96 ; (top-half-thick (* top-fret-thick 0.5))
97 (half-thick (* sth 0.5))
99 (x2 (+ half-thick (* size (- string-count 1))))
101 (y2 (+ top-fret-thick half-thick))
102 (x-extent (cons (- x1) x2))
103 (y-extent (cons 0 y2)))
104 (ly:make-stencil (list 'round-filled-box x1 x2 y1 y2 sth)
108 (define (draw-frets paper props fret-range string-count th size)
109 "Draw the frets (horizontal lines) for a fret diagram with @var{string-count} strings and frets as indicated
110 in @var{fret-range}. Line thickness is given by @var{th}, fret & string spacing by @var{size}. "
111 (let* ((fret-count (+ (- (cadr fret-range) (car fret-range)) 1))
112 (fret-length (* (- string-count 1) size))
113 (half-thickness (* th 0.5))
114 (base-fret (car fret-range)))
115 (ly:stencil-combine-at-edge
116 (draw-fret-lines fret-count string-count th size) Y UP
118 (draw-thick-top-fret props string-count th size)
119 (draw-fret-lines 1 string-count th size))
123 (define (centered-stencil stencil)
124 "Center stencil @var{stencil} in both the X and Y directions"
125 (let* ((output-stencil stencil))
126 ; (if (= (cadr (ly:version)) 3)
128 (ly:stencil-align-to! output-stencil Y 0)
129 (ly:stencil-align-to! output-stencil X 0)
131 ; (ly:stencil-align-to (ly:stencil-align-to text-stencil X 0) Y 0))))
133 (define (draw-dots paper props string-count fret-range size finger-code dot-position dot-radius dot-list)
134 "Make dots for fret diagram."
135 (let* ((scale-dot-radius (* size dot-radius))
136 (dot-color (chain-assoc-get 'dot-color props 'black))
137 ; (finger-xoffset (chain-assoc-get 'finger-xoffset props -0.25))
138 ; (finger-yoffset (chain-assoc-get 'finger-yoffset props (- size)))
139 (finger-xoffset -0.25)
140 (finger-yoffset (- size))
141 ; (dot-label-font-mag (* scale-dot-radius (chain-assoc-get 'dot-label-font-mag props 1.0)))
142 (dot-label-font-mag scale-dot-radius)
143 ; (string-label-font-mag (* size (chain-assoc-get 'label-font-mag props 0.7)))
144 (string-label-font-mag (* size 0.7))
145 (fret-count (+ (- (cadr fret-range) (car fret-range) 1)))
146 (mypair (car dot-list))
147 (restlist (cdr dot-list))
148 (xpos (* size (- string-count (car mypair))))
149 ;TODO -- figure out what 4 is and get rid of it
151 (ypos (* size (+ 4 (- fret-count (cadr mypair) dot-position ))))
152 (extent (cons (- scale-dot-radius) scale-dot-radius))
153 (finger (caddr mypair))
154 (finger (if (number? finger) (number->string finger) finger))
155 (string-label-font (ly:paper-get-font paper `(((font-family . sans)(font-encoding . ,my-font-encoding)(font-series . medium) (font-shape . upright)
156 (font-size . ,(stepmag string-label-font-mag))))))
157 (dot-label-font (ly:paper-get-font paper `(((font-family . sans)(font-encoding . ,my-font-encoding)(font-series . medium) (font-shape . upright)
158 (font-size . ,(stepmag dot-label-font-mag))))))
159 (dotstencil (if (eq? dot-color 'white)
161 (ly:make-stencil (list 'white-dot 0 0 scale-dot-radius) extent extent))
162 (ly:make-stencil (list 'dot 0 0 scale-dot-radius ) extent extent)))
163 (positioned-dot (ly:stencil-translate-axis
164 (ly:stencil-translate-axis dotstencil xpos X)
167 (if (or (eq? finger '())(eq? finger-code 'none))
169 (if (eq? finger-code 'in-dot)
170 (let* ((dot-proc (if (eq? dot-color 'white) 'white-dot 'dot)))
172 (ly:stencil-translate-axis
173 (ly:stencil-translate-axis
174 (if (eq? dot-color 'white)
175 (centered-stencil (fontify-text dot-label-font finger))
176 (centered-stencil (fontify-text-white dot-label-font-mag
177 dot-label-font finger)))
180 (ly:stencil-translate-axis
181 (ly:stencil-translate-axis
182 (ly:make-stencil (list dot-proc 0 0 scale-dot-radius) extent extent)
185 (if (eq? finger-code 'below-string)
188 (ly:stencil-translate-axis
189 (ly:stencil-translate-axis
190 (centered-stencil (fontify-text string-label-font finger)) xpos X)
191 (* size finger-yoffset) Y))
197 (draw-dots paper props string-count fret-range size finger-code
198 dot-position dot-radius restlist)
199 labeled-dot-stencil))))
201 (define (draw-xo paper props string-count fret-range size xo-list)
202 "Put open and mute string indications on diagram, as contained in @var{xo-list}."
203 (let* ((fret-count (+ (- (cadr fret-range) (car fret-range) 1)))
204 ; (xo-font-mag (* size (chain-assoc-get 'xo-font-magnification props 0.5)))
205 (xo-font-mag (* size 0.5))
206 ; (xo-horizontal-offset (* size (chain-assoc-get 'xo-horizontal-offset props -0.35)))
207 (xo-horizontal-offset (* size -0.35))
208 (font (ly:paper-get-font paper `(((font-encoding . ,my-font-encoding)(font-family . sans)
209 (font-series . medium) (font-shape . upright)
210 (font-size . ,(stepmag (* size xo-font-mag)))))))
211 (mypair (car xo-list))
212 (restlist (cdr xo-list))
213 (glyph-string (if (eq? (car mypair) 'mute) "X" "O"))
214 (xpos (+ (* (- string-count (cadr mypair)) size) xo-horizontal-offset ))
215 (glyph-stencil (ly:stencil-translate-axis (fontify-text font glyph-string) xpos X)))
219 (draw-xo paper props string-count fret-range size restlist)
222 (define (make-bezier-sandwich-list left right bottom height thickness)
223 " Make the argument list for a horizontal bezier sandwich from @var{left} to @var{right} with a bottom at @var{bottom},
224 a height of @var{height}, and a thickness of @var{thickness}."
225 (let* ((width (+ (- right left) 1))
226 (x1 (+ (* width thickness) left))
227 (x2 (- right (* width thickness)))
228 (bottom-control-point-height (+ bottom (- height thickness)))
229 (top-control-point-height (+ bottom height)))
230 ; order of points is: left cp low, right cp low, right end low, left end low
231 ; right cp high, left cp high, left end high, right end high.
232 (list (cons x1 bottom-control-point-height) (cons x2 bottom-control-point-height) (cons right bottom) (cons left bottom)
233 (cons x2 top-control-point-height) (cons x1 top-control-point-height) (cons left bottom) (cons right bottom))))
235 (define (draw-barre paper props string-count fret-range size finger-code dot-position dot-radius barre-list)
236 "Create barre indications for a fret diagram"
237 (if (not (null? barre-list))
238 (let* ((string1 (caar barre-list))
239 (string2 (cadar barre-list))
240 (fret (caddar barre-list))
241 (barre-type (chain-assoc-get 'barre-type props 'curved))
242 (scale-dot-radius (* size dot-radius))
243 (barre-vertical-offset (chain-assoc-get 'barre-vertical-offset props 0.5))
244 ; 2 is 1 for empty fret at bottom of figure + 1 for interval (top-fret - fret + 1) -- not an arbitrary constant
245 (dot-center-y (* size (- (+ 2 (- (cadr fret-range) fret))dot-position) ))
246 (bottom (+ dot-center-y (* barre-vertical-offset scale-dot-radius)))
247 (left (* size (- string-count string1)))
248 (right (* size (- string-count string2)))
249 ; (bezier-thick (chain-assoc-get 'bezier-thickness props 0.1))
251 ; (bezier-height (chain-assoc-get 'bezier-height props 0.5))
253 (bezier-list (make-bezier-sandwich-list left right bottom (* size bezier-height) (* size bezier-thick)))
254 (barre-stencil (if (eq? barre-type 'straight)
255 (ly:make-stencil (list 'draw-line (* size dot-radius) left dot-center-y right dot-center-y)
257 (cons (- dot-center-y scale-dot-radius) (+ dot-center-y scale-dot-radius)))
258 (ly:make-stencil (list 'bezier-sandwich `(quote ,bezier-list) (* size bezier-thick) )
260 (cons bottom (+ bottom (* size bezier-height)))))))
261 (if (not (null? (cdr barre-list)))
262 (ly:stencil-add barre-stencil
263 (draw-barre paper props string-count fret-range size finger-code
264 dot-position dot-radius (cdr barre-list)))
268 (define (stepmag mag)
269 "Calculate the font step necessary to get a desired magnification"
270 (* 6 (/ (log mag) (log 2))))
272 (define (label-fret paper props string-count fret-range size)
273 "Label the base fret on a fret diagram"
274 (let* ((base-fret (car fret-range))
275 ; (label-font-mag (chain-assoc-get 'label-font-mag props 0.7))
277 ; (label-vertical-offset (chain-assoc-get 'fret-label-vertical-offset props -0.2))
278 (label-vertical-offset -0.2)
279 (fret-count (+ (- (cadr fret-range) (car fret-range)) 1))
280 (font (ly:paper-get-font paper `(((font-encoding . ,my-font-encoding)(font-family . sans)
281 (font-series . medium) (font-shape . upright)
282 (font-size . ,(stepmag (* size label-font-mag))))))))
283 (ly:stencil-translate-axis (fontify-text font (format #f "~(~:@r~)" base-fret))
284 (* size (+ fret-count label-vertical-offset)) Y)))
286 (def-markup-command (fret-diagram-verbose paper props marking-list)
288 "Make a fret diagram containing the symbols indicated in @var{marking-list}
290 Syntax: \\fret-diagram marking-list
295 \\markup \\fret-diagram #'((mute 6) (mute 5) (open 4)
296 (place-fret 3 2) (place-fret 2 3) (place-fret 1 2))
299 will produce a standard D chord diagram without fingering indications.
301 Possible elements in @var{marking-list}:
303 @item (mute string-number)
304 Place a small 'x' at the top of string @var{string-number}
306 @item (open string-number)
307 Place a small 'o' at the top of string @var{string-number}
309 @item (barre start-string end-string fret-number)
310 Place a barre indicator (much like a tie) from string @var{start-string}to string @var{end-string} at fret @var{fret-number}
312 @item (place-fret string-number fret-number finger-value)
313 Place a fret playing indication on string @var{string-number} at fret @var{fret-number} with an optional
314 fingering label @var{finger-value}. By default, the fret playing indicator is a solid dot. This can be
315 changed by setting the value of the variable @var{dot-color}. If the @var{finger}
316 part of the place-fret element is present, @var{finger-value} will be displayed according to the setting of the variable
317 @var{finger-code}. There is no limit to the number of fret indications per string.
320 (make-fret-diagram paper props marking-list))
322 (define (make-fret-diagram paper props marking-list)
323 " Make a fret diagram markup"
325 ; note: here we get items from props that are needed in this routine, or that are needed in more than one
326 ; of the procedures called from this routine. If they're only used in one of the sub-procedure, they're
327 ; obtained in that procedure
329 (size (chain-assoc-get 'size props 1.0)) ; needed for everything
330 ;TODO -- get string-count directly from length of stringTunings; requires FretDiagram engraver, which is not yet available
331 ;TODO -- adjust padding for fret label? it appears to be too close to dots
332 (string-count (chain-assoc-get 'string-count props 6)) ; needed for everything
333 (fret-count (chain-assoc-get 'fret-count props 4)) ; needed for everything
334 (finger-code (chain-assoc-get 'finger-code props 'none)) ; needed for both draw-dots and draw-barre
335 (default-dot-radius (if (eq? finger-code 'in-dot) 0.45 0.25)) ; bigger dots if labeled
336 (default-dot-position (if (eq? finger-code 'in-dot) (- 1 default-dot-radius) 0.6)) ; move up to make room for bigger if labeled
337 (dot-radius (chain-assoc-get 'dot-radius props default-dot-radius)) ; needed for both draw-dots and draw-barre
338 (dot-position (chain-assoc-get 'dot-position props default-dot-position)) ; needed for both draw-dots and draw-barre
339 (th (* (ly:paper-lookup paper 'linethickness)
340 (chain-assoc-get 'thickness props 0.5))) ; needed for both draw-frets and draw-strings
342 (alignment (chain-assoc-get 'align-dir props -0.4)) ; needed only here
343 ; (xo-padding (* th (chain-assoc-get 'padding props 2))) ; needed only here
344 (xo-padding (* th 2))
346 (parameters (fret-parse-marking-list marking-list fret-count))
347 (dot-list (cdr (assoc 'dot-list parameters)))
348 (xo-list (cdr (assoc 'xo-list parameters)))
349 (fret-range (cdr (assoc 'fret-range parameters)))
350 (barre-list (cdr (assoc 'barre-list parameters)))
351 (fret-diagram-stencil (ly:stencil-add
352 (draw-strings string-count fret-range th size)
353 (draw-frets paper props fret-range string-count th size))))
354 (if (not (null? barre-list))
355 (set! fret-diagram-stencil (ly:stencil-add
356 (draw-barre paper props string-count fret-range size finger-code
357 dot-position dot-radius barre-list)
358 fret-diagram-stencil)))
359 (if (not (null? dot-list))
360 (set! fret-diagram-stencil (ly:stencil-add
361 (draw-dots paper props string-count fret-range size finger-code
362 dot-position dot-radius dot-list)
363 fret-diagram-stencil)))
364 (if (not (null? xo-list))
365 (set! fret-diagram-stencil (ly:stencil-combine-at-edge
366 fret-diagram-stencil Y UP
367 (draw-xo paper props string-count fret-range size xo-list) xo-padding 0)))
368 (if (> (car fret-range) 1)
369 (set! fret-diagram-stencil
370 (ly:stencil-combine-at-edge fret-diagram-stencil X RIGHT
371 (label-fret paper props string-count fret-range size) 0 0)))
372 (ly:stencil-align-to! fret-diagram-stencil X alignment)
373 fret-diagram-stencil))
375 (def-markup-command (fret-diagram paper props definition-string)
377 "Syntax: \\fret-diagram definition-string
379 eg: \\markup \\fret-diagram #\"s:0.75;6-x;5-x;4-o;3-2;2-3;1-2;\"
381 for fret spacing 3/4 of staff space, D chord diagram
383 Syntax rules for @var{definition-string}:
387 Diagram items are separated by semicolons.
394 s:number -- set the fret spacing of the diagram (in staff spaces). Default 1
397 t:number -- set the line thickness (in staff spaces). Default 0.05
400 h:number -- set the height of the diagram in frets. Default 4
403 w:number -- set the width of the diagram in strings. Default 6
406 f:number -- set fingering label type (0 = none, 1 = in circle on string, 2 = below string) Default 0
409 d:number -- set radius of dot, in terms of fret spacing. Default 0.25
412 p:number -- set the position of the dot in the fret space. 0.5 is centered; 1 is on lower fret bar,
413 0 is on upper fret bar. Default 0.6
416 c:string1-string2-fret -- include a barre mark from string1 to string2 on fret
419 string-fret -- place a dot on string at fret. If fret is o, string is identified
420 as open. If fret is x, string is identified as muted.
423 string-fret-fingering -- place a dot on string at fret, and label with fingering as
429 Note: There is no limit to the number of fret indications per string.
433 (let ((definition-list (fret-parse-definition-string props definition-string)))
434 (make-fret-diagram paper (car definition-list) (cdr definition-list))))
436 (define (fret-parse-definition-string props definition-string)
437 "parse a fret diagram string and return a pair containing:
438 props, modified as necessary by the definition-string
439 a fret-indication list with the appropriate values"
440 (let* ((fret-count 4)
442 (fret-range (list 1 fret-count))
448 (items (string-split definition-string #\;)))
449 (let parse-item ((myitems items))
450 (if (not (null? (cdr myitems)))
451 (let ((test-string (car myitems)))
452 (case (car (string->list (substring test-string 0 1)))
453 ((#\s) (let ((size (get-numeric-from-key test-string)))
454 (set! new-props (acons 'size size new-props))))
455 ((#\f) (let* ((finger-code (get-numeric-from-key test-string))
456 (finger-id (case finger-code
459 ((2) 'below-string))))
461 (acons 'finger-code finger-id new-props))))
462 ((#\c) (set! output-list (cons-fret (cons 'barre (numerify (string-split (substring test-string 2) #\-)))
464 ((#\h) (let ((fret-count (get-numeric-from-key test-string)))
465 (set! new-props (acons 'fret-count fret-count new-props))))
466 ((#\w) (let ((string-count (get-numeric-from-key test-string)))
467 (set! new-props (acons 'string-count string-count new-props))))
468 ((#\d) (let ((dot-size (get-numeric-from-key test-string)))
469 (set! new-props (acons 'dot-radius dot-size new-props))))
470 ((#\p) (let ((dot-position (get-numeric-from-key test-string)))
471 (set! new-props (acons 'dot-position dot-position new-props))))
473 (let ((this-list (string-split test-string #\-)))
474 (if (string->number (cadr this-list))
475 (set! output-list (cons-fret (cons 'place-fret (numerify this-list)) output-list))
476 (if (equal? (cadr this-list) "x" )
477 (set! output-list (cons-fret (list 'mute (string->number (car this-list))) output-list))
478 (set! output-list (cons-fret (list 'open (string->number (car this-list))) output-list)))))))
479 (parse-item (cdr myitems)))))
480 (if (eq? new-props '())
481 `(,props . ,output-list)
482 `(,(cons new-props props) . ,output-list))))
484 (define (cons-fret new-value old-list)
485 " Put together a fret-list in the format desired by parse-string "
486 (if (eq? old-list '())
488 (cons* new-value old-list)))
490 (define (get-numeric-from-key keystring)
491 "Get the numeric value from a key of the form k:val"
492 (string->number (substring keystring 2 (string-length keystring) )))
494 (define (numerify mylist)
495 "Convert string values to numeric or character"
498 (let ((numeric-value (string->number (car mylist))))
500 (cons* numeric-value (numerify (cdr mylist)))
501 (cons* (car (string->list (car mylist))) (numerify (cdr mylist)))))))
503 (def-markup-command (fret-diagram-terse paper props definition-string)
505 "Make a fret diagram markup using terse string-based syntax.
507 Syntax: \\fret-diagram-terse definition-string
509 eg: \\markup \\fret-diagram #\"x;x;o;2;3;2;\" for a D chord diagram.
511 Syntax rules for @var{definition-string}:
515 Strings are terminated by semicolons; the number of semicolons
516 is the number of strings in the diagram.
519 Mute strings are indicated by \"x\".
522 Open strings are indicated by \"o\".
525 A number indicates a fret indication at that fret.
528 If there are multiple fret indicators desired on a string, they
529 should be separated by spaces.
532 Fingerings are given by following the fret number with a \"-\",
533 followed by the finger indicator, e.g. 3-2 for playing the third
534 fret with the second finger.
537 Where a barre indicator is desired, follow the fret (or fingering) symbol
538 with \"-(\" to start a barre and \"-)\" to end the barre.
540 ;TODO -- change syntax to fret\string-finger
541 (let ((definition-list (fret-parse-terse-definition-string props definition-string)))
542 (make-fret-diagram paper (car definition-list) (cdr definition-list))))
544 (define (fret-parse-terse-definition-string props definition-string)
545 "parse a fret diagram string that uses terse syntax; return a pair containing:
546 props, modified to include the string-count determined by the definition-string
547 a fret-indication list with the appropriate values"
548 ;TODO -- change syntax to fret\string-finger
549 (let* ((barre-start-list '())
552 (items (string-split definition-string #\;))
553 (string-count (- (length items) 1)))
554 (let parse-item ((myitems items))
555 (if (not (null? (cdr myitems)))
556 (let* ((test-string (car myitems))
557 (current-string (- (length myitems) 1))
558 (indicators (string-split test-string #\ )))
559 (let parse-indicators ((myindicators indicators))
560 (if (not (eq? '() myindicators))
561 (let* ((this-list (string-split (car myindicators) #\-))
562 (max-element-index (- (length this-list) 1))
563 (last-element (car (list-tail this-list max-element-index)))
564 (fret (if (string->number (car this-list)) (string->number (car this-list)) (car this-list))))
565 (if (equal? last-element "(")
567 (set! barre-start-list (cons-fret (list current-string fret) barre-start-list))
568 (set! this-list (list-head this-list max-element-index))))
569 (if (equal? last-element ")")
570 (let* ((this-barre (get-sub-list fret barre-start-list))
571 (insert-index (- (length this-barre) 1)))
572 (set! output-list (cons-fret (cons* 'barre (car this-barre) current-string (cdr this-barre))
574 (set! this-list (list-head this-list max-element-index))))
576 (set! output-list (cons-fret (cons* 'place-fret current-string (drop-paren (numerify this-list))) output-list))
577 (if (equal? (car this-list) "x" )
578 (set! output-list (cons-fret (list 'mute current-string) output-list))
579 (set! output-list (cons-fret (list 'open current-string) output-list))))
580 (parse-indicators (cdr myindicators)))))
581 (parse-item (cdr myitems)))))
582 (set! new-props (acons 'string-count string-count new-props))
584 `(,(cons new-props props) . ,output-list)))
586 (define (drop-paren item-list)
587 " drop a final parentheses from a fret indication list resulting from a terse string specification of barre."
588 (if (> (length item-list) 0)
589 (let* ((max-index (- (length item-list) 1))
590 (last-element (car (list-tail item-list max-index))))
591 (if (or (equal? last-element ")") (equal? last-element "("))
592 (list-head item-list max-index)
596 (define (get-sub-list value master-list)
597 " Get a sub-list whose cadr is equal to @var{value} from @var{master-list}"
598 (if (eq? master-list '())
600 (let ((sublist (car master-list)))
601 (if (equal? (cadr sublist) value)
603 (get-sub-list value (cdr master-list))))))