Re: Nalesnik's Roman number analysis code

2014-11-22 Thread Ivan Kuznetsov
Thanks !

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Nalesnik's Roman number analysis code

2014-11-20 Thread David Nalesnik
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)
   

Nalesnik's Roman number analysis code

2014-11-17 Thread ivan . k . kuznetsov

Mr. Nalesnik: thank you for making public your scheme code
for writing Roman Numeral/figured bass analysis:

   http://comments.gmane.org/gmane.comp.gnu.lilypond.general/70354

This code has been invaluable to me for writing examples for a music
theory course.

I have one small issue, and that is, when I want to
put three Arabic numerals that are to be in one vertical line
after a roman number, the numbers are not rendered this way,
as demo-ed by my attached sample lilypond file.


Yes, I know that the figured bass 6 5 3 is usually abbreviated
as 6 5, but for the purposes of instruction, I find it desirable to
sometimes have all three Arabic numbers.

Is there a way that your code can be expanded to accommodate
three Arabic numbers in one vertical column?

I see that your above post is dated March of 2012, and
so perhaps, you have some more recent code that has
been made available?

Thank you again for your code.  Ivan.



P.S.  For those you would like to run my sample lilypond file, you
need to download the rN.ly file from the above link,
edit out everything after ... %%% EXAMPLE %%% ...
and include this file in the same directory.



\include english.ly

\include rN.ly % Used as is, except delete everything after EXAMPLE

\score {

  \new Staff = f_major \with { \remove Time_signature_engraver }
  {
\time 4/4
\key f \major
\clef treble
\voiceOne { c'' e' g' bf'1 }
  }
  \addlyrics{
   \markup \rN { V 6 5 3 }
  }
}











___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Nalesnik's Roman number analysis code

2014-11-17 Thread David Nalesnik
Hi Ivan,

On Mon, Nov 17, 2014 at 5:38 PM, ivan.k.kuznet...@gmail.com wrote:


 Mr. Nalesnik: thank you for making public your scheme code
 for writing Roman Numeral/figured bass analysis:

http://comments.gmane.org/gmane.comp.gnu.lilypond.general/70354

 This code has been invaluable to me for writing examples for a music
 theory course.


Glad to hear it!


 Is there a way that your code can be expanded to accommodate
 three Arabic numbers in one vertical column?

 I see that your above post is dated March of 2012, and
 so perhaps, you have some more recent code that has
 been made available?


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.

--David
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Nalesnik's Roman number analysis code

2014-11-17 Thread Ivan Kuznetsov
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.

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user