;;; -*- Syntax: Common-Lisp; Base: 10; Mode: Lisp -*- ;;; Wavetable examples demonstrating chord notation. The chords in ;;; Algorithm wave2 contain a mixture of very short and long amplitude ;;; envelopes, so you don't hear all the pitches. Amplitude envelopes in ;;; chords in Algorithm wave3 are uniform and you do hear all the pitches. (in-package :stella) (in-syntax :mk t) (defparameter *header* (header "envelope ampFn1 = [(0,0)(.01,1)(.06,0.0)];" "envelope ampFn2 = [(0,0)(.05,1)|(.2,0.0)];" ;; harmonic number (integer), followed by harmonic amplitude "waveTable clarinetSpectralEnv = [{1,1}{3,.5}{5,.25}{7,.12}{9,.06}{11,.03}];")) (open-cmd (concatenate 'string "test.score header \"" *header* "\"")) ;;; create an algorithm "wave2" with chords of pitches, the components ;;; have different envelopes and vibrato frequencies and are easy to hear ;;; out (algorithm wave2 Wave1vi (length 25 amp .2 waveform "clarinetSpectralEnv" sVibAmp .002 rVibAmp .002) ;; as usual, evaluate this next block each note ;; [...] = put in a chord (setf freq1 (item (pitches [f3 a c4 ef] [f3 a c4 ef] [c5 e g c4] [bf4 d f af] in heap)) sVibFreq (item (items 4 5 6 7)) ampEnv (item (items "ampFn1" "ampFn1" "ampFn2"))) ;; evaluate this block once per chord (unless-chording (setf rhythm (item (rhythms s s q e q tempo 120))))) ;;; create an algorithm "wave3" with chords of pitches where the ;;; components have exactly the same envelopes and vibrato frequencies and ;;; fuse together (algorithm wave3 Wave1vi (length 25 amp .2 waveform "clarinetSpectralEnv" sVibAmp .002 rVibAmp .002) (setf freq1 (item (pitches [f3 a c4 ef] [f3 a c4 ef] [c5 e g c4] [bf4 d f af] in heap))) (unless-chording (setf rhythm (item (rhythms s s q e q tempo 120)) sVibFreq (item (items 4 5 6 7)) ampEnv (item (items "ampFn1" "ampFn1" "ampFn2"))))) (stella:stella)