* What is the required accuracy of audio sampling rate?
@ 2010-02-16 23:58 Yiliang Bao
2010-02-17 3:08 ` pl bossart
2010-02-17 12:52 ` James Courtier-Dutton
0 siblings, 2 replies; 5+ messages in thread
From: Yiliang Bao @ 2010-02-16 23:58 UTC (permalink / raw)
To: alsa-devel
Hi,
I have a PCI-e audio card that does not give very accurate sampling rate
(about -0.2% error, i.e., if I set the sampling rate to 8K, I got only 7984
samples per second on average). It caused various synchronization problems
in applications like gstreamer.
Since there will be some difference from one clock domain to another, I am
wondering if there is any defined tolerance on the sampling rate, and where
the right place is to correct this kind of error. I would really appreciate
if someone can point me to the related documents/links.
Thanks,
Yiliang
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What is the required accuracy of audio sampling rate?
2010-02-16 23:58 What is the required accuracy of audio sampling rate? Yiliang Bao
@ 2010-02-17 3:08 ` pl bossart
2010-02-17 12:52 ` James Courtier-Dutton
1 sibling, 0 replies; 5+ messages in thread
From: pl bossart @ 2010-02-17 3:08 UTC (permalink / raw)
To: Yiliang Bao; +Cc: alsa-devel
> I have a PCI-e audio card that does not give very accurate sampling rate
> (about -0.2% error, i.e., if I set the sampling rate to 8K, I got only 7984
> samples per second on average). It caused various synchronization problems
> in applications like gstreamer.
Can you be more specific on your sync issues? Generally the audio
clock is used as reference, and video adjusts to it.
> Since there will be some difference from one clock domain to another, I am
> wondering if there is any defined tolerance on the sampling rate, and where
> the right place is to correct this kind of error. I would really appreciate
> if someone can point me to the related documents/links.
It really depends on the standard, and if you are slave or master.
Each standard has its own requirements. For example an AES-EBU
interface will require 10ppm for professional uses as a source, and
less as a sink. HDAudio requires the nominal BCLK 24MHz frequency to
be between 23.9976 and 24.0024 MHz. I don't think on an I2S link there
are such requirements, the frequency will depend on how accurate the
audio PLL is.
Note that the actual frequency is only one of the parameters
influencing audio quality, jitter issues are much worse. If your clock
is slightly off but remains stable, you are usually good. If it varies
you'll have real audible quality issues.
- Pierre
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What is the required accuracy of audio sampling rate?
2010-02-16 23:58 What is the required accuracy of audio sampling rate? Yiliang Bao
2010-02-17 3:08 ` pl bossart
@ 2010-02-17 12:52 ` James Courtier-Dutton
2010-02-17 13:03 ` Jon Smirl
1 sibling, 1 reply; 5+ messages in thread
From: James Courtier-Dutton @ 2010-02-17 12:52 UTC (permalink / raw)
To: Yiliang Bao; +Cc: alsa-devel
On 16 February 2010 23:58, Yiliang Bao <yiliangb@gmail.com> wrote:
> Hi,
>
> I have a PCI-e audio card that does not give very accurate sampling rate
> (about -0.2% error, i.e., if I set the sampling rate to 8K, I got only 7984
> samples per second on average). It caused various synchronization problems
> in applications like gstreamer.
>
> Since there will be some difference from one clock domain to another, I am
> wondering if there is any defined tolerance on the sampling rate, and where
> the right place is to correct this kind of error. I would really appreciate
> if someone can point me to the related documents/links.
>
There is no defined tolerance on sampling rate.
Audio apps should be able to deal with a certain amount of error.
xine uses the system clock for its synchronization, and resamples the
audio output if the audio hardware is running at a different rate.
Other apps might use the audio clock and sync to that. In that case,
it might get the problems you describe.
Try playing your media in xine and see if the problem disappears.
Kind Regards
James
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What is the required accuracy of audio sampling rate?
2010-02-17 12:52 ` James Courtier-Dutton
@ 2010-02-17 13:03 ` Jon Smirl
2010-02-17 17:14 ` Yiliang Bao
0 siblings, 1 reply; 5+ messages in thread
From: Jon Smirl @ 2010-02-17 13:03 UTC (permalink / raw)
To: James Courtier-Dutton; +Cc: Yiliang Bao, alsa-devel
On Wed, Feb 17, 2010 at 7:52 AM, James Courtier-Dutton
<james.dutton@gmail.com> wrote:
> On 16 February 2010 23:58, Yiliang Bao <yiliangb@gmail.com> wrote:
>> Hi,
>>
>> I have a PCI-e audio card that does not give very accurate sampling rate
>> (about -0.2% error, i.e., if I set the sampling rate to 8K, I got only 7984
>> samples per second on average). It caused various synchronization problems
>> in applications like gstreamer.
>>
>> Since there will be some difference from one clock domain to another, I am
>> wondering if there is any defined tolerance on the sampling rate, and where
>> the right place is to correct this kind of error. I would really appreciate
>> if someone can point me to the related documents/links.
>>
>
> There is no defined tolerance on sampling rate.
> Audio apps should be able to deal with a certain amount of error.
> xine uses the system clock for its synchronization, and resamples the
> audio output if the audio hardware is running at a different rate.
> Other apps might use the audio clock and sync to that. In that case,
> it might get the problems you describe.
> Try playing your media in xine and see if the problem disappears.
The -0.2% error is cumulative, not random. After a three hour movie
your audio will be off by 20 seconds.
Best solution is the get the audio clock synched as closely as
possible to the video one. Any remaining error has to be dealt with in
software like xine does.
>
> Kind Regards
>
> James
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
--
Jon Smirl
jonsmirl@gmail.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: What is the required accuracy of audio sampling rate?
2010-02-17 13:03 ` Jon Smirl
@ 2010-02-17 17:14 ` Yiliang Bao
0 siblings, 0 replies; 5+ messages in thread
From: Yiliang Bao @ 2010-02-17 17:14 UTC (permalink / raw)
To: Jon Smirl; +Cc: alsa-devel, James Courtier-Dutton
Hi,
Thanks for all the replies. To reply Pierre's question:
> Can you be more specific on your sync issues? Generally the audio clock is
used as reference, and video adjusts to it.
I played the audio using gstreamer alsasrc and alsasink. The audio plays
well at the beginning, and gradually the sound becomes broken, and
eventually unlistenable. If I play the audio along with video, there is a
similar issue. In addition to the problem in the audio channel, the video
will become intermittent as well after some time. I think the gstreamer is
dropping video frames trying to synchronize the video with audio.
Similar to what is suggested here, I did some experiment on the audio driver
so that its output is synchronized to the kernel clock, and the problems are
gone (at least for the testing period of 2 hours). This confirms that the
issues were indeed caused by inaccuracy in audio sampling rate and it
appears gstreamer is not adaptive enough to accommodate such sampling error.
Thanks,
Yiliang
On Wed, Feb 17, 2010 at 5:03 AM, Jon Smirl <jonsmirl@gmail.com> wrote:
> On Wed, Feb 17, 2010 at 7:52 AM, James Courtier-Dutton
> <james.dutton@gmail.com> wrote:
> > On 16 February 2010 23:58, Yiliang Bao <yiliangb@gmail.com> wrote:
> >> Hi,
> >>
> >> I have a PCI-e audio card that does not give very accurate sampling rate
> >> (about -0.2% error, i.e., if I set the sampling rate to 8K, I got only
> 7984
> >> samples per second on average). It caused various synchronization
> problems
> >> in applications like gstreamer.
> >>
> >> Since there will be some difference from one clock domain to another, I
> am
> >> wondering if there is any defined tolerance on the sampling rate, and
> where
> >> the right place is to correct this kind of error. I would really
> appreciate
> >> if someone can point me to the related documents/links.
> >>
> >
> > There is no defined tolerance on sampling rate.
> > Audio apps should be able to deal with a certain amount of error.
> > xine uses the system clock for its synchronization, and resamples the
> > audio output if the audio hardware is running at a different rate.
> > Other apps might use the audio clock and sync to that. In that case,
> > it might get the problems you describe.
> > Try playing your media in xine and see if the problem disappears.
>
> The -0.2% error is cumulative, not random. After a three hour movie
> your audio will be off by 20 seconds.
>
> Best solution is the get the audio clock synched as closely as
> possible to the video one. Any remaining error has to be dealt with in
> software like xine does.
>
>
> >
> > Kind Regards
> >
> > James
> > _______________________________________________
> > Alsa-devel mailing list
> > Alsa-devel@alsa-project.org
> > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> >
>
>
>
> --
> Jon Smirl
> jonsmirl@gmail.com
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-02-17 17:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-16 23:58 What is the required accuracy of audio sampling rate? Yiliang Bao
2010-02-17 3:08 ` pl bossart
2010-02-17 12:52 ` James Courtier-Dutton
2010-02-17 13:03 ` Jon Smirl
2010-02-17 17:14 ` Yiliang Bao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).