cluster.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
function
(cluster frq dur [n][start][fn][tab]) Generates clusters of enharmonic overtones by mixing n copies of harmonically rich waveform. frq - flonum. The "fundamental" frequency in Hertz. dur - flonum. Duration in seconds. :n - integer. Number of component tones produced. Default 4 :start - integer. The first partial number. By default a list of the first 168 primes is used to calculate the frequency ratio between components. start sets the initial element from the list. Higher start values produce higher harmonics. Since the prime list contains 168 elements, start+n must be less than 168. :tab - table. The wave table used for each component tone. *saw-table* is used by default, care needs to used to prevent aliasing. :fn - closure. The function used to calculate the component frequencies. The default is #'(lambda (i) (* frq (sqrt (float (nth (+ start i) +PRIMES+))))) return - sound.
function
(cluster:bass pitch dur [:n][:r][:tab][:env][:envfn]) A deeply flanged bass pitch - flonum. The MIDI key number. dur - flonum. Duration in seconds :n - int. Number of tone components, default 16 :r - flonum. Frequency ratio between compounds, Default 1.01 :tab - table. Wave table for each component. Default *saw-table* return - sound.
function
(cluster:kick [:frq][:n][:r][:dur]) A synth kick drum using cluster :frq - flonum. The tones frequency, default 55 Hz :dur - flonum. Duration, default 0.06 sec :n - integer. Cluster density, default 16 :r - flonum. Cluster frequency ratio, default 1.01 return - sound.
;; cluster.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 ;; ;; Cluster was originaly intended to produce synthetic cymbal sounds. ;; Apparently early Roland drum machines created cymbals in part by high-pass ;; filtering the sum of several square waves. Cluster is a failed attempt to ;; mimic this process. ;; (require 'primes) (require 'definst) (provide 'cluster) (current-file "cluster") ;; @doc function cluster ;; (cluster frq dur [n][start][fn][tab]) ;; Generates clusters of enharmonic overtones by mixing n copies of ;; harmonically rich waveform. ;; ;; frq - flonum. The "fundamental" frequency in Hertz. ;; ;; dur - flonum. Duration in seconds. ;; ;; :n - integer. Number of component tones produced. Default 4 ;; ;; :start - integer. The first partial number. By default a list ;; of the first 168 primes is used to calculate the frequency ratio ;; between components. start sets the initial element from the list. ;; Higher start values produce higher harmonics. Since the prime ;; list contains 168 elements, start+n must be less than 168. ;; ;; :tab - table. The wave table used for each component tone. *saw-table* is ;; used by default, care needs to used to prevent aliasing. ;; ;; :fn - closure. The function used to calculate the component frequencies. ;; The default is ;; #'(lambda (i) (* frq (sqrt (float (nth (+ start i) +PRIMES+))))) ;; ;; return - sound. ;; (defun cluster (frq dur &key n start fn tab) (let* ((start (or start 0)) (n (or n 4)) (tab (or tab *saw-table*)) (fn (or fn #'(lambda (i) (* frq (sqrt (float (nth (+ start i) +PRIMES+)))))))) (simrep (i n) (osc (hz-to-step (funcall fn i)) dur tab)))) ;; @doc function cluster:bass ;; (cluster:bass pitch dur [:n][:r][:tab][:env][:envfn]) ;; A deeply flanged bass ;; ;; pitch - flonum. The MIDI key number. ;; dur - flonum. Duration in seconds ;; :n - int. Number of tone components, default 16 ;; :r - flonum. Frequency ratio between compounds, Default 1.01 ;; :tab - table. Wave table for each component. Default *saw-table* ;; return - sound. ;; (definst cluster:bass (n r tab env envfn) (let* ((frq (step-to-hz pitch)) (n (or n 16)) (r (or r 1.01)) (tab (or tab *saw-table*)) (envfn (or envfn #'percussion)) (env (or env '()))) (mult (cluster frq dur :n n :tab tab :fn #'(lambda (i)(* frq (expt (float r) i)))) (percussion dur)))) ;; @doc function cluster:kick ;; (cluster:kick [:frq][:n][:r][:dur]) ;; A synth kick drum using cluster ;; ;; :frq - flonum. The tones frequency, default 55 Hz ;; :dur - flonum. Duration, default 0.06 sec ;; :n - integer. Cluster density, default 16 ;; :r - flonum. Cluster frequency ratio, default 1.01 ;; ;; return - sound. ;; (defun cluster:kick (&key frq n r dur) (cluster:bass (hz-to-step (or frq 55)) (or dur 0.06) :n (or n 16) :t (or r 1.01)))