pno.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 An early attempt at a synthesized piano instrument. The sound is at best superficially piano like. I have found it useful nonetheless.
wrapper
(pno plst dur [:vel][:arpeg][:pos][:mix][:detune][:tdecay]) A superficially piano like instrument with arpeggio. The sound is produced by the combination of two complex waves. plst - list. List of MIDI key numbers to be played. Alternatively a single key number may be used dur - flonum. The primary tones duration in seconds. Default 2.00 :mix - flonum. The mix ratio between the two waveforms. 0 <= mix <= 1. Default 0.5 :detune - flonum. The frequency ratio of the transient waveform to the primary waveform. Default 1.00 :tdecay - flonum. The decay time for the "transient" waveform. Default 0.5 :arpeg - flonum. Time between notes in plist, default 0 :pos - flonum. Pan position either as a fixed number in interval (0,1) or a control signal in the same interval. Default 0.5 return - sound vector.
wrapper
(pno:wha plst [:dur][:detune][:arpeg][:depth][:bw][:fenv][:pos]) Version of pno with dynamic band-pass filter. plst - list. List of MIDI key numbers to be played. Alternatively a single key number may be used dur - flonum. The primary tones duration in seconds. Default 2.00 :mix - flonum. The mix ratio between the two waveforms. 0 <= mix <= 1. Default 0.5 :detune - flonum. The frequency ratio of the transient waveform to the primary waveform. Default 1.00 :tdecay - flonum. The decay time for the "transient" waveform. Default 0.5 :arpeg - flonum. Time between notes in plist, default 0 :pos - flonum. Pan position either as a fixed number in interval (0,1) or a control signal in the same interval. Default 0.5 :depth - flonum. Filter sweep depth in KHz. Default 1 :bw - flonum. Filter bandwidth. Default 100 :fenv - list or sound. The filter envelope may either be a control signal or a list of envelope parameters. See uenv in envelope.lsp Default is an exponentially decaying signal over the duration of the tone. return - sound vector.
;; pno.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 ;; ;; An early attempt at a synthesized piano instrument. The sound is at best ;; superficially piano like. I have found it useful nonetheless. ;; (require 'wtab) (require 'definst) (provide 'pno) (current-file "pno") (setq pno:*loop-tab* (wtab:make '(( 1 0.400) ( 2 0.116) ( 3 1.000) ( 4 1.000) ( 5 0.202) ( 6 0.285) ( 7 0.460) ( 8 0.029) ( 9 0.133) (10 0.215))) pno:*t-tab* (wtab:make '(( 1 1.000) ( 2 0.500) ( 3 1.000) ( 4 0.800) ( 5 0.200) ( 6 0.400) ( 7 0.400) ( 8 0.070) ( 9 0.070) (10 0.170) (13 0.180) (15 0.190)))) (definst pno:voice (mix detune tdecay) (let* ((tdur (or tdecay 0.500)) ;transient decay (tamp (min (max 0 (or mix 0.5)) 1)) ;transient amp (detune (or detune 1.00)) (tpitch (hz-to-step (* detune (step-to-hz pitch))))) (sim (mult (osc tpitch dur pno:*t-tab*)(scale tamp (percussion tdur))) (mult (osc pitch dur pno:*loop-tab*)(scale (- 1 tamp )(percussion dur)))))) ;; @doc wrapper pno ;; (pno plst dur [:vel][:arpeg][:pos][:mix][:detune][:tdecay]) ;; A superficially piano like instrument with arpeggio. ;; The sound is produced by the combination of two complex waves. ;; ;; plst - list. List of MIDI key numbers to be played. Alternatively a ;; single key number may be used ;; ;; dur - flonum. The primary tones duration in seconds. Default 2.00 ;; ;; :mix - flonum. The mix ratio between the two waveforms. ;; 0 <= mix <= 1. Default 0.5 ;; ;; :detune - flonum. The frequency ratio of the transient waveform to the ;; primary waveform. Default 1.00 ;; ;; :tdecay - flonum. The decay time for the "transient" waveform. ;; Default 0.5 ;; ;; :arpeg - flonum. Time between notes in plist, default 0 ;; ;; :pos - flonum. Pan position either as a fixed number in interval (0,1) ;; or a control signal in the same interval. Default 0.5 ;; ;; return - sound vector. ;; (defwrapper pno #'pno:voice #'definst:ampscale) ;; @doc wrapper pno:wha ;; (pno:wha plst [:dur][:detune][:arpeg][:depth][:bw][:fenv][:pos]) ;; Version of pno with dynamic band-pass filter. ;; plst - list. List of MIDI key numbers to be played. Alternatively a ;; single key number may be used ;; ;; dur - flonum. The primary tones duration in seconds. Default 2.00 ;; ;; :mix - flonum. The mix ratio between the two waveforms. ;; 0 <= mix <= 1. Default 0.5 ;; ;; :detune - flonum. The frequency ratio of the transient waveform to the ;; primary waveform. Default 1.00 ;; ;; :tdecay - flonum. The decay time for the "transient" waveform. ;; Default 0.5 ;; ;; :arpeg - flonum. Time between notes in plist, default 0 ;; ;; :pos - flonum. Pan position either as a fixed number in interval (0,1) ;; or a control signal in the same interval. Default 0.5 ;; ;; :depth - flonum. Filter sweep depth in KHz. Default 1 ;; ;; :bw - flonum. Filter bandwidth. Default 100 ;; ;; :fenv - list or sound. The filter envelope may either be a control ;; signal or a list of envelope parameters. ;; See uenv in envelope.lsp Default ;; is an exponentially decaying signal over the duration of the ;; tone. ;; ;; return - sound vector. ;; (defwrapper pno:wha #'pno:voice #'(lambda (sig args) (let ((depth (get-keyword-value ':DEPTH args 1000)) (bw (get-keyword-value ':BW args 100)) (fenvfn (get-keyword-value ':FENVFN args #'percussion)) (fenv (get-keyword-value ':FENV args '()))) (reson sig (scale depth (funcall fenvfn dur fenv)) bw 1))))