Subject: Re: [ecasound] realtime processing of channels separately
From: Kai Vehmanen (k@eca.cx)
Date: Sun Jun 03 2001 - 22:07:44 EEST
On Wed, 30 May 2001, David Cook wrote:
> I want to apply a different EQ to left and right channels of a stereo input
> with stereo output in realtime. I've tried variations on the following
[...]
> ecasound -b:128 -a:1,2 -i foo.wav -a:1,2 -f:16,2,44100 -o /dev/dsp0 \
> -a:1 -f:16,2,44100 -erc:1,1 \
> -el:mbeq_1197,-70,-70,-70,-70,-70,-70,-70,-70,-70,-70,-70,-70,-70,-70,-70 \
> -a:2 -f:16,1,44100 -erc:2,1 -el:mbeq_1197,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
You have to use a bit different approach. The basic idea is...
1) attach your n-channel file to multiple ecasound chains
-> each chain has n channels of audio (ch-1 ... ch-n)
2) add effects normally to the chains
3) add one (or more) -eac effects (amplify channel) to each chain
-> this is used to mute all unwanted channels
4) make sure that there is no overlap between channels
-> ie. for each channel, only one chain contains
audio (= is not muted)
5) attach a multichannel output file to the same chains
I'll use -efl and -efh in the following example:
--cut--
#!/bin/sh
ecasound -b:1024 -a:1,2 -i foo-2ch.wav -a:1,2 -f:16,2,44100 -o /dev/dsp \
-a:1 -efl:1000 \
-eac:0,2 \
-a:2 -efh:4000 \
-eac:0,1
--cut--
Due to the mixdown algorithm (out_amplitude[x] = chains_sum[x] /
chain-count), the resulting audio has lower volume than the original input
file. To fix this (without loss of precision), add -ea:200 to each chain
(if you have 3 chain -> -ea:300, 4 -> -ea:400 and so on) ... or you can be
explicit about it, and put just put an -eac effect for each channel:
--cut--
#!/bin/sh
ecasound -b:1024 -a:1,2 -i foo-2ch.wav -a:1,2 -f:16,2,44100 -o /dev/dsp \
-a:1 -efl:1000 \
-eac:200,1 \
-eac:0,2 \
-a:2 -efh:4000 \
-eac:0,1 \
-eac:200,2
--cut--
And the same works for >2ch files:
--cut--
#!/bin/sh
ecasound -b:1024 -a:1,2,3,4 -i foo-4ch.wav -f:16,4,44100 -o alsa,sb \
-a:1 -efl:1000 \
-eac:400,1 \
-eac:0,2 \
-eac:0,3 \
-eac:0,4 \
-a:2 -efh:4000 \
-eac:0,1 \
-eac:400,2 \
-eac:0,3 \
-eac:0,4 \
-a:3 -efl:4000 \
-eac:0,1 \
-eac:0,2 \
-eac:400,3 \
-eac:0,4 \
-a:2 -efh:4000 \
-eac:0,1 \
-eac:0,2 \
-eac:0,3 \
-eac:400,4
--cut--
But of course, this is not very practical (nor efficient) for files with
more than a few channels. As a easy solution, just keep your tracks
in separate mono/stereo files.
-- http://www.eca.cx Audio software for Linux!-- To unsubscribe send message 'unsubscribe' in the body of the message to <ecasound-list-request@wakkanet.fi>.
This archive was generated by hypermail 2b28 : Sun Jun 03 2001 - 22:34:24 EEST