RosettaCodeData/Task/Record-sound/Common-Lisp/record-sound.lisp
2015-11-18 06:14:39 +00:00

11 lines
355 B
Common Lisp

(defun record (n)
(with-open-file (in "/dev/dsp" :element-type '(unsigned-byte 8))
(loop repeat n collect (read-byte in))
)
)
(defun play (byte-list)
(with-open-file (out "/dev/dsp" :direction :output :element-type '(unsigned-byte 8) :if-exists :append)
(mapcar (lambda (b) (write-byte b out)) byte-list)
)
)
(play (record 65536))