barfly.lsp Version 1.00 24 December 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 4-component additive instrument with complex tremolo ISSUE: BUGGY. Tremolo rates should be different for each component.
wrapper
(barfly plist dur vel pos arpeg a d stretch trem tfrq) An additive instrument with 4 harmonic blocks plist - flonum or list. The MIDI note(s) to be played. dur - flonum. Duration in seconds vel - flonum. The MIDI velocity controls the absolute amplitude of the composite signal as well as the relative amplitude of the high frequency harmonics. Default 64 pos - flonum or sound. Default 0.5 arpeg - flonum. Arpeggio iteration rate. Default 0 a - flonum. Attack rate as MIDI controller value. The attack time is different for each of the 4 components with higher frequencies being slower. Over the MIDI controller range of 0-128 the fundamental attack time varies between 0 and 1.3 seconds. Default a=1 --> 0.01 seconds d - flonum. Decay rate as MIDI controller value. The decay times is different for each of the 4 components. Higher d values have the effect similar of sweeping a high-pass filter. stretch - flonum. Amount of scale "stretching" applied. The stretch value is not to be confused with the common use of "stretch" in Nyquist parlance. Higher stretch values cause higher harmonics to become increasingly sharp. Relatively low stretch introduces chorusing, higher stretches become increasingly enharmonic. Default 8 trem - flonum. MIDI control over tremolo depth. Default 0 tfrq - flonum. MIDI control over tremolo rate. Each of the 4 components has a slightly different tremolo rate. Default 4 return - sound vector.
;; barfly.lsp ;; Version 1.00 24 December 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 4-component additive instrument with complex tremolo ;; ISSUE: BUGGY. Tremolo rates should be different for each component. ;; (require 'wtab) (require 'tremolo) (require 'map) (require 'map-vel3) (require 'definst) (provide 'barfly) (current-file "barfly") (setq barfly:*vel-db-map* map:*vel3*) (setq barfly:*tab1* *sine-table* barfly:*tab2* (wtab:make '((2 0.500)(3 0.333))) barfly:*tab3* (wtab:make '((4 0.250)(5 0.200)(6 0.167)(7 0.143))) barfly:*tab4* (wtab:make (wtab:make-plist 32 :frqfn #'(lambda (i)(+ i 7)) :ampfn #'(lambda (i)(/ 1.0 (+ i 7))))) ) (defun barfly:osc (pitch dur tab &key r a d tfrq trem env) (let* ((hz (step-to-hz pitch)) (r (or r 1.00)) (a (or a 0.001)) (d (or d 0.001)) (tfrq (or tfrq 1.000)) (trem (or trem 0))) (mult (tremolo (osc (hz-to-step (* r hz)) dur tab) dur :trate tfrq :trem trem) (or env (asd a (max 0 (- dur a d)) d))))) (defun barfly:voice (pitch dur &key (vel 64)(a 1.0)(d 1.0)(stretch 8)(trem 0)(tfrq 4)) (let (sf db) (setq sf (/ stretch 128.0)) (setq db (send barfly:*vel-db-map* :get vel)) (setq trem (/ trem 128.0)) (setq tfrq (/ tfrq 128.0)) (sum (scale-db db (barfly:osc pitch dur barfly:*tab1* :a (* a 0.01) :d (* d 0.01))) (scale-db (* db 1.50)(barfly:osc pitch dur barfly:*tab2* :a (* a 0.02) :d (* d 0.02) :r (+ 1 (* sf 0.01)) :tfrq (* tfrq 2) :trem (* trem 1.00))) (scale-db (* db 3.00)(barfly:osc pitch dur barfly:*tab3* :a (* a 0.03) :d (* d 0.03) :r (+ 1 (* sf 0.10)) :tfrq (* tfrq 3.33) :trem (* trem 1.00))) (scale-db (* db 6.00)(barfly:osc pitch dur barfly:*tab4* :a (* a 0.10) :d (* d 0.50) :r (+ 1 (* sf 0.20)) :tfrq 4; (* tfrq 4.67) :trem (* trem 1.00))) ))) ;; @doc wrapper barfly ;; (barfly plist dur vel pos arpeg a d stretch trem tfrq) ;; An additive instrument with 4 harmonic blocks ;; ;; plist - flonum or list. The MIDI note(s) to be played. ;; ;; dur - flonum. Duration in seconds ;; ;; vel - flonum. The MIDI velocity controls the absolute amplitude of the ;; composite signal as well as the relative amplitude of the high ;; frequency harmonics. Default 64 ;; ;; pos - flonum or sound. Default 0.5 ;; ;; arpeg - flonum. Arpeggio iteration rate. Default 0 ;; ;; a - flonum. Attack rate as MIDI controller value. The attack time is ;; different for each of the 4 components with higher frequencies ;; being slower. Over the MIDI controller range of 0-128 the ;; fundamental attack time varies between 0 and 1.3 seconds. ;; Default a=1 --> 0.01 seconds ;; ;; d - flonum. Decay rate as MIDI controller value. The decay times is ;; different for each of the 4 components. Higher d values have ;; the effect similar of sweeping a high-pass filter. ;; ;; stretch - flonum. Amount of scale "stretching" applied. The stretch value ;; is not to be confused with the common use of "stretch" in Nyquist ;; parlance. Higher stretch values cause higher harmonics to become ;; increasingly sharp. Relatively low stretch introduces chorusing, ;; higher stretches become increasingly enharmonic. Default 8 ;; ;; trem - flonum. MIDI control over tremolo depth. Default 0 ;; ;; tfrq - flonum. MIDI control over tremolo rate. Each of the 4 components ;; has a slightly different tremolo rate. Default 4 ;; ;; return - sound vector. ;; (defwrapper barfly #'barfly:voice)