[LAD] Alsa works fine the default output but distorts/stutters with hw:0/plughw:0

Clemens Ladisch clemens at ladisch.de
Tue Jul 16 19:11:27 UTC 2013


Muffinman wrote:
>     snd_pcm_hw_params_any(alsa_handle, alsa_params);
>     snd_pcm_hw_params_set_access(alsa_handle, alsa_params, SND_PCM_ACCESS_RW_INTERLEAVED);
>     snd_pcm_hw_params_set_format(alsa_handle, alsa_params, SND_PCM_FORMAT_S16);
>     snd_pcm_hw_params_set_channels(alsa_handle, alsa_params, 2);
>     snd_pcm_hw_params_set_rate_near(alsa_handle, alsa_params, (unsigned int *)&sample_rate, &dir);

You must check for errors.

>     snd_pcm_uframes_t frames = 32;
>     snd_pcm_hw_params_set_period_size_near(alsa_handle, alsa_params, &frames, &dir);

Do you really need a period length of 7 ms?

You do not set the buffer size.  Try 0.5 s or something like that.


Regards,
Clemens


More information about the Linux-audio-dev mailing list