Sine wave: Difference between revisions

119 bytes removed ,  2 years ago
(→‎{{header|Delphi}}: add Emacs Lisp)
Line 126:
<lang lisp>(defun play-sine (freq dur)
"Play a sine wave for dur seconds."
(setq header (concat unibyte-string ; AU header:
(unibyte-string 46 115 110 100) ; ".snd" magic number
(unibyte-string 0 0 0 24) ; start of data bytes
(unibyte-string 255 255 255 255) ; file size is unknown
(unibyte-string 0 0 0 3) ; 16 bit PCM samples
(unibyte-string 0 0 172 68) ; 44,100 samples/s
(unibyte-string 0 0 0 1))) ; mono
(setq s (apply #'concat header (mapcar (lambda (x) (unibyte-string
(mod (+ 128 (round (+ 128 (* 127 (sin
Anonymous user