Main Page       Index


vibraphone.lsp


 vibraphone.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 vibraphone. The simulation is produced by summing an attack
 transient and a looped sustain section. The sustain section is both
 frequency and amplitude modulated.


wrapper

vibraphone

 (vibraphone plist dur [:vel][:arpeg][:pos][:detune][:mix][:vfrq1][:vfrq2][:vib][:trem])
 A vibraphone simulation

 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

 :detune  - flonum. Default 1

 :mix    - flonum. Relative mix of component transient and body
           components. Default 0.5

 :vfrq1  - flonum. Frequency of first modulation signal, default 1
 
 :vfrq2  - flonum. Frequency of seconds modulation signal, default 8

 :vib    - flonum. Vibrato depth, default 84

 :trem   - flonum. Tremolo depth, default 64
 
 return  - sound vector.


View the Sourcecode :



;; vibraphone.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 vibraphone. The simulation is produced by summing an attack
;; transient and a looped sustain section. The sustain section is both
;; frequency and amplitude modulated.
;; 

(require 'definst)
(require 'wtab)
(require 'math)
(provide 'vibraphone)
(current-file "vibraphone")


(setq 
 					;Sustain wave table
 vibraphone:*TAB-1*   (wtab:make '(( 1 1.000)
				   ( 2 0.025)
				   ( 3 0.025)
				   ( 4 0.218)
				   ( 9 0.009)
				   (10 0.032)))

					;Transient wave table
 vibraphone:*TAB-2* (wtab:make '(( 1 1.000)
				 ( 2 0.030)
				 ( 4 0.718)
				 (10 1.000)
				 (15 0.186)
				 (20 0.107)
				 (21 0.216)))
 
					;Tremolo wave table
 vibraphone:*TAB-3* (wtab:make '((1 0.333)(8 1.000)))
 )


(definst vibraphone:voice (detune mix vfrq1 vfrq2 vib trem )
  (let* ((detune (or detune 1.00))
	 (mix (min (max (or mix 0.5) 0) 1))
	 (vfrq1 (or vfrq1 1.00))
	 (vfrq2 (or vfrq2 8.00))
	 (vib (* (or vib 84) 0.0156))
	 (trem (* (or trem 64) 0.0156))
	 (f (* detune (step-to-hz pitch)))
	 (p (hz-to-step f))
	 (vib-fm-amp (* f vib 0.015))
	 (vib-am-amp (* trem 0.500))
	 (vib-am-sig  (lfo vfrq1 dur vibraphone:*TAB-3*))
	 (strike-decay  0.200))
    (sim (mult (osc p dur vibraphone:*TAB-2*)
	       (scale mix (percussion strike-decay)))
	 (mult (fmosc p (scale vib-fm-amp (lfo vfrq2 dur)) vibraphone:*TAB-1*)
	       (mult (sim (rgate dur)(scale vib-am-amp vib-am-sig))
		     (scale (- 1 mix)(percussion dur)))))))


;; @doc wrapper vibraphone
;; (vibraphone plist dur [:vel][:arpeg][:pos][:detune][:mix][:vfrq1][:vfrq2][:vib][:trem])
;; A vibraphone simulation
;;
;; 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
;;
;; :detune  - flonum. Default 1
;;
;; :mix    - flonum. Relative mix of component transient and body
;;           components. Default 0.5
;;
;; :vfrq1  - flonum. Frequency of first modulation signal, default 1
;; 
;; :vfrq2  - flonum. Frequency of seconds modulation signal, default 8
;;
;; :vib    - flonum. Vibrato depth, default 84
;;
;; :trem   - flonum. Tremolo depth, default 64
;; 
;; return  - sound vector.
;;

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


Main Page       Index