How can I implement a one-pole filter from scratch in SuperCollider?

Hello,
I am currently studying DSP, but I’m not sure how to implement a basic one-pole filter. I can create phasors using single sample feedback with Duty of UGen, but it feels like something is different when making a filter. Below is the code I wrote.

(
{
	var buf, osc , rea, del, wri, coef, rate;
	coef = 0.5;
	buf = LocalBuf(2);
	osc = WhiteNoise.ar();
	rea = Dbufrd(buf);
	rea =  ((1-coef) * osc) + (coef * rea);
	z = Duty.ar(1 / SampleRate.ir, 0, Dbufwr(rea, buf));
	z;
}.scope;
)

It seems that I could easily implement it using the fb1 object from the extension, but I would be happy to create it as simply as possible. Could someone please help me?
Thank you!

Hello @electronicmusician12,

I expect you’re aware of these two UGens?

Thank you for your prompt response! I was aware of OnePole, but I didn’t know that FOS and SOS UGens were available. After inputting the filter coefficients, it worked perfectly.

However, I’m trying to avoid black-box approaches since I’m currently studying DSP. I’m now looking into the contents of the Fb1 extension.

Thank you!

hey, for sample per sample DSP stuff its probably better to have a look at FAUST or gen~.

This is probably the easiest solution in this case. As you might have seen, Fb1 has a OnePole example (1b) in its helpfile, also SOS and LTI comparisons.
With Fb1 syntax it’s rather short, but indeed, the way in which Fb1 works is quite tricky, so if you are rather new to SC, other solutions might be more clear.

Fyi, this isn’t what supercollider was designed for. All basic dsp building blocks are written in c++ (or something similar).