Modified your drum machine code a bit…
;type generate
;name "Simple Sequencer"
;control filename "Select a mono WAV file" file "" "*default*/drum.wav" "WAV file|*.wav;*.WAV" "open,exists"
;control number "Number of beats" int "" 8 1 31
;control tempo "Tempo" int "bpm" 120 30 300
;control pat "Place every" choice "1 beat, 2 beats, 3 beats, 4 beats" 3
(setf pat (+ pat 1))
(defun get-sound (fname)
(let ((fp (open fname)))
(cond
(fp (close fp)
(s-read filename))
(t (format nil "Error.~%~s~%cannot be opened."
fname)))))
(defun do-sequence (d-snd)
(let ((delay (* (/ 60.0 tempo) pat))
(out (s-rest 0)))
(dotimes (i number out)
(setf out
(sim out
(at (* i delay) (cue d-snd)))))))
(let ((drum-snd (get-sound filename)))
(if (arrayp drum-snd)
(format nil "Error.~%~s~%is stereo."
filename)
(do-sequence drum-snd)))
Really quick and simple to add samples now.
Samples used:
(All wav, mono)
SampleSounds.zip (124 KB)