Sine wave: Difference between revisions

Content added Content deleted
Line 134: Line 134:
0 0 0 1)) ; mono
0 0 0 1)) ; mono
(setq s (apply #'concat header (mapcar (lambda (x) (unibyte-string
(setq s (apply #'concat header (mapcar (lambda (x) (unibyte-string
(mod (+ 128 (round (+ 128 (* 127 (sin
(mod (round (* 127 (sin (* 2 pi freq x (/ 44100.0))))) 256) 0))
(* 2 pi freq x (/ 44100.0))))))) 256) 0))
(number-sequence 0 (* dur 44100)))))
(number-sequence 0 (* dur 44100)))))
(play-sound `(sound :data ,s)))
(play-sound `(sound :data ,s)))