MichaƂ Kowalczyk wrote:
>       SND_PCM_FORMAT_U8, //changing this type for any other gives an error in 
> the output: segmentation fault.

U8 has one byte per sample; if you try to use a bigger sample format,
you have to enlarge the buffer accordingly.

>       1, //argument responsible for channels; if I change it to 2(stereo) 
> program gives an segmentation fault error.

Using two channels would double the buffer size, too.

>       48000, //sampling rate; works good but if I modify this to lower value 
> the time of generating noise will be longer, don't know why.

If the sample rate is lower, you need more timer to play the same number
of samples.

>                 frames = snd_pcm_writei(handle, buffer, sizeof(buffer));

The last parameter is measued in frames, not in bytes.  When you use
another sample format than U8/S8 or more then one channel, you have to
divide the buffer size by the number of bytes per frame.


HTH
Clemens

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user

Reply via email to