Main Page       Index


synsax.lsp

 synsax.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 synthetic saxophone using combination of additive and FM.


wrapper

synsax

 (synsax plist dur [:vel][:arpeg][:pos][:mi][:r][:detune])
 A synthetic saxophone

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

 dur     - flonum. Duration in seconds.

 :vel    - integer. MIDI velocity, 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

 :r      - flonum. The carrier/modulator ratio, default 1.001

 :mi     - flonum. The modulation index, default 1.00

 :detune - flonum. Relative detune, default 1.00

 return  - sound vector.


View the Sourcecode :



;; synsax.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 synthetic saxophone using combination of additive and FM.
;; 

(require 'wtab)
(require 'definst)
(provide 'synsax)
(current-file "synsax")


(setq synsax:*ATAB*   (wtab:make  '(( 1  0.850)
				    ( 2  0.730)
				    ( 3  0.530)
				    ( 4  0.760)
				    ( 5  1.000)
				    ( 6  0.530)
				    ( 7  0.260)
				    ( 8  0.080)
				    ( 9  0.080)
				    (10  0.240)
				    (11  0.300)
				    (12  0.360)
				    (13  0.230)
				    (14  0.150)
				    (15  0.130)
				    (16  0.060)
				    (17  0.200)
				    (18  0.260)
				    (19  0.180)
				    (20  0.180))))


(definst synsax:voice (mi r detune)
  (let* ((dur (or dur 1))
	 (detune (or detune 1.00))
	 (mi (or mi 1.000))
	 (f0 (* detune (step-to-hz  pitch)))
	 (r1  (or r 1.001))
	 (f1  (* f0 r1))
	 (a1  (* f0 mi))
	 (attack-1  0.05)
	 (attack-2  0.15)
	 (decay     0.00)
	 (sustain (- dur attack-1 attack-2 decay)))
    (mult (fmosc (hz-to-step f0)
		 (mult (osc (hz-to-step f1) dur )
		       (scale a1 (adsr attack-2 attack-1 sustain decay)))
		 synsax:*ATAB*)
	  (env attack-1 attack-2 decay 0.75 1.00 0.900 dur))))


;; @doc wrapper synsax
;; (synsax plist dur [:vel][:arpeg][:pos][:mi][:r][:detune])
;; A synthetic saxophone
;;
;; plist   - list or flonum. List of MIDI key numbers. Alternatively a single 
;;           key number may be specified.
;;
;; dur     - flonum. Duration in seconds.
;;
;; :vel    - integer. MIDI velocity, 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
;;
;; :r      - flonum. The carrier/modulator ratio, default 1.001
;;
;; :mi     - flonum. The modulation index, default 1.00
;;
;; :detune - flonum. Relative detune, default 1.00
;;
;; return  - sound vector.
;;

(defwrapper synsax #'synsax:voice #'definst:ampscale)


Main Page       Index