Main Page       Index


noisepad.lsp


 noisepad.lsp
 Version 1.00 	29 April 2005
 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

 Instrument utilizing narrow-band noise.


function

noisepad

 (noisepad step dur [:n][:nse][:r][:shift][:ac][:adeg][:env][:fm][:pms])
 Produces parallel bands of filtered noise.

 step   - MIDI step. The MIDI key number.
 dur    - Flonum. Tones duration in seconds.
 :n     - Integer. Number of bands, default 8.
 :nse   - Flonum. Noise parameter, 0 < nse <= 1.
          Sets how noisy the result is. For n ~ 1
          the result is very noisy.
 :r     - Flonum: Relative band frequency ratio. 
          The frequency, fi, of band i is
          rf = r*i*z + s, where 
          i is the band number: 1, 2, 3 ... n,
          z is the frequency in Hertz step, and 
          s is the shift parameter (see below).
          Default r = 1.0
 :shift - Flonum. Frequency shift value. See :r, default 0.
 :ac    - Flonum. Amplitude scale coefficient. 
          The amplitude mi for band i is
          mi = ac * i ^ adeg, where
          mi is the relative amplitude,
          ac is the scale coefficient,
          i is the band number: 1, 2, 3, ... n, and
          adeg is a non linearity value. Many amplitude distributions 
          are possible by selecting appropriate ac and adeg values. 
          Default ac = 1.0
 :adeg  - Flonum. Band amplitude linearity. Default -1
 :env   - Sound. Amplitude envelope. Default a rectangular "gate"
 :fm    - Sound. External modulation source, default silence.
 :pms   - Flonum. Pitch modulation sensitivity, default 0.10
 return - Sound.


View the Sourcecode :



;; noisepad.lsp
;; Version 1.00 	29 April 2005
;; 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
;;
;; Instrument utilizing narrow-band noise.
;;

(require 'rmband)
(provide 'noisepad)
(current-file "noisepad")


;; @doc function noisepad
;; (noisepad step dur [:n][:nse][:r][:shift][:ac][:adeg][:env][:fm][:pms])
;; Produces parallel bands of filtered noise.
;;
;; step   - MIDI step. The MIDI key number.
;; dur    - Flonum. Tones duration in seconds.
;; :n     - Integer. Number of bands, default 8.
;; :nse   - Flonum. Noise parameter, 0 < nse <= 1.
;;          Sets how noisy the result is. For n ~ 1
;;          the result is very noisy.
;; :r     - Flonum: Relative band frequency ratio. 
;;          The frequency, fi, of band i is
;;          rf = r*i*z + s, where 
;;          i is the band number: 1, 2, 3 ... n,
;;          z is the frequency in Hertz step, and 
;;          s is the shift parameter (see below).
;;          Default r = 1.0
;; :shift - Flonum. Frequency shift value. See :r, default 0.
;; :ac    - Flonum. Amplitude scale coefficient. 
;;          The amplitude mi for band i is
;;          mi = ac * i ^ adeg, where
;;          mi is the relative amplitude,
;;          ac is the scale coefficient,
;;          i is the band number: 1, 2, 3, ... n, and
;;          adeg is a non linearity value. Many amplitude distributions 
;;          are possible by selecting appropriate ac and adeg values. 
;;          Default ac = 1.0
;; :adeg  - Flonum. Band amplitude linearity. Default -1
;; :env   - Sound. Amplitude envelope. Default a rectangular "gate"
;; :fm    - Sound. External modulation source, default silence.
;; :pms   - Flonum. Pitch modulation sensitivity, default 0.10
;; return - Sound.
;;

(defun noisepad (step dur &key (n 8)(nse 0.25)(r 1.00)(shift 0)(ac 1.0)(adeg -1) env fm pms)
  (let (hz bw rffn rafn)
    (setf nse (clamp nse 0.01 1))
    (setf hz (step-to-hz step))
    (setf bw (* hz nse))
    (setf env (or env (rgate dur)))
    (setf fm (or fm (s-rest dur)))
    (setf pms (or pms 0.10))
    
    (mult (rmband:harmonic step dur
			   :n n
			   :bwfn #'(lambda (q) bw)
			   :rffn #'(lambda (j z)(+ (* r j z) shift))
			   :rafn #'(lambda (j)(* ac (expt (float j)(float adeg))))
			   :modsig (scale (* hz pms) fm))
	  
	  env)))


Main Page       Index