All of lore.kernel.org
 help / color / mirror / Atom feed
* usb sampling rate (Re: start_threshold having no effect)
@ 2003-10-28  7:56 Tobias Peters
  2003-10-28 10:19 ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: Tobias Peters @ 2003-10-28  7:56 UTC (permalink / raw)
  To: alsa-devel

On Tue, 21 Oct 2003 14:26:24 +0200
Takashi Iwai <tiwai@suse.de> wrote:

> but 1ms period alignment is important:  if you want a RT process with
> the USB audio device, choose the sample rate with multiple of 1000.
> for example, avoid 44.1kHz, but use 48k instead.

Wouldn't the clocks of the usb and of the d/a converter get out sync
anyway, because of the drift? Why is a multiple of 1000 important then?

  Tobias



-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community?  Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: usb sampling rate (Re: start_threshold having no effect)
  2003-10-28  7:56 usb sampling rate (Re: start_threshold having no effect) Tobias Peters
@ 2003-10-28 10:19 ` Takashi Iwai
  2003-10-29 11:23   ` usb sampling rate Tobias Peters
  0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2003-10-28 10:19 UTC (permalink / raw)
  To: Tobias Peters; +Cc: alsa-devel

At Tue, 28 Oct 2003 08:56:37 +0100,
Tobias Peters wrote:
> 
> On Tue, 21 Oct 2003 14:26:24 +0200
> Takashi Iwai <tiwai@suse.de> wrote:
> 
> > but 1ms period alignment is important:  if you want a RT process with
> > the USB audio device, choose the sample rate with multiple of 1000.
> > for example, avoid 44.1kHz, but use 48k instead.
> 
> Wouldn't the clocks of the usb and of the d/a converter get out sync
> anyway, because of the drift? Why is a multiple of 1000 important then?

partly because the damn USB-1.1 specification and partly because of
the basic design of ALSA.  the USB-1.1 always invokes the interrupts
in 1ms period regardless of the sample rate.  meanwhile, the ALSA
assumes that the period size is constant in frames.

when the sample rate is the multple of 1000, e.g. 48kHz, 1ms
corresponds always to the integer frames (e.g. 48 frames).  so, it's
not big problem.

however, when you run 44.1kHz, the interrupt frequency is not in
integer frames, ie. 44.1 frames.  if the period size were variable,
this inconsistency can be compensated by changing the period size
occasionally (such as 44, 44, ..., 45, 44...).  instead, the current
USB driver updates two periods to compensate the delay.  this doesn't
work well if you use only two periods, typically in RT apps.


Takashi


-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community?  Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: usb sampling rate
  2003-10-28 10:19 ` Takashi Iwai
@ 2003-10-29 11:23   ` Tobias Peters
  0 siblings, 0 replies; 3+ messages in thread
From: Tobias Peters @ 2003-10-29 11:23 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Takashi Iwai wrote:
> At Tue, 28 Oct 2003 08:56:37 +0100,
> Tobias Peters wrote:
> 
>>On Tue, 21 Oct 2003 14:26:24 +0200
>>Takashi Iwai <tiwai@suse.de> wrote:
>>
>>
>>>but 1ms period alignment is important:  if you want a RT process with
>>>the USB audio device, choose the sample rate with multiple of 1000.
>>>for example, avoid 44.1kHz, but use 48k instead.
>>
>>Wouldn't the clocks of the usb and of the d/a converter get out sync
>>anyway, because of the drift? Why is a multiple of 1000 important then?
> 
> 
> partly because the damn USB-1.1 specification and partly because of
> the basic design of ALSA.  the USB-1.1 always invokes the interrupts
> in 1ms period regardless of the sample rate.  meanwhile, the ALSA
> assumes that the period size is constant in frames.
> 
> when the sample rate is the multple of 1000, e.g. 48kHz, 1ms
> corresponds always to the integer frames (e.g. 48 frames).  so, it's
> not big problem.

My concern is, that the 48kHz are unlikely to be exact 48000.000000Hz. 
The clock of the usb is also inexact. Both clocks will drift away from 
each other, and occurrences of 47 or 49 frames become possible. Thus, 
there cannot be any benefit from using 48kHz over 44.1kHz, or can there?

> however, when you run 44.1kHz, the interrupt frequency is not in
> integer frames, ie. 44.1 frames.  if the period size were variable,
> this inconsistency can be compensated by changing the period size
> occasionally (such as 44, 44, ..., 45, 44...).  instead, the current
> USB driver updates two periods to compensate the delay.  this doesn't
> work well if you use only two periods, typically in RT apps.

I see. This means an extra millisecond delay on both, capture and 
playback sides, doesn't it?

> 
> 
> Takashi





-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-10-29 11:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-28  7:56 usb sampling rate (Re: start_threshold having no effect) Tobias Peters
2003-10-28 10:19 ` Takashi Iwai
2003-10-29 11:23   ` usb sampling rate Tobias Peters

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.