ball.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 sequencer similar to qball but designed specifically for percussion instruments. See qball.lsp
function
(rball n unit count cuelist ilist fnlist reset [args...]) An algorithmic sequencer specifically for percussive sounds. Rball is a variant of qball specifically for functions with the lambda form (lambda (&optional index [keywords-arguments])) The pfw and procussion functions have this form. n - integer. Number of loop iterations. unit - flonum or symbol. The basic time unit may be specified directly as a number or by a symbol representing a time unit. See tempo.lsp for a list of valid symbols. count - integer. Number of basic time units per iteration. One way to look at the interaction of n, unit and count is that unit and count set a basic time signature while n sets the number of "bars". cuelist - list. The cue list sets the basic rhythm. Elements of cuelist are flonum and represent the event times in terms of the basic unit. ilist - list or flonum. The initial argument to pfw and procussion instrument functions select a variation of the basic sound. ilist is a list of possible variations. If ilist is a number all events will have the same value. If ilist is a list of integers the variations are utilized in a circular manner. fnlist - list or closure. fnlist is a list (or single object) of the possible sound generating functions. Like most other list the contents of fnlist are used in a circular manner. Valid closures have the form (lambda [variation [keywords...]]) Several pfw and procussion functions have this form. reset - bool. If true the index used to access ilist, fnlist elements is reset on each iteration making each iteration sound the same. If false the index is not reset and the next iteration begins where the previous one ended. args - cons. This one is a bit complex but allows for an arbitrary number of keyword elements to be passed to the sound generating function. Each keyword you wish to pass is specified as a cons cell with the form (keysym . valuelist) where keysym is a keyword symbol and valuelist is a list of possible values for keysym. Like most other list in qball the elements of valuelist are utilized in a circular manner. return - sound or sound vector.
;; ball.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 sequencer similar to qball but designed specifically for percussion ;; instruments. See qball.lsp ;; (require 'tempo) (require 'slice) (provide 'rball) (current-file "rball") (setf rball:*debug* nil) (defun rball:aggregate (index ilist &optional keylist) (let ((rs (list (circular index ilist)))) (if keylist (dolist (k keylist) (let ((key (car k)) (arg (circular index (cdr k)))) (setq rs (append rs (list key arg)))))) rs)) ;; @doc function rball ;; (rball n unit count cuelist ilist fnlist reset [args...]) ;; An algorithmic sequencer specifically for percussive sounds. ;; ;; Rball is a variant of qball specifically for functions with the lambda form ;; ;; (lambda (&optional index [keywords-arguments])) ;; ;; The pfw and procussion functions have this form. ;; ;; n - integer. Number of loop iterations. ;; ;; unit - flonum or symbol. The basic time unit may be specified directly ;; as a number or by a symbol representing a time unit. ;; See tempo.lsp for a list of valid symbols. ;; ;; count - integer. Number of basic time units per iteration. One way to look ;; at the interaction of n, unit and count is that unit and count set ;; a basic time signature while n sets the number of "bars". ;; ;; cuelist - list. The cue list sets the basic rhythm. Elements of cuelist are ;; flonum and represent the event times in terms of the basic unit. ;; ;; ilist - list or flonum. The initial argument to pfw and procussion ;; instrument functions select a variation of the basic sound. ilist ;; is a list of possible variations. If ilist is a number all events ;; will have the same value. If ilist is a list of integers the ;; variations are utilized in a circular manner. ;; ;; fnlist - list or closure. fnlist is a list (or single object) of the ;; possible sound generating functions. Like most other list the ;; contents of fnlist are used in a circular manner. Valid closures ;; have the form (lambda [variation [keywords...]]) ;; Several pfw and procussion functions have this form. ;; ;; reset - bool. If true the index used to access ilist, fnlist elements ;; is reset on each iteration making each iteration sound ;; the same. If false the index is not reset and the next iteration ;; begins where the previous one ended. ;; ;; args - cons. This one is a bit complex but allows for an arbitrary number ;; of keyword elements to be passed to the sound generating function. ;; Each keyword you wish to pass is specified as a cons ;; cell with the form (keysym . valuelist) where keysym is a keyword ;; symbol and valuelist is a list of possible values for keysym. Like ;; most other list in qball the elements of valuelist are utilized in ;; a circular manner. ;; ;; return - sound or sound vector. ;; (defun rball (n unit count cuelist ilist fnlist reset &rest args) (setq ilist (->list ilist)) (setq fnlist (->list fnlist)) (let (utime ltime index start) (setq utime (get-time-symbol-value unit)) (setq ltime (* count utime)) (setq index -1) (simrep (rep n) (progn (setq start (* rep ltime)) (if reset (setq index -1)) (simrep (i (length cuelist)) (progn (setq index (+ index 1)) (at (+ start (* utime (nth i cuelist))) (cue (progn (if rball:*debug* (display "rball debug" i index (rball:aggregate index ilist args))) (apply (circular index fnlist) (rball:aggregate index ilist args)) )))))))))