]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/chords-ignatzek.scm
* scm/chord-entry.scm (construct-chord): move chord construction
[lilypond.git] / scm / chords-ignatzek.scm
index 5f91a2981d53b1faebedca844fad7736b83dfc5a..36bdb5bbae91c7f968b6c37e5396d403051ba3cc 100644 (file)
 ;; the split is a procedural process, with lots of set!. 
 ;;
 
+
+;; todo: naming is confusing: steps  (0 based) vs. steps (1 based).
+(define (pitch-step p)
+  "Musicological notation for an interval. Eg. C to D is 2."
+  (+ 1 (ly:pitch-steps p)))
+
+(define (get-step x ps)
+  "Does PS have the X step? Return that step if it does."
+  (if (null? ps)
+      #f
+      (if (= (- x 1) (ly:pitch-steps (car ps)))
+         (car ps) 
+         (get-step x (cdr ps)))
+      ))
+
+(define (replace-step p ps)
+  "Copy PS, but replace the step of P in PS."
+  (if (null? ps)
+      '()
+      (let*
+         (
+          (t (replace-step p (cdr ps)))
+          )
+
+       (if (= (ly:pitch-steps p) (ly:pitch-steps (car ps)))
+           (cons p t)
+           (cons (car ps) t)
+           ))
+      ))
+
+
+(define (remove-step x ps)
+  "Copy PS, but leave out the Xth step."
+  (if (null? ps)
+      '()
+      (let*
+         (
+          (t (remove-step x (cdr ps)))
+          )
+
+       (if (= (- x 1) (ly:pitch-steps (car ps)))
+           t
+           (cons (car ps) t)
+           ))
+      ))
+
+
 (define-public (ignatzek-chord-names
                in-pitches bass inversion
                context)
   
-  (define (get-step x ps)
-    "Does PS have the X step? Return that step if it does."
-    (if (null? ps)
-       #f
-       (if (= (- x 1) (ly:pitch-steps (car ps)))
-           (car ps) 
-           (get-step x (cdr ps)))
-       ))
-
-
-  (define (remove-step x ps)
-    "Copy PS, but leave out the Xth step."
-    (if (null? ps)
-       '()
-       (let*
-           (
-            (t (remove-step x (cdr ps)))
-            )
-
-         (if (= (- x 1) (ly:pitch-steps (car ps)))
-             t
-             (cons (car ps) t)
-             ))
-       ))
 
   (define (remove-uptil-step x ps)
     "Copy PS, but leave out everything below the Xth step."
        )
     )
 
-  (define (pitch-step p)
-    "Musicological notation for an interval. Eg. C to D is 2."
-    (+ 1 (ly:pitch-steps p)))
-  
 
   (define (is-natural-alteration? p)
     (= (natural-chord-alteration p)  (ly:pitch-alteration p))