eorgan.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 framework for electronic organ instruments.
function
(eorgan:register [a1 [a2 [a4 [a8 [a10 [a16]]]]]] Create wave table using relative frequencies 1 2 4 8 10 16 args - flonum. Relative amplitudes of corresponding harmonic return - table.
function
(eorgan:pregister [a3 [a6 [a12]]]) Create wave table using relative frequencies 3 6 12 args - flonum. Relative amplitudes of corresponding harmonic return - table.
function
(eorgan:voice pitch dur [:vib][:vfrq][:vdelay][:pmix][:ptab][:gtab]) Generates a single organ voice. The tone consist of two components; gated and percussive. pitch - flonum. MIDI note number dur - flonum. Duration in seconds :vib - flonum. Vibrato depth, normalized for MIDI controller range 0-127 :vfrq - flonum. Vibrato frequency in Hertz. Default 7 :vdelay - flonum. Vibrato delay time. default 0 :pmix - flonum. 0<= pmix <= 1. relative mix between percussive and gated components. Default 0.5 ptab - table. Percussive wave table. Default eorgan:*tab2* gtab - table. Percussive wave table. Default eorgan:*tab1* return - sound.
wrapper
(eorgan plist dur [:vel][:arpeg][:pos][:vib][:vfrq][:vdelay][:pmix][:ptab][:gtab]) An Electronic organ plist - list or flonum. A list of MIDI key numbers to be played. A single key number (flonum) may also be used. dur - flonum. The tones duration in seconds :vel - integer. MIDI velocity controls amplitude, default 64 :arpeg - flonum. Arpeggio interval, default 0 :pos - flonum or sound. Pan position, default 0.5 :vib - flonum. Vibrato depth, default 0 :vdelay - flonum. Vibrato delay time, default 0. :vfrq - flonum. Vibrato frequency, default 7.00 Hz. :vtab - table. Vibrato wave table, default *tri-table* :pmix - flonum. Relative amplitude of percussive component, default 0.5 :ptab - table. Percussive component wave table, default eorgan:*tab2* :gatb - table. "Gated" component wave table, default eorgan:*tab1* return - sound
;; eorgan.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 framework for electronic organ instruments. ;; (require 'envelope) (require 'wtab) (require 'dlfo) (require 'map) (require 'map-vibrato) (require 'definst) (provide 'eorgan) (current-file "eorgan") ;; Default gated frequencies (setq eorgan:*f-list* '(1 2 4 8 16)) ;; Default percussive frequencies (setq eorgan:*p-list* '(3 6 10 12)) ;; Default percussive decay time (setq eorgan:*p-decay* 0.25) ;; Combine list of frequencies and list of amplitudes ;; to list suitable for use with wtab:make ;; The shortest argument list determines length of result ;; ;; (eorgan:zip '(a b c) '(1 2 3 4)) ---> ((a 1)(b 2)(c 3)) ;; (defun eorgan:zip (f-list a-list) (if (and f-list a-list) (cons (list (car f-list)(car a-list)) (eorgan:zip (cdr f-list)(cdr a-list))) nil)) ;; @doc function eorgan:register ;; (eorgan:register [a1 [a2 [a4 [a8 [a10 [a16]]]]]] ;; Create wave table using relative frequencies 1 2 4 8 10 16 ;; ;; args - flonum. Relative amplitudes of corresponding harmonic ;; return - table. ;; (defun eorgan:register (&rest a-list) (wtab:make (eorgan:zip eorgan:*f-list* a-list))) ;; @doc function eorgan:pregister ;; (eorgan:pregister [a3 [a6 [a12]]]) ;; Create wave table using relative frequencies 3 6 12 ;; ;; args - flonum. Relative amplitudes of corresponding harmonic ;; return - table. ;; (defun eorgan:pregister (&rest a-list) (wtab:make (eorgan:zip eorgan:*p-list* a-list))) ;; The default otgan wave tables ;; (setq eorgan:*tab1* (eorgan:register 1.0 1.0 0.5 0.5 0.0) eorgan:*tab2* (eorgan:pregister 0.0 0.1 0.1 0.0) ) ;; @doc function eorgan:voice ;; (eorgan:voice pitch dur [:vib][:vfrq][:vdelay][:pmix][:ptab][:gtab]) ;; Generates a single organ voice. ;; The tone consist of two components; gated and percussive. ;; ;; pitch - flonum. MIDI note number ;; ;; dur - flonum. Duration in seconds ;; ;; :vib - flonum. Vibrato depth, normalized for MIDI controller range 0-127 ;; ;; :vfrq - flonum. Vibrato frequency in Hertz. Default 7 ;; ;; :vdelay - flonum. Vibrato delay time. default 0 ;; ;; :pmix - flonum. 0<= pmix <= 1. relative mix between percussive and gated ;; components. Default 0.5 ;; ;; ptab - table. Percussive wave table. Default eorgan:*tab2* ;; ;; gtab - table. Percussive wave table. Default eorgan:*tab1* ;; ;; return - sound. ;; (definst eorgan:voice (vib vfrq vdelay pmix ptab gtab) (let* ((hz (step-to-hz pitch)) ;(mi (* hz (or vib 0) 0.05)) (mi (* hz (send map:*vibrato* :get (or vib 0)))) (vfrq (or vfrq 7)) (vdelay (or vdelay 0)) (pmix (clamp 0 1 (or pmix 0.5))) (gmix (- 1 pmix)) (ptab (or ptab eorgan:*tab2*)) (gtab (or gtab eorgan:*tab1*)) (modsig (scale mi (dlfo vfrq dur :tab *tri-table* :delay (* 0.5 vdelay) :attack (* 0.5 vdelay) :phase 'random)))) (sum (mult (fmosc pitch modsig gtab) (rgate dur gmix)) (mult (fmosc pitch modsig ptab) (scale pmix (adsr 0 0.125 0 0 0.75 dur)))))) ;; @doc wrapper eorgan ;; (eorgan plist dur [:vel][:arpeg][:pos][:vib][:vfrq][:vdelay][:pmix][:ptab][:gtab]) ;; An Electronic organ ;; ;; plist - list or flonum. A list of MIDI key numbers to be played. A single key ;; number (flonum) may also be used. ;; ;; dur - flonum. The tones duration in seconds ;; ;; :vel - integer. MIDI velocity controls amplitude, default 64 ;; ;; :arpeg - flonum. Arpeggio interval, default 0 ;; ;; :pos - flonum or sound. Pan position, default 0.5 ;; ;; :vib - flonum. Vibrato depth, default 0 ;; ;; :vdelay - flonum. Vibrato delay time, default 0. ;; ;; :vfrq - flonum. Vibrato frequency, default 7.00 Hz. ;; ;; :vtab - table. Vibrato wave table, default *tri-table* ;; ;; :pmix - flonum. Relative amplitude of percussive component, default 0.5 ;; ;; :ptab - table. Percussive component wave table, default eorgan:*tab2* ;; ;; :gatb - table. "Gated" component wave table, default eorgan:*tab1* ;; ;; return - sound ;; (defwrapper eorgan #'eorgan:voice #'definst:ampscale)