Music 680 (Spring 2006): Special Topics in Music Theory - Programming for Sound Synthesis
Lecture 01, Wednesday, January 24, 2006

motivations
	synthesis from scratch as maximum creative flexibility
	if tools aren't value-neutral, making your own is a desirable option....
	Fernando Lopez-Lezcano's icecream as an expression of this approach

history of Music N
	Max Mathews writes Music I in 1957 at Bell Laboratories (Murray Hill, NJ)
		hand-coded assembly
		computation at IBM (on a vacuum tube machine, the 704), New York City
		digital-to-analog conversion (12-bit) at Bell Labs
		Music I can only specify a triangular waveform, monophonic
		Newman Guttman's "In a Silver Scale" is the first piece composed with Music I
	Music II, 1958
		four-voice polyphony, sixteen waveforms
		computes on the transistorized IBM 7094
	Music III, 1960
		created together with Joan Miller
		introduces the unit generator concept
	Music IV as a recoding of Music III, 1963
	Music V, 1966, written in Fortran IV
		portability means that Music V is taken up around the world
		leads to MUS10 (Chowning, Poole Smith) at Stanford, 1966
		MUS4BF, Princeton, 1967
		Music360 (Vercoe), Princeton, 1969
		Music 11, CSound, (Vercoe et. al.), MIT, 1973, 1986
		CMusic, (F. R. Moore, G. Loy), UCSD, 1980
		MIX, Cmix (P. Lansky), Princeton, 1982, 1984
		Common Lisp Music (Schottstaedt), Stanford, 1991
		SuperCollider, RTCMix, Nyquist, etc. etc.
	historical move towards higher-level languages for portability and accessibility to programmers
		also to expose increasing amounts of flexibility to the programmer: Turing-complete
		leading towards the enmeshing of algorithmic composition and sound synthesis
		and the specification of new/complex/idiosyncratic synthesis technique
		
the unit generator concept
	as lego: conceiving of a synthesizer as made of smaller functional units
		analogizes nicely with analog subtractive synthesis and with signal processing chains
	each unit generator computes one or a block of samples
		and passes that data for further processing to additional UGs
	CLM as a textual representation of UGs; Pd as a graphical visualization

realtime vs. non-realtime
	block vs. sample orientation as computational speed vs. synthesis flexibility
	issues of control in realtime (or, when does this note end?)
	user interface issues


the Common Lisp programming environment
        atoms
                2
                pi
        built-in functions
                (+ 2 3)
        nesting built-in functions
                (+ 2 (* 3 5))
                (* (+ 2 3) 5)
                (+ 2 (* 3 5) 4)
        parameter assignments
                (defparameter half-pi (/ pi 2))
        procedures
                (defun plus (x y) (+ x y))
                (plus 2 3)
                (defun square (x) (* x x))
                (square 2)
                (square (square 2))     
                (square (plus 2 3))
        compound procedures
                (defun sum-of-squares (x y) (+ (square x) (square y)))
        conditionals
                (defun absolute-value (x) (cond ((< x 0) (- x)) (t x)))
        recursion
                (defun (fibonacci x) 
		  (cond ((= x 0) 0) 
		        ((= x 1) 1) 
		    (t (+ (fibonacci (- x 1)) (fibonacci (- x 2))))))
        lists
                (defparameter x (list 1 2 3 4))
                (car x)
                (cdr x)
                (car (cdr x))
                (cdr (cdr (cdr (cdr x))))
                (defun y (cons 0 x))
        recursive list construction
                (defun fibonacci-list (x)
                        (cond ((< x 0) nil) 
			      (t (cons (fibonacci x) (fibonacci-list (- x 1))))))
                (reverse (fibonacci-list 12))
; to create the list in the other order, use a helper function to count up to the original "x" input
        
installing Common Lisp Music (on Mac OS X)
	install Aquamacs or Carbon Emacs
		http://aquamacs.org
		http://www.mindlube.com/products/emacs/
	install Apple X11
		http://www.apple.com/downloads/macosx/apple/x11formacosx.html
	install XCode
		from your OS X install media
	install Common Music (which includes CLM, CMN, etc.)
		http://commonmusic.sourceforge.net

digital audio basics
	audio signals
		as pressure fluctuations
			movement of a speaker cone, rarefaction of sound in the air, movement of the eardrum
		frequency, pitch, and zero-crossings
		timbre and waveform
		amplitude and loudness
		phase
	digital capture of audio signals
		discrete vs. continuous time
		sampling rate and the nyquist theorem: horizontal rounding
			customary use of 44.1 kHz for CD compatibility
			(CLM is capable of producing files with arbitrary sampling rates)
			discontinuities/"hard edges" as problematic waveforms for sampling
		amplitude quantization and bit depth: vertical rounding
			customary use of real numbers between -1 and 1
				values outside of these boundaries cause failure at the hardware DAC
			(CLM is capable of producing files with arbitrary bit depths)
		analog-to-digital conversion; digital-to-analog conversion
			
	combination of audio signals (mixing)
		fourier theorem
			decomposition of time-domain waveforms into frequency-domain spectra
			any signal can be represented as a sum of sinusoids/partials (harmonics)