Main Page       Index


dlfo.lsp


 dlfo.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

 An LFO with integral amplitude envelope


function

dlfo

 (dlfo hz dur [:tab][:phase][:delay][:attack][:env])
 An LFO with integral amplitude envelope. 

 hz     - flonum. Frequency in Hertz

 dur    - flonum. Duration in seconds

 :tab   - table. Wave table, default *tri-table*

 :phase - any. See phase function in utilities. Default 0

 :delay - flonum. Onset delay time in seconds. default 0

 :attack - flonum. Attack time in seconds. Default 0

 :env    - sound or  list. The default envelope function is dramp, a delayed 
           onset linear ramp. The env argument may be used to override this 
           default. If specified env may either be a sound, in which case it 
           is used directly as the envelope, or a list of the form 
           (fn p0 p1 p2 ...) where fn is a sound generating function and pi 
           are the arguments to fn. Default NIL

 return  - sound at control rate.


View the Sourcecode :



;; dlfo.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
;;
;; An LFO with integral amplitude envelope
;;

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


;; @doc function dlfo
;; (dlfo hz dur [:tab][:phase][:delay][:attack][:env])
;; An LFO with integral amplitude envelope. 
;;
;; hz     - flonum. Frequency in Hertz
;;
;; dur    - flonum. Duration in seconds
;;
;; :tab   - table. Wave table, default *tri-table*
;;
;; :phase - any. See phase function in utilities. Default 0
;;
;; :delay - flonum. Onset delay time in seconds. default 0
;;
;; :attack - flonum. Attack time in seconds. Default 0
;;
;; :env    - sound or  list. The default envelope function is dramp, a delayed 
;;           onset linear ramp. The env argument may be used to override this 
;;           default. If specified env may either be a sound, in which case it 
;;           is used directly as the envelope, or a list of the form 
;;           (fn p0 p1 p2 ...) where fn is a sound generating function and pi 
;;           are the arguments to fn. Default NIL
;;
;; return  - sound at control rate.
;;

(defun dlfo (hz dur &rest args)
  (let* ((tab    (get-keyword-value ':tab    args *tri-table*))
	 (rho    (get-keyword-value ':phase  args 0))
	 (delay  (get-keyword-value ':delay  args 0))
	 (attack (get-keyword-value ':attack args 0))
	 (env    (get-keyword-value ':env    args 'NIL))
	 (hold (max 0 (- dur delay attack))))
    (mult (lfo hz dur tab (phase rho))
	  (uenv (or env (dramp delay attack hold))))))


Main Page       Index