;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; File: auto-sequence.lsp ;;; ;;; Purpose: Illustration of slippery-chicken's set-palette class's ;;; auto-sequence method. ;;; ;;; Author: Michael Edwards: m@michael-edwards.org ;;; ;;; Creation date: 1st February 2016 ;;; ;;; $$ Last modified: 16:05:59 Thu Feb 4 2016 GMT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (in-package :sc) ;;; Reduction of the first six bars of Messiaen’s Quartet for the End of Time, ;;; Quartet VII, as taken from Cambouropoulos, Emilios. ‘The Harmonic Musical ;;; Surface and Two Novel Chord Representation Schemes’. In Computational Music ;;; Analysis, edited by David Meredith, 31–56. Cham: Springer International ;;; Publishing, 2016. (let* ((sp (make-set-palette 'sp '((1 ((bf3 c4 e4 df5))) (2 ((bf3 df4 gf4 c5))) (3 ((bf3 ef3 g4 a4))) (4 ((g3 c4 e4 a4))) (5 ((e3 a3 cs4 fs4))) (6 ((g3 a3 cs4 bf4))) (7 ((g3 bf3 ef4 a4))) (8 ((g3 c4 e4 fs4))) (9 ((cs3 fs3 as3 ds4)))))) (count 0)) ; just for naming graphics files (flet ((display (what) (cmn-display what :include-missing-chromatic nil :break-line-each-set nil :text-y-offset 1 :include-missing-non-chromatic nil)) (seq-map (centroid-env dissonance-env permutate) (let ((sm (make-set-map (format nil "set-map-~a" (incf count)) ;; NB this will use the dissonance and centroid data we ;; last calculated i.e. we don't pass :num-partials here (auto-sequence sp :map-section 1 :permutate permutate :dissonance-env dissonance-env ;; we'll allow bass notes to repeat so we ;; can see the raw algorithm at work :verbose nil :repeating-bass t :silent t :centroid-env centroid-env)))) (bind-palette sm sp) sm))) (set-sc-config 'default-spectra 'akoustik-piano-spectra) (format t "~&*** Dissonance values ascending (default piano spectra): ~%~a" (calculate-dissonance sp :sort t)) (format t "~&Centroid values ascending: ~%~a" (calculate-spectral-centroid sp :sort t)) (display sp) ;; 9 5 3 6 7 8 4 1 2 is the increasing order of spec-cen ;; this gives a perfect match (display (seq-map '(0 0 100 1) nil nil)) ; 1 ;; 9 6 8 7 5 4 1 2 3 is the decreasing order of dissonance ;; going down successive returns perfect match (display (seq-map nil '(0 1 100 0) nil)) ; 2 ;; increasing dissonance is 3 2 1 4 5 7 8 6 9 ;; successive method returns 3 1 4 5 7 8 6 9 2 (not great) (display (seq-map nil '(0 0 100 1) nil)) ; 3 ;; the permutation method with only 2000 permutations gives is 3 4 1 5 7 8 ;; 6 9 2, which is no better... (display (seq-map nil '(0 0 100 1) t)) ; 4 ;; ... but when we score all permutations we get 3 2 4 5 1 8 6 7 8: better ;; but still not perfect because we're hugging a curve not sorting by ;; dissonance (we've sort of been hoping to do sort and using that as a ;; measure but this isn't really what we're doing) (display (seq-map nil '(0 0 100 1) 'all)) ; 5 ;; it somehow feels wrong that 9 is the most dissonant set. what happens if ;; we only use 1 partial? (format t "~&Dissonance values descending with only one partial: ~%~a" (reverse (calculate-dissonance sp :num-partials 1 :sort t))) (set-sc-config 'default-spectra 'violin-ensemble-spectra) ;; see bottom of spectra.lsp for the available spectra ;; 8 6 9 1 5 7 3 2 4 (format t "~&Dissonance values descending with only one partial and using ~ violin spectra: ~%~a" (reverse (calculate-dissonance sp :num-partials 1 :sort t))) (format t "~&Dissonance values descending with 12 partials and using ~ violin spectra: ~%~a" (reverse (calculate-dissonance sp :num-partials 12 :sort t))) ;; descending: perfect match (display (seq-map nil '(0 1 100 0) nil)))) ; 6 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; EOF