sb-simple-audio is a library that provides a simple interface to audio I/O. It is limited to SBCL and Linux (using OSS).

An example:

(defparameter *volume* 0.05) (defun single-tone (frequency) "Sounds a tone of the specified frequency, indefinitely." (with-open-stream (stream (sb-simple-audio:open-audio :sample-rate 44100 :direction :output)) (let ((phase 0.0d0) (phase-increment (* 2 pi (/ frequency (sb-simple-audio:sample-rate stream)))) (amplitude (coerce (* *volume* (sb-simple-audio:max-amplitude stream)) 'double-float)) (offset (sb-simple-audio:offset stream))) (loop (setf phase (mod (+ phase phase-increment) (* 2 pi))) (write-byte (+ offset (round (* amplitude (sin phase)))) stream))))) (single-tone 600)

It could for instance be used for playing and recording music or in any other kind of audio signal processing.

Download Archive