Main Page       Index


pbass.lsp


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

 Bass instrument with portamento.


function

pbass

 (pbass  pblst [:dur][:vel][:r1][:i1][:r2][:i2][:decay2][:accent][:pos])
 pbass is a single carrier/double modulator FM instrument with portamento and
 percussive envelope.

 bplist  - list. Portamento break-point list of the form 
           ((K0 D0 [T0])(K1 D1 [T1]) ... (Kn Dn [Tn})) 
           See port.lsp for details.

 :dur    - flonum. Normally the decay time is determined by the portamento
           list "duration". The dur key word may be used to produce a 
           shorter (but not longer) decay time.  Default NIL

 :vel    - integer. MIDI velocity --> -+6db, default 64

 :r1     - flonum. Primary FM modulator frequency ratio. Default 0.501

 :i1     - flonum. Primary modulation index. Default 4.00

 :r2     - flonum. Secondary FM modulator frequency ratio. Default 5.725

 :i2     - flonum. Secondary modulation index. Default 5.00

 :decay2 - flonum. Decay time for secondary modulator. By default the 2nd
           modulator has a very short decay.  Default 0.100

 :accent - flonum. A somewhat redundant argument which scale the
           modulation index of both modulators simultaneously.
           0 <= accent <= 127. Default 0

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

 return  - vector of 2 sounds.


View the Sourcecode :



;; pbass.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
;;
;; Bass instrument with portamento.
;; 

(require 'port)
(require 'linfn)
(require 'map)
(require 'map-vel6)
(provide 'pbase)
(current-file "pbass")


;; Accent MIDI controllr 0-127 --> Modulatin index
(deflin2 pbass:*amap* 0 1 127 4)


(setq pbass:*vmap* map:*vel6*)


;; @doc function pbass 
;; (pbass  pblst [:dur][:vel][:r1][:i1][:r2][:i2][:decay2][:accent][:pos])
;; pbass is a single carrier/double modulator FM instrument with portamento and
;; percussive envelope.
;;
;; bplist  - list. Portamento break-point list of the form 
;;           ((K0 D0 [T0])(K1 D1 [T1]) ... (Kn Dn [Tn})) 
;;           See port.lsp for details.
;;
;; :dur    - flonum. Normally the decay time is determined by the portamento
;;           list "duration". The dur key word may be used to produce a 
;;           shorter (but not longer) decay time.  Default NIL
;;
;; :vel    - integer. MIDI velocity --> -+6db, default 64
;;
;; :r1     - flonum. Primary FM modulator frequency ratio. Default 0.501
;;
;; :i1     - flonum. Primary modulation index. Default 4.00
;;
;; :r2     - flonum. Secondary FM modulator frequency ratio. Default 5.725
;;
;; :i2     - flonum. Secondary modulation index. Default 5.00
;;
;; :decay2 - flonum. Decay time for secondary modulator. By default the 2nd
;;           modulator has a very short decay.  Default 0.100
;;
;; :accent - flonum. A somewhat redundant argument which scale the
;;           modulation index of both modulators simultaneously.
;;           0 <= accent <= 127. Default 0
;;
;; :pos    - flonum. Pan position either as a fixed number in the interval 
;;          (0,1) or a control signal over the same interval. Default 0.5
;;
;; return  - vector of 2 sounds.
;;

(defun pbass (bplst &key vel dur r1 i1 r2 i2 decay2 accent pos)
  (let* ((dur (or dur (port:get-bplist-duration bplst)))
	 (penv (port bplst))
	 (accent-scale (pbass:*amap* (or accent 0)))
	 (r1 (or r1 0.501))
	 (i1 (* accent-scale (or i1 4.00)))
	 (decay1 dur)
	 (r2 (or r2 5.725))
	 (i2 (* accent-scale (or i2 5.00)))
	 (decay2 (or decay2 0.100)))
    (scale-db (send pbass:*vmap* :get (or vel 64))
	      (pan 
	       (port:fm-cop penv dur
			    :am (percussion dur)
			    :fm (sum (port:fm-mop penv dur r1 i1 :am (percussion decay1))
				     (port:fm-mop penv dur r2 i2 :am (percussion decay2))))
	       (or pos 0.5)))))


Main Page       Index