ALSA bindings for Common Lisp
Common Lisp
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
README.md
also-alsa.asd
also-alsa.lisp
package.lisp

README.md

Basic ALSA bindings for Common Lisp

A small subset of ALSA interface for Common Lisp.

PCM streams are encapsulated in ALSO-ALSA:PCM-STREAM instances.

To play random noise on default stereo device:

(defconstant +buffer-size+ 256)
(defconstant +sample-rate+ 8000)
(defconstant +channels+ 2)


(also-alsa:with-alsa-device (pcm "default" +buffer-size+ '(signed-byte 16) :direction :output
	                                          :channels-count +channels+ :sample-rate +sample-rate+)
	(loop repeat 10 do
		(loop for pos from 0 below (* +channels+ (also-alsa:buffer-size pcm)) do
		(setf (also-alsa:ref pcm pos) (coerce (- (random 65535) 32767) '(signed-byte 16)))
		(also-alsa:alsa-write pcm))))