Main Page       Index


ss-bass.lsp


 ss-bass.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

 Yet another instrument named "??bass", this one uses two oscillators and a
 dynamic filter.


wrapper

ss-bass

 (ss-bass plist dur [:vel][:arpeg][:pos][:tab1][:tab2][:r][:mix][:bw])
 A 2 oscillator instrument with dynamic filter.

 plist  - list or flonum. List of MIDI key numbers. Alternatively a 
          single key number may be specified.

 dur    - flonum. Duration in seconds.

 :vel   - integer. Velocity 0 <= vel 128, default 64.

 :arpeg - flonum. Arpeggio interval, default 0

 :pos   - flonum or sound. Pan position as either a fixed number in
          interval (0,5) or a control signal over the same interval. 
          Default 0.5

 :tab1  - table. Primary wave table, default *saw-table*

 :tab2  - table. Secondary wave table, default *tri-table*

 :r     - flonum.Relative frequency of secondary wave, default 0.501

 :mix   - flonum. Relative mix of primary and secondary signals. 0.25 

 :bw    - flonum. Filter bandwidth

 return - sound vector. 


View the Sourcecode :



;; ss-bass.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
;;
;; Yet another instrument named "??bass", this one uses two oscillators and a
;; dynamic filter.
;; 

(require 'envelope )
(require 'reslp)
(require 'definst)
(require 'map)
(provide 'ss-bass)
(current-file "ss-bass")


;; Map velocity to filter mod depth in Khz
(setq ss-bass:*v-filter-map* (map:quad  0.5 5))


;; Two oscillator instrument with dynamic filter.
;; 

(definst ss-bass:voice (tab1 tab2 r mix vel bw)
  (let* ((r (or r 0.501))			;OSC 2 detune
	 (vel (or vel 64))
	 (bw (or bw 100))			;Filter band width
	 (mix (min (max (or mix 0.25) 0) 1)) ;Osc Mix
	 (filter (send ss-bass:*v-filter-map* :get vel))
	 (f1    (step-to-hz pitch))	;Osc 1 frq in Hz
	 (a1    (- 1 mix))		;Osc 1 amp
	 (w1    (or tab1 *saw-table*))	;Osc 1 wave
	 (f2    (* f1 r))	        ;Osc 2 frq in Hz
	 (a2    mix)  			;Osc 2 amp
	 (w2    (or tab2 *tri-table*))	;Osc 2 wave
	 (att   0.000)			;Attack
	 (dcy   0.500)			;Decay
	 (rel   0.300)			;Release time
	 (sus   (max 0 (- dur att dcy rel)))
	 (sl    0.125)			;Sustain Level
	 (kytrk 0.333)			;Filter key track
	 (floor 10)			;Filter floor
	 (fdepth (* filter 1000)))  	;Filter env mod depth
       (mult
	(reslp
	 (sum (scale a1 (osc pitch dur w1))
	      (scale a2 (osc (hz-to-step f2) dur w2)))
	 (sum (rgate (* 1.01 dur) (+ (* f1 kytrk) floor))
	      (scale fdepth (percussion dur)))
	 :bw bw)
	(adsr att dcy rel sus sl dur))))


;; @doc wrapper ss-bass
;; (ss-bass plist dur [:vel][:arpeg][:pos][:tab1][:tab2][:r][:mix][:bw])
;; A 2 oscillator instrument with dynamic filter.
;;
;; plist  - list or flonum. List of MIDI key numbers. Alternatively a 
;;          single key number may be specified.
;;
;; dur    - flonum. Duration in seconds.
;;
;; :vel   - integer. Velocity 0 <= vel 128, default 64.
;;
;; :arpeg - flonum. Arpeggio interval, default 0
;;
;; :pos   - flonum or sound. Pan position as either a fixed number in
;;          interval (0,5) or a control signal over the same interval. 
;;          Default 0.5
;;
;; :tab1  - table. Primary wave table, default *saw-table*
;;
;; :tab2  - table. Secondary wave table, default *tri-table*
;;
;; :r     - flonum.Relative frequency of secondary wave, default 0.501
;;
;; :mix   - flonum. Relative mix of primary and secondary signals. 0.25 
;;
;; :bw    - flonum. Filter bandwidth
;;
;; return - sound vector. 
;;

(defwrapper ss-bass #'ss-bass:voice #'definst:ampscale)


Main Page       Index