mkscalestep   scheme


Defined in:  https://github.com/lambdamusic/extempore-extensions/blob/main/init/init_makers.xtm

Implementation

;
;
; MKSCALESTEP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; make a scale from a scale step - 1-based (= tonic)
; 
; Makes a scale and allows passing an pitch value to transpose it
; The pitch value is used to get a new note from the pitch class.
; IE Combines mkscale and pc:relative
;
; TODO more testing needed
;
; Args:
; root    [eg: 60]
; reldegree    [eg: int, positive or negative]
; mode    [eg: 'ionian]
; num-notes [eg: 1]
;
;
; Example:
; (mkscale 60 'ionian 3)     ;; '(60 62 64)
; (mkscalestep 60 0 'ionian 3) ;; '(60 62 64)
; (mkscalestep 60 2 'ionian 3) ;; '(64 66 68) => take 2nd pitch from ionian pitch class, get note and start new scale from that note
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define mkscalestep
  (lambda (root step . args)
   (if (= step 0 ) (set! step 1))
   (cond ((length-equal? args 1)
           ;; 1 arg = just the scale symbol / len default=8
            (:mkscale (pc:relative root (- step 1)  (pc:scale root (car args))) (car args) 8))
         ((length-equal? args 2) 
           ;; 2 arg = scale symbol and len
           (:mkscale (pc:relative root (- step 1)  (pc:scale root (car args))) (car args) (cadr args)))
          (else (print 'Error: 'arguments 'could 'not 'be 'resolved.)))))


Back to Index