trisynth.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 duel oscillator instrument with optional vibrato, pitch bend and ring modulation
function
(trisynth:one pitch dur [:tab][:vib][:fm][:env][:att][:dec][:rel][:sl]) Simple instrument pitch - flonum. dur - flonum. :tab - table. Wave table, default *tri-table* :vib - flonum. Vibrato depth as MIDI controller value, default 0 :fm - sound. Vibrato signal, amplitude should be normalized to -/+ 1, default silence :env - sound. Amplitude envelope, default nil :att - flonum. Attack time. Ignored if :env specified :dec - flonum. Decay time. Ignored if :env specified :rel - flonum. Release time. Ignored if :env specified :sl - flonum. Sustain level. Ignored if :env specified return - sound
function
(trisynth:two pitch dur [:r][:pb][:pbenv][:tab][:vib][:fm][:env][:att][:dec][:rel][:sl]) Instrument with pitch bend pitch - flonum. dur - flonum. :r - flonum. Detune amount, default 1.00 :pb - flonum. Pitch bend amount as MIDI controller. The default of 64 produces 0 bend. Values less then 64 bend down, greater then 64 bend up. :pbenv - sound. Pitch bend envelope, should be normalized to amplitude of 1. Default percussion. :tab - table. Wave table, default *tri-table* :vib - flonum. Vibrato depth as MIDI controller value, default 0 :fm - sound. Vibrato signal, amplitude should be normalized to -/+ 1, default silence :env - sound. Amplitude envelope, default nil :att - flonum. Attack time. Ignored if :env specified :dec - flonum. Decay time. Ignored if :env specified :rel - flonum. Release time. Ignored if :env specified :sl - flonum. Sustain level. Ignored if :env specified return - sound
function
(trisynth:voice pitch dur [:vib][:vfrq][:vdelay][:rm][:tab1][:env1][:r][:pb][:pbenv][:tab2][:env2]) Duel oscillator instrument with delayed onset vibrato and pitch bend on oscillator 2 pitch - flonum. dur - flonum. :vib - flonum. Vibrato depth as MIDI controller, default 0 :vfrq - flonum. Vibrato frequency in Hertz, default 5.0 :vdelay - flonum. Vibrato delay, default 0 :rm - bool. If true use ring modulation, default nil :tab1 - table. Wave table osc 1, default *tri -table* :env1 - sound. Amplitude envelope osc 1, default nil :r - flonum. Detune ratio osc 2, default 1.00 :pb - flonum. Osc 2 pitch bend amount as MIDI controller. The default of 64 produces 0 bend. Values less then 64 bend down, greater then 64 bend up. :pbenv - sound. Osc 2 pitch bend envelope, should be normalized to amplitude of 1. Default percussion. :tab2 - table. Wave table osc 2, default *tri -table* :env2 - sound. Amplitude envelope osc 2, default nil return sound.
wrapper
(trisynth plist dur [:vel][:arpeg][:pos][:vib][:vfrq][:vdelay][:rm][:tab1][:env1][:r][:pb][:pbenv][:tab2][:env2]) Duel oscillator polyphonic instrument with delayed onset vibrato, pitch bend and optional ring modulation. plist - list or flonum. MIDI key number(s) dur - flonum. :vel - flonum. MIDI velocity, default 64 :arpeg - flonum. Arpeggio time, default 0 :pos - flonum or sound. Pan position, default 0.5 :vib - flonum. Vibrato depth as MIDI controller, default 0 :vfrq - flonum. Vibrato frequency in Hertz, default 5.0 :vdelay - flonum. Vibrato delay, default 0 :rm - bool. If true use ring modulation, default nil :tab1 - table. Wave table osc 1, default *tri -table* :env1 - sound. Amplitude envelope osc 1, default nil :r - flonum. Detune ratio osc 2, default 1.00 :pb - flonum. Osc 2 pitch bend amount as MIDI controller. The default of 64 produces 0 bend. Values less then 64 bend down, greater then 64 bend up. :pbenv - sound. Osc 2 pitch bend envelope, should be normalized to amplitude of 1. Default percussion. :tab2 - table. Wave table osc 2, default *tri -table* :env2 - sound. Amplitude envelope osc 2, default nil return - sound vector.
;; trisynth.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 duel oscillator instrument with optional vibrato, pitch bend and ring modulation ;; (require 'definst) (require 'map) (require 'map-vibrato) (require 'dlfo) (provide 'trisynth) (current-file "trisynth") ;; @doc function trisynth:one ;; (trisynth:one pitch dur [:tab][:vib][:fm][:env][:att][:dec][:rel][:sl]) ;; Simple instrument ;; ;; pitch - flonum. ;; dur - flonum. ;; :tab - table. Wave table, default *tri-table* ;; :vib - flonum. Vibrato depth as MIDI controller value, default 0 ;; :fm - sound. Vibrato signal, amplitude should be normalized to -/+ 1, ;; default silence ;; :env - sound. Amplitude envelope, default nil ;; :att - flonum. Attack time. Ignored if :env specified ;; :dec - flonum. Decay time. Ignored if :env specified ;; :rel - flonum. Release time. Ignored if :env specified ;; :sl - flonum. Sustain level. Ignored if :env specified ;; ;; return - sound ;; (defun trisynth:one (pitch dur &key tab vib fm env att dec rel sl) (let (hz vamp) (setq hz (step-to-hz pitch)) (setq vamp (map:vibrato hz (or vib 0))) (setq fm (or fm (s-rest 1))) (setq att (or att 0.05) dec (or dec 0.20) rel (or rel 0.20) sl (or sl 0.75)) (mult (fmosc pitch (scale vamp fm) (or tab *tri-table*)) (uenv (or env (adsr att dec 0 rel sl dur)))))) (setq trisynth:*pbmap* (map:linear -0.5 +0.5)) ;; @doc function trisynth:two ;; (trisynth:two pitch dur [:r][:pb][:pbenv][:tab][:vib][:fm][:env][:att][:dec][:rel][:sl]) ;; Instrument with pitch bend ;; ;; pitch - flonum. ;; dur - flonum. ;; :r - flonum. Detune amount, default 1.00 ;; :pb - flonum. Pitch bend amount as MIDI controller. ;; The default of 64 produces 0 bend. ;; Values less then 64 bend down, greater then 64 bend up. ;; ;; :pbenv - sound. Pitch bend envelope, should be normalized to amplitude of 1. ;; Default percussion. ;; :tab - table. Wave table, default *tri-table* ;; :vib - flonum. Vibrato depth as MIDI controller value, default 0 ;; :fm - sound. Vibrato signal, amplitude should be normalized to -/+ 1, ;; default silence ;; :env - sound. Amplitude envelope, default nil ;; :att - flonum. Attack time. Ignored if :env specified ;; :dec - flonum. Decay time. Ignored if :env specified ;; :rel - flonum. Release time. Ignored if :env specified ;; :sl - flonum. Sustain level. Ignored if :env specified ;; ;; return - sound ;; (defun trisynth:two (pitch dur &key r pb pbenv tab vib fm env att dec rel sl) (let (hz vamp pbamp) (setq hz (* (step-to-hz pitch) (or r 1.00))) (setq pb (send trisynth:*pbmap* :get (or pb 64))) (setq pbamp (* pb hz)) (setq pbenv (uenv (or pbenv (percussion dur)))) (setq tab (or tab *tri-table*)) (setq vamp (map:vibrato hz (or vib 0))) (setq fm (or fm (s-rest))) (setq att (or att 0.00)) (setq dec (or dec 0.20)) (setq rel (or rel 0.50)) (setq sl (or sl 0.50)) (mult (fmosc (hz-to-step hz) (sum (scale pbamp pbenv) (scale vamp fm)) tab) (uenv (or env (adsr att dec 0 rel sl dur)))))) ;; @doc function trisynth:voice ;; (trisynth:voice pitch dur [:vib][:vfrq][:vdelay][:rm][:tab1][:env1][:r][:pb][:pbenv][:tab2][:env2]) ;; Duel oscillator instrument with delayed onset vibrato and pitch bend on ;; oscillator 2 ;; ;; pitch - flonum. ;; dur - flonum. ;; :vib - flonum. Vibrato depth as MIDI controller, default 0 ;; :vfrq - flonum. Vibrato frequency in Hertz, default 5.0 ;; :vdelay - flonum. Vibrato delay, default 0 ;; :rm - bool. If true use ring modulation, default nil ;; :tab1 - table. Wave table osc 1, default *tri -table* ;; :env1 - sound. Amplitude envelope osc 1, default nil ;; :r - flonum. Detune ratio osc 2, default 1.00 ;; :pb - flonum. Osc 2 pitch bend amount as MIDI controller. ;; The default of 64 produces 0 bend. ;; Values less then 64 bend down, greater then 64 bend up. ;; :pbenv - sound. Osc 2 pitch bend envelope, should be normalized to ;; amplitude of 1. Default percussion. ;; :tab2 - table. Wave table osc 2, default *tri -table* ;; :env2 - sound. Amplitude envelope osc 2, default nil ;; ;; return sound. ;; (defun trisynth:voice (pitch dur &key vib vfrq vdelay rm tab1 env1 r pb pbenv tab2 env2) (let (vsig vattack sig1 sig2) (setq vdelay (* 0.75 (or vdelay 0))) (setq vattack (* 0.25 (or vdelay 0))) (setq vfrq (or vfrq 5.00)) (setq vsig (dlfo vfrq dur :delay vdelay :attack vattack)) (setq sig1 (trisynth:one pitch dur :tab tab1 :vib vib :fm vsig :env env1)) (setq sig2 (trisynth:two pitch dur :r r :pb pb :pbenv pbenv :tab tab2 :vib vib :fm vsig :env env2)) (if rm (mult sig1 sig2) (sum sig1 sig2)))) ;; @doc wrapper trisynth ;; (trisynth plist dur [:vel][:arpeg][:pos][:vib][:vfrq][:vdelay][:rm][:tab1][:env1][:r][:pb][:pbenv][:tab2][:env2]) ;; Duel oscillator polyphonic instrument with delayed onset vibrato, pitch ;; bend and optional ring modulation. ;; ;; plist - list or flonum. MIDI key number(s) ;; dur - flonum. ;; :vel - flonum. MIDI velocity, default 64 ;; :arpeg - flonum. Arpeggio time, default 0 ;; :pos - flonum or sound. Pan position, default 0.5 ;; :vib - flonum. Vibrato depth as MIDI controller, default 0 ;; :vfrq - flonum. Vibrato frequency in Hertz, default 5.0 ;; :vdelay - flonum. Vibrato delay, default 0 ;; :rm - bool. If true use ring modulation, default nil ;; :tab1 - table. Wave table osc 1, default *tri -table* ;; :env1 - sound. Amplitude envelope osc 1, default nil ;; :r - flonum. Detune ratio osc 2, default 1.00 ;; :pb - flonum. Osc 2 pitch bend amount as MIDI controller. ;; The default of 64 produces 0 bend. ;; Values less then 64 bend down, greater then 64 bend up. ;; :pbenv - sound. Osc 2 pitch bend envelope, should be normalized to ;; amplitude of 1. Default percussion. ;; :tab2 - table. Wave table osc 2, default *tri -table* ;; :env2 - sound. Amplitude envelope osc 2, default nil ;; ;; return - sound vector. ;; (defwrapper trisynth #'trisynth:voice #'definst:ampscale)