Main Page       Index


drsmile.lsp


 drsmile.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 duel sawtooth oscillator instrument with band pass filter.


wrapper

drsmile

 (drsmile plist dur [:vel][:pos][:arpeg][:r][:tab][:bw][:attack][:decay])
 Dr.Smile is a duel sawtooth oscillator instrument with bandpass filter. 
 
 plist   - FLONUM or LIST. MIDI key number(s) to be played.
 dur     - FLONUM. Duration
 :vel    - FLONUM. MIDI velocity controls filter sweep and amplitude, 
           default 64.
 :pos    - FLONUM or SOUND. Pan position, default 0.5
 :arpeg  - FLONUM. Arpeggio interval, default 0
 :r      - FLONUM. Relative oscillator tuning, default 1.01
 :tab    - TABLE. Wave table. The default, *saw-table*, is not
           band limited so aliasing may result at high frequencies.
 :bw     - FLONUM. Filter band width, default 200 Hz.
 :attack - FLONUM. Attack time, default 0.001 Sec
 :decay  - FLONUM. Decay time, default 0.1 sec.
 
 Return  - Sound Vector.


View the Sourcecode :



;; drsmile.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 duel sawtooth oscillator instrument with band pass filter.
;;

(require 'map)
(require 'definst)
(require 'xenvelope)

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


(defun drsmile:osc (pitch dur &key (r 1.01)(tab *saw-table*))
  (let ((hz (step-to-hz pitch)))
    (sum (osc pitch dur tab)
	 (osc (hz-to-step (* r hz)) dur tab (* 180 (rnd))))))


;; @doc wrapper drsmile
;; (drsmile plist dur [:vel][:pos][:arpeg][:r][:tab][:bw][:attack][:decay])
;; Dr.Smile is a duel sawtooth oscillator instrument with bandpass filter. 
;; 
;; plist   - FLONUM or LIST. MIDI key number(s) to be played.
;; dur     - FLONUM. Duration
;; :vel    - FLONUM. MIDI velocity controls filter sweep and amplitude, 
;;           default 64.
;; :pos    - FLONUM or SOUND. Pan position, default 0.5
;; :arpeg  - FLONUM. Arpeggio interval, default 0
;; :r      - FLONUM. Relative oscillator tuning, default 1.01
;; :tab    - TABLE. Wave table. The default, *saw-table*, is not
;;           band limited so aliasing may result at high frequencies.
;; :bw     - FLONUM. Filter band width, default 200 Hz.
;; :attack - FLONUM. Attack time, default 0.001 Sec
;; :decay  - FLONUM. Decay time, default 0.1 sec.
;; 
;; Return  - Sound Vector.
;;

(defwrapper drsmile
  #'drsmile:osc
  #'(lambda (sig args)
      (let* ((vel (get-keyword-value ':vel args 64))
	     (floor (step-to-hz (apply #'min plist)))
	     (ceiling (max (* floor 2)(step-to-hz (apply #'max plist))))
	     (range (* (- ceiling floor)(map:ctrl 8 vel 1)))
	     (bw (get-keyword-value ':bw args 200))
	     (attack (get-keyword-value ':attack args 0.001))
	     (decay (get-keyword-value ':decay args 0.100)))
	(mult 
	 (reson sig 
		(sum floor (scale range (percussion dur)))
		bw 2)
	 (scale-db (map:ctrl 6 vel -6)
		   (xasd attack (max 0 (- dur attack decay)) decay))))))


Main Page       Index