summaryrefslogtreecommitdiff
path: root/scales.scm
diff options
context:
space:
mode:
Diffstat (limited to 'scales.scm')
-rw-r--r--scales.scm38
1 files changed, 26 insertions, 12 deletions
diff --git a/scales.scm b/scales.scm
index 0ac91db..271d6ce 100644
--- a/scales.scm
+++ b/scales.scm
@@ -21,26 +21,40 @@
;;; Common scales
+(define (steps->scale steps)
+ "Given a list of semitone steps, return a procedure that takes a
+root note and returns a list of scale notes."
+ (let ((offsets (reverse
+ (fold (lambda (step acc)
+ (cons (+ step (car acc)) acc))
+ '(0) steps))))
+ (lambda (root)
+ (let ((notes (all-notes-from root)))
+ (map (lambda (offset)
+ (make-scale-note (list-ref notes offset)
+ offset))
+ offsets)))))
+
(define lydian
- '(2 2 2 1 2 2 1))
+ (steps->scale '(2 2 2 1 2 2 1)))
(define ionian
- '(2 2 1 2 2 2 1))
+ (steps->scale '(2 2 1 2 2 2 1)))
(define mixolydian
- '(2 2 1 2 2 1 2))
+ (steps->scale '(2 2 1 2 2 1 2)))
(define lydian-b7
- '(2 2 2 1 2 1 2))
+ (steps->scale '(2 2 2 1 2 1 2)))
(define altered
- '(1 2 1 2 2 2 2))
+ (steps->scale '(1 2 1 2 2 2 2)))
(define symmetrical-diminished
- '(1 2 1 2 1 2 1 2))
+ (steps->scale '(1 2 1 2 1 2 1 2)))
(define dorian
- '(2 1 2 2 2 1 2))
+ (steps->scale '(2 1 2 2 2 1 2)))
(define aeolian
- '(2 1 2 2 1 2 2))
+ (steps->scale '(2 1 2 2 1 2 2)))
(define phrygian
- '(1 2 2 2 1 2 2))
+ (steps->scale '(1 2 2 2 1 2 2)))
(define locrian
- '(1 2 2 1 2 2 2))
+ (steps->scale '(1 2 2 1 2 2 2)))
;;; Tunings
@@ -106,8 +120,8 @@ indicated for as many FRETS as specified."
;;; Examples
(when #f
- (print-fretboard (fretboard tuning-guitar (scale->notes 'aeolian 'e) 7 5))
+ (print-fretboard (fretboard tuning-guitar (aeolian 'e) 7 5))
(print-stick
(map (lambda (string-group)
- (fretboard string-group (scale->notes 'aeolian 'e) 7 5))
+ (fretboard string-group (aeolian 'e) 7 5))
tuning-grand-stick-matched-reciprocal-6+6)))