Re: Playback of captured audio has many errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan Newmarch wrote:
> I can capture sound to a file from a C program. I can play from the file. But
> when i try to playback captured audio directly I get many errors.

Both devices' clocks must be synchronized (this is usually the case only
if they are on the same card), and to avoid underruns, you must fill the
playback buffer as much as possible before starting playback.  In other
words, increase the start threshold on the playback device.

>     if ((nread = snd_pcm_readi (capture_handle, buf, BUF_SIZE)) != BUF_SIZE) {
>       fprintf (stderr, "read from audio interface failed (%s)\n",
> 	       snd_strerror (nread));

Please note that if an error occurs when some data has already been
read, you get the number of frames read; an actual error code is
returned only from a snd_pcm_readi call that returns no data.
(Same for snd_pcm_writei.)


Regards,
Clemens

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user


[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux