Music 680, Fall 2005: Special Topics in Music Theory - Algorithmic Composition
Lecture 3: September 26, 2005 - Cage I: early works

John Cage, algorithm, and indeterminacy
	algorithm in Credo in US (1942) and related works (the Constructions, etc.)
		relationship of macrostructural sectioning to measure-level sectioning
		content is arbitrarily/intuitively composed into these macro- and measure-level blocks
			with opening sections presenting multiple materials later "developed" individually
			moving around circular "series" of rhythmic values
				moving clockwise or counter-clockwise around the circle, or through its center value
				more choice than in a fixed tone-row but still limiting possibilities
			encourages hearing structure but at the expense of local detail
	indeterminacy expressed primarily in the freedom to choose different recorded excerpts
		writing about the First Construction to Boulez in 1949:
			"You know that with exposition and development (without recapitulation) and with the
				form (climax apotheosis (?)) etc., this Construction is 19th-century."

	algorithm in Music of Changes (1951)
		composed as a companion piece (and competitor?) to Boulez' 2nd Sonata
		indeterminacy is now central to the algorithmic (and aesthetic) approach
			a way to free the composer from habit, clichˇ, and limitation
		basing the technique upon charts (derived from the Concerto for Prepared Piano)
			8 x 8 structure = 64 possibilities (suited to extraction via tossing coins / I Ching)
			separate charts for sonority, duration, and dynamics
				even though chart elements are intuitively composed, their combination is not
					(and spatial notation assists with the unusual rhythmic results)
				importance of timbre in sonority charts (although the piano is not prepared)
				parameters determining whether chart elements are replaced after use, layering
					process of layering affects duration in turn
			still using large-scale rhythmic structuring techniques from Credo etc.
				but now adding tempo change - "space" + "speed" rather than duration
				tempo is also a chart-derived parameter

	algorithm in Williams Mix (1952)
		again using charts to cross-reference timbres with durations and splicing techniques
		spatialization as a function of material layering
		the possibility of other composers realizing the same work (taken up recently by Larry Austin)
		the labor-intensive quality of both Music of Changes and Williams Mix

	the aesthetics of indeterminacy
		embrace and pursuit of new sounds (and forms?)
		opposition to to the idea of musical progression and accumulation (after Debussy?)
		4'33", the weather, and the listener's ability to organize sound into form

	...and the importance of algorithm
		with perhaps the exception of 4'33", Cage is making high-level determinations about his works

indeterminacy in Scheme
	quasi-random numbers (uniform distribution)
		(random 3) ; quasi-random integers between 0 and n-1
		(random 1.0) ; produces random floating-point numbers between 0 and 1
	
	other random distributions
		(define (linear)
			(let ((first-random (random 1.0))
				 	(second-random (random 1.0)))
				(if (< first-random second-random)
					 first-random
					 second-random))))

		(define (triangular)
			(let ((first-random (random 1.0))
					(second-random (random 1.0)))
				(* 0.5 (+ first-random second-random))))

	choosing randomly from a gamut (chart)
		(define pitch-gamut (list 0 1 3 4 6 7 10 11))
		(define register-gamut (list 36 60 84 96))
		(define onset-spacing-gamut (list 0 0.1 0.17 0.77 1.34 3.17))
		(define duration-gamut (list 0.05 0.08 0.15 0.35 0.89 2.3))
		(define amplitude-gamut (list 0.2 0.3 0.35 0.4 0.9))

		(define (choose-from-gamut gamut)
		  (nth (random (length gamut)) gamut))

		(define (generate-chord number-pitches pitches registers start-time dur amp)
		  (if (<= number-pitches 0) nil
      		(cons (new midi
            		  :time start-time
            		  :keynum (+ (choose-from-gamut pitches)
               		          (choose-from-gamut registers))
              			:amplitude amp
              			:duration dur)
            	(generate-chord (- number-pitches 1) pitches registers start-time dur amp))))

		(define (gamut-chords number-chords pitches registers onsets durations 									amplitudes start-time)
		  (if (<= number-chords 0) nil
   		   (let ((next-onset (+ start-time (choose-from-gamut onsets)))
      		      (dur (choose-from-gamut durations))
         		   (amp (choose-from-gamut amplitudes)))
       		 (append (generate-chord 3 pitches registers start-time dur amp)
            		    (gamut-chords (- number-chords 1) pitches registers
                  		            onsets durations amplitudes next-onset)))))

		(events (gamut-chords 20 pitch-gamut register-gamut onset-spacing-gamut duration-gamut amplitude-gamut 0.0) "test.mid")

		(events (append 
					(gamut-chords 20 pitch-gamut register-gamut onset-spacing-gamut duration-gamut amplitude-gamut 0.0) 
					(gamut-chords 20 pitch-gamut register-gamut onset-spacing-gamut duration-gamut amplitude-gamut 0.0) 
					(gamut-chords 20 pitch-gamut register-gamut onset-spacing-gamut duration-gamut amplitude-gamut 0.0))
				"test.mid")

	altering gamuts dynamically: (set! (mth 1 pitch-gamut) 2)