[alsa-devel] How to play a pcm file

Clemens Ladisch cladisch at fastmail.net
Thu Apr 26 08:36:34 CEST 2007


Flávio Yuiti wrote:
> I did a test with pcm file and the sound is playing very fast,
> 
>   snd_pcm_open(&handleSound,"hw:0,0",SND_PCM_STREAM_PLAYBACK,0)

Use "default" as device name.  Using "hw" will prevent any automatic
sample format/rate conversions.

>   //snd_pcm_hw_params_set_rate(handleSound,hardwareParam,8000,0);

This shouldn't be commented out, and you should check the return
values of all these functions.


HTH
Clemens


More information about the Alsa-devel mailing list