Main Page       Index


autopan.lsp


 autopan.lsp
 Version 1.00  31 October 2004
 Author Steven Jones

 Contact jones57@swbell.net include the word "nyquist" in subject line  

 The contents of this file are released under the terms of the GNU General
 Public License. See the file LICENSE.txt

 A cyclical panning effect. Thanks to the tireless David Sky.


function

autopan

 (autopan asig dur frq [:delta][:tab][:phase])
 An LFO controlled panning effect.

 asig   - Sound or sound vector. The source signal may either be a mono 
          sound or a 2-sound vector. An error is produced for any other 
          type or vectors with lengths other then 2.

 dur    - Flonum. The tones duration in seconds.

 frq    - Flonum. The panning frequency in Hertz.

 :delta - Flonum. The panning deviation from center. 
          0 <= delta <= 1. Default 0.5

 :tab   - Wtab. The LFO wave table. Default *sine-table*

 :phase - Flonum | Symbol. The LFO phase. See phase function in utilities.lsp
          Default 0

 return - Sound vector.


View the Sourcecode :



;; autopan.lsp
;; Version 1.00  31 October 2004
;; Author Steven Jones
;;
;; Contact jones57@swbell.net include the word "nyquist" in subject line  
;;
;; The contents of this file are released under the terms of the GNU General
;; Public License. See the file LICENSE.txt
;;
;; A cyclical panning effect. Thanks to the tireless David Sky.
;; 

(provide 'autopan)
(current-file "autopan")


;; Shape polarized control signal for use with panner.
;; csig   - sound. A polarized sound with peak amplitude -+1
;; delta  - flonum. The amount of panning deviation from center.
;;          0 <= delta <= 1
;; return - sound. A sound with peak amplitudes in interval 0 <= pa <= 1
;;

(defun autopan:ctrl  (csig delta)
  (sum 0.5 (scale (* 0.5 (clamp delta 0 1)) csig)))


;; Panning effect proper. Simply composition of pan and autopan:ctrl
;;

(defun autopan:efx (asig csig delta)
  (pan asig (autopan:ctrl csig delta)))


;; Panning effect with integral LFO
;; Only processes mono signals.
;;

(defun autopan:mono (asig dur frq &key (delta 0.5)(tab *sine-table*)(phase 0))
  (autopan:efx asig (lfo frq dur tab (phase phase)) delta))


;; @doc function autopan
;; (autopan asig dur frq [:delta][:tab][:phase])
;; An LFO controlled panning effect.
;;
;; asig   - Sound or sound vector. The source signal may either be a mono 
;;          sound or a 2-sound vector. An error is produced for any other 
;;          type or vectors with lengths other then 2.
;;
;; dur    - Flonum. The tones duration in seconds.
;;
;; frq    - Flonum. The panning frequency in Hertz.
;;
;; :delta - Flonum. The panning deviation from center. 
;;          0 <= delta <= 1. Default 0.5
;;
;; :tab   - Wtab. The LFO wave table. Default *sine-table*
;;
;; :phase - Flonum | Symbol. The LFO phase. See phase function in utilities.lsp
;;          Default 0
;;
;; return - Sound vector.
;;

(defun autopan (asig dur frq &key (delta 0.5)(tab *sine-table*)(phase 0))
  (cond ((soundp asig)(autopan:mono asig dur frq :delta delta :tab tab :phase phase))
	((and (arrayp asig)(= (length asig) 2))
	 (sum 
	  (autopan:mono (aref asig 0) dur frq :delta delta :tab tab :phase phase)
	  (autopan:mono (aref asig 1) dur frq :delta delta :tab tab :phase phase)))
	(t (error "autopan only works with mono or 2-channel sounds"))))


Main Page       Index