Main Page       Index


fmbass.lsp


 fmbass.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 percussive bass instrument


function

fmbass

 (fmbass  pitch [:dur][:vel][:r][:tab][:pos])
 Bass instrument

 pitch  - flonum. MIDI key number.

 :dur   - flonum. Decay time in seconds. Default 1.0

 :vel   - flonum. MIDI Velocity effects modulation index and output amplitude

 :r     - flonum. Modulation ratio. Default 0.5

 :tab   - table. Carrier wave table. Default *sine-table*

 :pos   - flonum. Pan position. May be either numeric value in interval
          (0,1) or a control signal in the same interval. Default 0.5

 return - vector. A 2 channel sound


View the Sourcecode :



;; fmbass.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 percussive bass instrument
;; 

(require 'envelope)
(require 'map)
(require 'map-vel3)
(provide 'fmbass)
(current-file "fmbass")


(setq fmbass:*vmap* (map:linear 1.0 6.0))


;; @doc function fmbass
;; (fmbass  pitch [:dur][:vel][:r][:tab][:pos])
;; Bass instrument
;;
;; pitch  - flonum. MIDI key number.
;;
;; :dur   - flonum. Decay time in seconds. Default 1.0
;;
;; :vel   - flonum. MIDI Velocity effects modulation index and output amplitude
;;
;; :r     - flonum. Modulation ratio. Default 0.5
;;
;; :tab   - table. Carrier wave table. Default *sine-table*
;;
;; :pos   - flonum. Pan position. May be either numeric value in interval
;;          (0,1) or a control signal in the same interval. Default 0.5
;;
;; return - vector. A 2 channel sound
;;

(defun fmbass  (pitch dur &key vel r tab pos)
  (let* ((vel (or vel 64))
	 (r (or r 0.50))
	 (tab (or tab *sine-table*))
	 (chz (step-to-hz pitch))
	 (mi (send fmbass:*vmap* :get vel))
	 (env (percussion dur))
	 (modsig (mult (sine (hz-to-step (* chz r)) dur)
		       (scale (* chz mi) env))))

    (pan
     (scale-db  (send map:*vel3* :get vel )  ; (+ 0.5 (* .125 vel))
	    (mult (fmosc pitch modsig tab) env))
     (or pos 0.5))))


Main Page       Index