summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scales/utils.scm15
1 files changed, 13 insertions, 2 deletions
diff --git a/scales/utils.scm b/scales/utils.scm
index 5c488a3..31d1c12 100644
--- a/scales/utils.scm
+++ b/scales/utils.scm
@@ -19,17 +19,28 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9)
#:use-module (srfi srfi-26)
- #:export (all-notes-from
+ #:export (leave
+ all-notes-from
make-scale-note
scale-note-note
scale-note-offset))
+(define (leave . messages)
+ (apply format (current-error-port) messages)
+ (exit 1))
+
+
+(define valid-notes
+ '(a ais b c cis d dis e f fis g gis))
+
(define all-notes
- (circular-list 'a 'ais 'b 'c 'cis 'd 'dis 'e 'f 'fis 'g 'gis))
+ (apply circular-list valid-notes))
(define (all-notes-from root)
+ (when (not (member root valid-notes))
+ (leave "Invalid root note. Valid notes are:\n\n~{ ~s\n~}\n" valid-notes))
(find-tail (cut eqv? root <>) all-notes))