;;; Frequency sweeping sine wave instrument (definstrument sweep (start-time duration minfreq maxfreq amplitude &key (bow 5.0)) (multiple-value-bind (beg end) (get-beg-end start-time duration) (let ((s (make-oscil :frequency 0)) (f (make-env :base bow :envelope '(0 0 1 1) :duration duration :offset minfreq :scaler (- maxfreq minfreq)))) (run (loop for i from beg to end do (setf (frequency s) (env f)) (outa i (* amplitude (oscil s)))))))) ;;; 20-20KHz sweep... ;;; (with-sound(:srate 44100)(sweep 0 10 10 20000 0.03 :bow 5)) ;;; 20-20KHz sweep with aliasing... ;;; (with-sound(:srate 22050)(sweep 0 10 10 20000 0.03 :bow 5)) ;;; 20-20KHz sweep with a lot of aliasing... ;;; (with-sound(:srate 8192)(sweep 0 10 10 20000 0.03 :bow 5))