Re: [linux-audio-user] Re: asoundrc and aplay

From: Sampo Savolainen <v2@email-addr-hidden>
Date: Fri Feb 17 2006 - 10:34:00 EET

Quoting conrad berhörster <conrad.berhoerster@email-addr-hidden>:

> i need that inputs not in a harddisk recording / pro audio way. all i
> need is
> getting the signal into the app, use some effects and put them out again.
> no
> sample sync, no need for "realtime". all inputs are independed.
> Than i have read http://alsa.opensrc.org/TwoCardsAsOne.
> is this page wrong!
> i thought, one big advantage of jack is, to handle more than one card.

Jack works only with one soundcard, or an array of sample-synced soundcards.
Nothing else.

You do need sample sync to make your idea work properly. Sample sync, or you
dump the idea of using jackd and do resampling in the code.

Here is the reason:

Soundcard 1 -> Application -> Soundcard 2

Looks simple, eh? It's simple because it's wrong. The truth is this:

Soundcard 1 -> Application -> Soundcard 2
 @44102hz @44092hz

(This is due to the fact that no two crystals are the same)

What happens in this scenario? When you are running the application for a
period of say, 10 minutes, the output you hear from soundcard 2 lags about
0.136 seconds. After 20 minutes, it lags about 0.272 seconds, etc.

The reason for this? While soundcard 1 takes in 44102 samples per
real-world-second, soundcard two outputs only 44092 samples in that time.

If soundcard 2 would have a faster crystal than soundcard 1, you'd be in a
heap of trouble. For every buffer you would write to soundcard2 you would
get an underrun where soundcard 2 isn't fed data fast enough (altough, exact
error frequency depends on the buffering scheme used).

> yes, i know. i have read them too. maybe you can explain, what you mean
> exactly with the notion "multichannel device". Is it just a couple of
> IOs,
> without sync, or are the requirements for pro audios (with sync).

With multichannel, we mean "audio devices running in parallel or serial in
the same signal chain".

> if all this stuff isn't possible, do you have any idea to fix the
> problem.

Either use only one soundcard (if you are recording from one and playing
back on the other one, i don't see why you couldn't use one soundcard), or
don't use jack and resample between the two soundcards. Altough, getting a
software resampler to perfectly sync two non-synced cards is a mean feat.

If you want to use two soundcards as one, the best option is to: wordclock
them. That is, to make them sample-sync.

Sorry. But this is how it is.

  Sampo
Received on Fri Feb 17 12:15:05 2006

This archive was generated by hypermail 2.1.8 : Fri Feb 17 2006 - 12:15:06 EET