[ale] Generating sound

Brian Pitts brian at polibyte.com
Mon May 7 14:44:37 EDT 2007


Chuck Huber wrote:
> 
> Okay, admittedly I'm new to using sound cards beyond playing alert sounds and
> hooking up speakers for video/audio playback.
> 
> I need to generate a 1kHz tone and
>    a) emit this through a sound card to speakers
>    and b) convert this to an MP3 file.
> I can write a quick C program that will generate integer values in a sinusoidal
> fashion.  However, getting these values to a sound card is a mystery to me at
> this point.  Perhaps I'm thinking too low of a level - maybe the sound card will
> accept a command to generate a tone at a certain frequency.  Don't know.
> 
> Additionally, I'll need to capture the A/D input from the line input jack.  I
> *don't* need to do both at the same time.
>

I personally find all the sound servers, media frameworks, etc. in the linux world rather confusing. There's some sample code at 
http://equalarea.com/paul/alsa-audio.html#playex which looks like it will do some of what you want; I don't know if ALSA is the best layer for 
you to target.

-Brian



More information about the Ale mailing list