Sound/video drivers

Mickael Remond <>
Wed Mar 2 12:02:24 CET 2005


Joe Armstrong (AL/EAB) wrote:
>    Questions about sound: 
> 
>     I'd like to do the following:
>      
>     -  From a microphone connected to the sound card  of my (Linux) PC I'd like to get  I get {raw,Bin} sound 
>        messages here raw might mean that Bin represents 20 KHz, 8 bit samples or something.
>  
>     -  I'd  like to send these to a codec process and get back (say)  {codec23, Bin'} messages.
> 
>      - I ship these over the net with UDP/RTP (or something) 
> 
>      - then turn these back into {raw, Bin''} messages and 
> 
>      - send these to my soundcard  
>  
>     So:
> 
>     
>    1) How can I get sound into/out of my PC to an Erlang program?

If your target is only Linux, you have devices to send sound to. Try to 
cat a file to /dev/audio for example and hear the nice result :-)
/dev/audio is for playing sound. /dev/dsp is for reading sound.

However this solution is Linux only and might not be what you want.

Another solution would be to use SDL, which is a multiplatform library. 
An Erlang SDL binding currently exist.
You will need to dig into the SDL sound API.

I wonder how you plan to cut the sound into small Erlang messages and to 
synchronize playing of those messages at the other end (One sample 
should not be replayed before the previous one ends).

-- 
Mickaël Rémond
  http://www.erlang-projects.org/



More information about the erlang-questions mailing list