;
;
; :mkint
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Returns a new pitch at the desired interval
; To determine the interval quality, accepts either a scale/mode (defaults major/ionian) or a M/m symbol.
;
; WHEN PASSING A SCALE (MODE)
; The interval is also *quantised* using that scale
;
; WHEN PASSING AN INTERVAL QUALITY (eg M/m/A/D)
; The interval gets calculated using the semitones count only
;
; INTERVAL NUMBERS e.g. 1, 2, 3..
; We use the traditional notation (differently from the numbers used in pc:relative)
; That is:
;; intervallo di 1 = unison (VS 0 in pc steps)
;; intervallo di 2 = next pitch in scale (VS 1 in pc steps)
;; intervallo di 4 = quarta eg 'fa' in do maggiore (VS 3 in pc steps)
;; intervallo di 8 = ottava (VS 7 in pc steps)
;
; ===Examples with Scales===
; (:mkint 60 0) => 60 (default scale: ionian)
; (:mkint 60 1) => 60
; (:mkint 60 2) => 62
; (:mkint 60 -1) => 60
; (:mkint 60 -2) => 59
; (:mkint 60 3) => 64
; (:mkint 60 3 'aeolian) => 63
; (:mkint 61 2) => 62 / major second in c (with quantization)
; (:mkint 110 20) => 110 ;; maxlimit kicks in
; (:mkint 30 -40) => 10 ;; minlimit kicks in
;
;
; ===Examples with Qualities eg M/m===
; (:mkint 60 2 'M) => 62
; (:mkint 60 3 'm) => 63
; (:mkint 102 5 'M) => 109
; (:mkint 105 5 'M) => 105 ;; maxlimit kicks in
(define :mkint
(lambda (root degree . args)
; (println args)
(cond ((null? args)
; 0 args: return a 'major' interval using the 'ionian mode
(helper:mkint-inner root degree 'ionian))
((length-equal? args 1)
;; 1 arg: use whatever scale-mode symbol is passed
(helper:mkint-inner root degree (car args)))
;
(else (print 'Error: 'arguments 'could 'not 'be 'resolved.))
)
)
)