Hi all!
I have encountered a strange issue that I will try to describe as clearly and succinctly as possible with the hope that one of you might have an idea of what is going on.
In short: When filtering any audio signal using a BLowPass
UGen with audio rate arguments and summing the output of the UGen with the signal used as input, strange distortions occur.
I have reduced the code to reproduce the issue to the following:
SynthDef.new(\fails, {
var input, filtered, freq, rq;
input = Saw.ar(50, 0.01);
freq = DC.ar(200);
rq = DC.ar(1);
filtered = BLowPass.ar(input, freq, rq);
Out.ar(0, filtered + input);
}).add();
On 3.13.0-dev on Ubuntu and MacOS and 3.12.2 on MacOS this synth outputs a kind of pulse train modulated with the input signal. As a comparison, the same code but with the BLowPass
swapped for an RLPF
works fine:
SynthDef.new(\works1, {
var input, filtered, freq, rq;
input = Saw.ar(50, 0.01);
freq = DC.ar(200);
rq = DC.ar(1);
filtered = RLPF.ar(input, freq, rq);
Out.ar(0, filtered + input);
}).add();
I have some additional versions of the original SynthDef that output the expected result, but I cannot understand why they work and the first one doesn’t, but hopefully they can help in narrowing down the problem.
Changing the frequency or the rq argument to BLowPass
to a literal number makes everything work as expected.
SynthDef.new(\works2a, {
var input, filtered, freq, rq;
input = Saw.ar(50, 0.01);
freq = 200;
rq = DC.ar(1);
filtered = BLowPass.ar(input, freq, rq);
Out.ar(0, filtered + input);
}).add();
SynthDef.new(\works2b, {
var input, filtered, freq, rq;
input = Saw.ar(50, 0.01);
freq = DC.ar(200);
rq = 1;
filtered = BLowPass.ar(input, freq, rq);
Out.ar(0, filtered + input);
}).add();
Not adding the filtered output with the input, or outputting them separately also work.
SynthDef.new(\works3a, {
var input, filtered, freq, rq;
input = Saw.ar(50, 0.01);
freq = DC.ar(200);
rq = DC.ar(1);
filtered = BLowPass.ar(input, freq, rq);
Out.ar(0, filtered);
}).add();
SynthDef.new(\works3b, {
var input, filtered, freq, rq;
input = Saw.ar(50, 0.01);
freq = DC.ar(200);
rq = DC.ar(1);
filtered = BLowPass.ar(input, freq, rq);
Out.ar(0, input);
}).add();
SynthDef.new(\works3c, {
var input, filtered, freq, rq;
input = Saw.ar(50, 0.01);
freq = DC.ar(200);
rq = DC.ar(1);
filtered = BLowPass.ar(input, freq, rq);
Out.ar(0, filtered);
Out.ar(0, input);
}).add();
So to trigger the problem we need a combination of:
- Using a BEQSuite filter (N.B. I haven’t tried all of them yet).
- Have all the filter arguments be audio rate signals.
- Adding the input to the filter with its output inside the SynthDef.
I really don’t know where to go from here. If anyone has any idea of what is going on, what I could try or how I could maybe even solve the issue I would be very grateful.
Thanks,
Ludvig