Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imp_1199 in stereo / multiple instances #27

Open
srtaylor opened this issue Apr 27, 2016 · 5 comments
Open

imp_1199 in stereo / multiple instances #27

srtaylor opened this issue Apr 27, 2016 · 5 comments

Comments

@srtaylor
Copy link

srtaylor commented Apr 27, 2016

Trying to apply your imp_1199 to stereo input I get strange results. Using ecasound as the host, with stereo input "in.wav", if I do

ecasound -i:in.wav -o:out.wav -el:imp,1

then the output has processed audio in ch.2 only, with silence on ch.1. This is strange, because every other 1-in-1-out plugin processes all channels in parallel, e.g.

ecasound -i:in.wav -o:out.wav -el:amp,6

adds +6dB gain to both channels, as expected. If I understand correctly, this runs multiple instances of the plugin, one for each channel. I suspect multiple instances of imp_1199 just don't get along well.

Strangely, I can convolve ch.1 only by silencing ch.2 first, like so:

ecasound -i:in.wav -o:out.wav -chorder:1,0 -el:imp,1

and yet if I manually run one instance of imp_1199 per channel like this:

ecasound -a:L,R -i:in.wav -o:out.wav \
-a:L -chorder:1,0 -el:imp,1 \
-a:R -chorder:0,2 -el:imp,1

then I get silence on ch.1 again. Just changing one instance of "imp" to "amp" (or any other 1-in-1-out plugin) in the above gives non-zero output in both channels; the problem only occurs with two instances of "imp". Somehow the second instance of imp_1199 is clobbering the output of the first.

I looked through the imp_1199 code but can't see anything amiss. Any ideas?

@swh
Copy link
Owner

swh commented Apr 27, 2016

It's a while since I looked at that code, but from what I remember it's mono-in, stereo-out, so there's no correct way to process stereo input. You could run two in parallel, one for left, one for right, and combine the left out of instance 1, with the right out of instance 2, but there's zero chance ecasound would be able to figure that out on its own.

@srtaylor
Copy link
Author

srtaylor commented Apr 28, 2016

Thanks for looking at this. I'm working on a project that's stuck until I can implement a FIR filter under ladspa.

analyzeplugin says imp_1199 has only one audio output. But in any case, the following runs two instances in parallel and combines the outputs, as you suggest:

ecasound -z:mixmode,sum -a:all -f:,2 -i:in.wav -o:out.wav \
-a:L -chorder:1,0 -el:imp,1 \
-a:R -chorder:2,0 -el:imp,1 -chorder:0,1

This works with lots of other plugins, both 1-in-1-out and 1-in-2-out. But with imp_1199 it outputs silence on ch.1. Simply eliminating the "R" chain (which itself does nothing to ch.1) restores the ch.1 output. So imp_1199 is doing something weird that other plugins don't.

Looking at the code, I wonder if it's that the fftw structures are declared global in scope instead of within the plugin_data structure?

@swh
Copy link
Owner

swh commented Apr 28, 2016

Ah, ok. It's 15 years or so since I wrote it, so not clear on how it works. Can't think why you would only get one channel out. Sounds like a bug, but it's an odd one. Could be FFTW setup, as you say. Why LADSPA, jack based FIR might be easier? LADSPA and FFT FIR is not a great mix - buffer sizes can caused unpredictable CPU load from cycle to cycle.

@srtaylor
Copy link
Author

srtaylor commented Apr 30, 2016

LADSPA because I've built a system around ecasound and some IIR filters I wrote in LADSPA (actually, mods of your biquad filters) for doing crossover/eq of active loudspeakers. Documented here if you're interested.

But now I need to add stereo decorrelation; allpass FIR filters are the best way I know how. I realize LADSPA and FIR isn't a great mix. But the impulses are shortish (512 or 1024 samples) so I figured an fft approach would be doable. Your code has what I want, if I can get it working.

Sorry to bug you about old code! I'll work on it; will let you know here if I find a fix.

@swh
Copy link
Owner

swh commented May 3, 2016

OK, great. Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants