[erlang-questions] Generating sine waves and/or audio stream output

Ivan Uemlianin ivan@REDACTED
Fri Mar 26 10:35:21 CET 2010


You've done all the hard work!

Thanks Willem.  I'll write a function to write a wav header and report 
back: I've got one I wrote in C somewhere; might be interesting to 
compare the two.

I'll also look into streaming to audio (there is esdl, an erlang binding 
for sdl, but that looks a bit hefty, and doesn'ty work with smp enabled 
erlang).

Best

Ivan

On 25/03/2010 19:04, Willem de Jong wrote:
> Hmm, I had forgotten about some of the complexities involved.
>
> I do not have a function that writes wav files. I put the pcm data 
> that is generated by this into a flash file. For wav files you have to 
> do add a header and framing, I believe.
>
> I added a function that puts together the parts of the sound. You can 
> write it to a file like this:
> > file:write_file("sinus.raw", sound:sound(440, 3, 0.5, sinus)).
>
> (440 hertz, 3 seconds, volume 0.5 (50%), sinus wave form).
>
> This file will be in "raw" format (pcm without headers). With the 
> current settings the sample rate is 22050, mono, sample size 16 bits 
> big endian.
>
> Regards,
> Willem

-- 
============================================================
Ivan A. Uemlianin
Speech Technology Research and Development

                     ivan@REDACTED
                      www.llaisdy.com
                          llaisdy.wordpress.com
                      www.linkedin.com/in/ivanuemlianin

     "Froh, froh! Wie seine Sonnen, seine Sonnen fliegen"
                      (Schiller, Beethoven)
============================================================



More information about the erlang-questions mailing list