Thomas Eschenbacher | 9 Jul 20:42 2009
Picon
Picon

how to process multiple channels

Hello,

I now would like to use libsamplerate in my application, which is able
to handle an arbitrary number of channels.

My program internally has all channels seperately, so one possible
implementation would be to multiplex all <N> channels into one
interleaved stream, processing them with one converter that I opened
with src_new(..., <N>,...), and then demultiplex into seperate streams
again.

But what I would prefer is to handle all channels seperately, without
cumbersome multiplexing/demultiplexing, with one converter per channel.
This would also allow me to make use of multithreading on SMP machines,
which speeds up operation a lot.

My question now:

Would this be possible without loss or would I lose phase information
between the channels, e.g. would I lose the stereo effect?

thanks,
   Thomas
--

-- 
______________________________________________________________________
Thomas Eschenbacher                       <Thomas.Eschenbacher@...>
------------------------------------------------------------
Secret Rabbit Code (aka libsamplerate) Mailing List
To unsubscribe: 
      <mailto:src-request@...?Subject=unsubscribe>
(Continue reading)

Erik de Castro Lopo | 10 Jul 00:02 2009

Re: how to process multiple channels

Thomas Eschenbacher wrote:

> My program internally has all channels seperately, so one possible
> implementation would be to multiplex all <N> channels into one
> interleaved stream, processing them with one converter that I opened
> with src_new(..., <N>,...), and then demultiplex into seperate streams
> again.
> 
> But what I would prefer is to handle all channels seperately, without
> cumbersome multiplexing/demultiplexing,

For more than 2 channels, I am almost certain that the cumbersome
multiplexing/demultiplexing will consume less CPU that processing
N channels separately. As N goes up, the gains by doing the
multiplexing/demultiplexing would increase.

> My question now:
> 
> Would this be possible without loss or would I lose phase information
> between the channels, e.g. would I lose the stereo effect?

As long as you keep all operations across channels in lock step,
there should not be any difference in the processing of any channel.
I would consider it a bug if there was.

Erik
--

-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
(Continue reading)

Poor Yorick | 10 Jul 01:16 2009

Re: x86_64: callback_test fails

Erik de Castro Lopo wrote:
 > Poor Yorick wrote:
 >
 >> with gcc-4.3.3 and and older (2.3.6) glibc:
 >>
 >>             callback_test    (SRC ratio = 0.3333) ........... ok
 >>             callback_test    (SRC ratio = 0.7890) ...........
 >>
 >>     Line 141 : input / output length mismatch.
 >>
 >>         input len  : 10000
 >>         output len : 7889 (should be 7890 +/- 1)
 >>
 >>     make[1]: Leaving directory `/path/to/libsamplerate-0.1.7/tests'
 >>     make[1]: *** [check] Error 1
 >>     make: *** [check-recursive] Error 1
 >>
 >> Any ideas?
 >
 > Yes, its a minor difference in rounding between ie86 and x86_64.
 >
 >>  Can libsamplerate still be considered usable if it fails this test?
 >
 > Yes, still usable.
 >

Thanks.  I found a patch on the Gentoo site that deals with this issue.
My notes here:

https://www.pooryorick.com/secure/wiki/Pub/CallbackTestOutputLen7889ShouldBe7890PlusMinus1
(Continue reading)

Thomas Eschenbacher | 10 Jul 06:58 2009
Picon
Picon

Re: how to process multiple channels

Erik de Castro Lopo wrote:
> [...]
>> My question now:
>>
>> Would this be possible without loss or would I lose phase information
>> between the channels, e.g. would I lose the stereo effect?
> 
> As long as you keep all operations across channels in lock step,
> there should not be any difference in the processing of any channel.
> I would consider it a bug if there was.

Yes, that's what I expect also.

I only wondered because I also evaluated using the soundtouch library
and found the following paragraph in the README:

[snip]
The sample data can have either single (mono) or double (stereo) audio
channel. Stereo data is interleaved so that every other data value is
for left channel and every second for right channel. Notice that while
it'd be possible in theory to process stereo sound as two separate mono
channels, this isn't recommended because processing the channels
separately would result in losing the phase coherency between the
channels, which consequently would ruin the stereo effect.
[snap]
(cited from http://www.surina.net/soundtouch/README.html, section 3.1)

So I wondered whether libsamplerate would suffer the same?

BTW: Finally I decided to use libsamplerate because it has a stable API
(Continue reading)


Gmane