How to modulate a high pass filter frequency

Hi everyone,

I’m currently working on a SuperCollider project and encountering some challenges with modulating the frequency of a high-pass filter (HPF). I’m attempting to create an HPF that smoothly rotates its frequency over time within a specified range, alternating between lower to higher frequencies:

(
SynthDef(\hpf, {
	|amp = 1, gate = 1, in, mix = 1, out = 0|
	var inSig = In.ar(in, 2);
    var freq = SinOsc.kr(0.1).range(440, 880);
	var sig = RHPF.ar(inSig, freq, rq: 0.1);
	Out.ar(out, sig);
}).add;
)

However, I’m encountering issues – the frequency modulation isn’t behaving as expected. Instead of smoothly rotating between low and high frequencies, it seems to remain fixed. If I replace the SinOsc by a LFNoise1, the frequency changes but randomly.

I’m seeking guidance on how to effectively modulate the HPF frequency within the specified range in a smooth and consistent rotation pattern. Any insights or corrections to my current approach would be greatly appreciated!

Thank you in advance for your help and suggestions.

hmmm works fine here!

listen with white noise to hear the sweep.

(
SynthDef(\hpf, {
	|amp = 1, gate = 1, in, mix = 1, out = 0|
	var inSig = WhiteNoise.ar(0.1!2);
    var freq = SinOsc.kr(0.1).range(440, 880);
	var sig = RHPF.ar(inSig, freq, rq: 0.05);
	Out.ar(out, sig);
}).add;
)

Oh, I see that I forgot to mention an important detail. I need to run the HPF with a Pattern, actually I am using PbindFx from the miSCellaneous extension:

(
Pdef(\test, PbindFx(
    [\degree, Pwhite(0, 7, inf), \dur, 0.25, \legato, 1, \fxOrder, [1]],
    [\fx, \hpf]
)).play.quant_(4);
)

Ahhh I’m not so familiar with PbindFx but I think it is creating an effect synth per event - so every note has its own brand new instance of the effect with the SinOsc at the start point.

Try the Pfx class instead (its a little wonky but ought to work)…

a= Pbind(\freq, Pwhite(100, 800, inf), \legato, 6)
Pfx(a, \hpf).play

or just handle it manually:

a = Bus.audio();
Synth(\hpf,[\in, a.index]);
Pbind( \freq, Pwhite(100, 800, inf), \out, a.index, \legato,6).play

Yes, what happened was that I applied the effect per event, while my intention was to keep the effect on. I haven’t tried your solutions yet, but they seem to be the correct approach. Thank you!