Hi Ivan,
On Mon, Nov 17, 2014 at 8:58 PM, Ivan Kuznetsov ivan.k.kuznet...@gmail.com
wrote:
Thank you; I appreciate that.
On Mon, Nov 17, 2014 at 6:04 PM, David Nalesnik
david.nales...@gmail.com wrote:
Yes--I'm pretty sure I got it to work with larger columns. I'll have to
search around for that version of the file. I'll get back to you when I
do.
Not sure if this file represents the latest--it was written when 2.14.2 was
current. There are just too many versions of this file on my computer--in
retrospect, should have used some kind of version-control.
Anyway, it will handle larger columns of figures.
Hope this is helpful--
David
\version 2.14.2
%% A function to create Roman numerals for harmonic analysis.
%%
%% Syntax: \markup \rN { ...list of symbols... }
%%
%% List symbols in this order (as needed): Roman numeral (or note-name),
%% quality, top number of inversion symbol, bottom number, / (if secondary
%% function), Roman numeral (or note-name). Usually, you can skip unnecessary
%% items, though a spacer may be needed in some cases. Use instead of the
%% initial symbol to start with the quality or inversion, for example.
%%
%% Preceding or following a symbol with English alterations (f, s, ff, ss, x, n)
%% will attach accidentals: fVII - flat VII; svi - sharp vi; Af - A-flat;
%% As A-sharp
%%
%% Qualities: use o for diminished, h for half-diminished,
%% + for augmented, f for flat; other indications are possible such as
%% combinations of M and m (M, m, MM7, Mm, mm, Mmm9, etc.); add, add6, etc.
%%
%% To scale all numerals: \override LyricText #'font-size = #2
%% or \override TextScript #'font-size = #2
%% To scale individual numerals: \markup \override #'(font-size . 2) \rN { ... }
INPUT FORMATTING %%
%% input is split to (( . . . first part . . . ) ( . . . second part . . . ))
%% first part of input formatted as ((vii) (o) (4 3))
#(define (split-list symbols splitter)
;; given (vii o 4 3 / V) -- ((vii o 4 3) (/ V))
;; given (vii o 4 3) -- ((vii o 4 3) ())
(let ((lst '()))
(define (helper symbols splitter)
(if (string= splitter (car symbols))
(list lst symbols)
(begin (set! lst (append lst (cons (car symbols) '(
(if (null? (cdr symbols))
(list lst '())
(helper (cdr symbols) splitter)
(helper symbols splitter)))
#(define numbers '(2 3 4 5 6 7 8 9 11 13))
#(define qualities
;; only to allow omission of base when quality is alone
;; TODO--combinations of M and m, add, ADD . . .
'(o + h))
#(define (base-and-quality arg)
(let ((len (length arg)))
(cond ((= 0 len) '(() ()))
((= 1 len)
(if (find (lambda (y) (string= (car arg) y)) qualities)
(list '() (list (car arg)))
(list (list (car arg)) '( ;; TODO figure out which is given
((= 2 len) (list (list (car arg)) (cdr arg))
#(define (segment-inversion-test symbols)
;; given (vii o 4 3) -- ((vii) (o) (4 3)) with call to base-and-quality
;; (4 3) -- (() () (4 3))
;; () -- (() () ())
(let ((lst '()))
(define (helper symbols)
(if (find (lambda (y) (string= (car symbols) y)) numbers)
(append (base-and-quality lst) (cons symbols '()))
(begin
(set! lst (append lst (cons (car symbols) '(
(if (null? (cdr symbols))
(append (base-and-quality lst) '(())) ; includes () for no numbers
(helper (cdr symbols))
(if (not (pair? symbols))
(list '() '() '())
(helper symbols
NOTE NAMES / ACCIDENTALS %%
%% Based on English names. For other languages, change the strings
%% in the three following definitions.
#(define notenames '(A a B b C c D d E e F f G g))
#(define alterations '(f ff s ss x n))
#(define (acc size-factor)
`((f . ,(make-raise-markup (* 0.3 size-factor) (make-flat-markup)))
(ff . ,(make-raise-markup (* 0.3 size-factor) (make-doubleflat-markup)))
(s . ,(make-raise-markup (* 0.6 size-factor) (make-sharp-markup)))
(ss . ,(make-raise-markup (* 0.3 size-factor) (make-doublesharp-markup)))
(x . ,(make-raise-markup (* 0.3 size-factor) (make-doublesharp-markup)))
(n . ,(make-raise-markup (* 0.6 size-factor) (make-natural-markup)
#(define (initial-accidental-test arg)
;; returns an alteration name or #f if none present
(let ((index (1- (string-length arg
(define (helper arg index)
;; find the longest prefix that matches an entry in list of alterations
(or (find (lambda (x) (string= x (string-take arg index))) alterations)