;; look at the pc-lib.scm to find what scales and chord symbols are available


;; define some scales as pitch classes

(define *c-major* (pc:scale 0 'ionian))

(define *c-minor* (pc:scale 0 'aeolian))

(define *a-aeolian* (pc:scale 9 'aeolian))


;; check *c-major* against pc list

(print (equal? *c-major* '(0 2 4 5 7 9 11)))

(print (equal? *a-aeolian* '(9 11 0 2 4 5 7)))


;; define some chords

(define *cmaj7* (pc:chord 0 '^7))

(define *dmin* (pc:chord 2 '-))

(define *f-7b5* (pc:chord 5 '-7b5))


;; a non-standard pitch set

(define *wierd-pc* (list 0 1 5 9 10 11))


;; pc:? examples

(pc:? 61 (pc:scale 5 'ionian)) ; is c# in f major 

(pc:? 61 (pc:scale 2 'ionian)) ; is c# in d major


;; quantize-pc examples

;; find the closest value in the pitch class

(pc:quantize 65 *wierd-pc*)

(pc:quantize 66 *wierd-pc*)

(pc:quantize 77 *cmaj7*)

(pc:quantize 96 *f-7b5*)


;; random-pc examples

;; select any pitch from the class within lower and upper bounds

(pc:random 60 72 *a-aeolian*)


;; relative-pc examples

;; select pitch from pitch class a specified number of steps from the 

;; original pitch.

(pc:relative 60 -1 *c-major*)

(pc:relative 60 -1 *c-minor*)


;; make-chord-from-pc examples

;; Select an even distribution of notes from pitch class within bounds.

;; non-deterministic (i.e. result can vary each time)

(pc:make-chord 48 72 4 *dmin*)


;; returns a diatonic chord based on a root major or minor key and degree

(pc:diatonic 0 '- 'i)  ; c minor

(pc:diatonic 0 '- 'vi) ; ab major

(pc:diatonic 0 '- 'ii) ; d minor

(pc:diatonic 0 '- 'v7) ; g dom 7

(pc:diatonic 0 '- 'i) ; c minor