Sound/video drivers

Joe Armstrong (AL/EAB) <>
Wed Mar 2 11:18:52 CET 2005


   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?

   The input is a microphone connected to my sound card
   Output is through the sound card

   I'm thinking of some raw driver here:

	I'd like to say:

	P = open_sound( Options),
	loop(P).

	loop(P) ->
	    receive
		{P, Sound} ->
			.... received Sound ...
	   end.

	I guess Options must say something about sampling rates etc.
	

   2) What is sound?
	
	ie in the above program what is the type of Sound? -
        
	Assume Sound is a tuple {Descriptor, Bin}
	Where Bin is just sound data, then Descriptor would have to describe Bin

	What would descriptor be? Something like {EncodeingMethod, Args} but what would these be.

   3) How can I encode sound with codecs?

	I'd like to write:

	encode(From, To, Codec) ->
	   receive
	       {From, Sound} ->
		{Sound1, Codec1} = Codec(Sound),
		To ! {self(), Sound1},
		encode(From, To, Codec1)
	   end.
	 
     Video? - same questions for video - with microphone replaced by web_cam

     Has anybody some Erlang code that does all of this?

    Cheers

/Joe

   




More information about the erlang-questions mailing list