SmoothValue as Click Filter

Post Reply
UrbanCyborg
Posts: 585
Joined: Mon Nov 15, 2021 9:23 pm

SmoothValue as Click Filter

Post by UrbanCyborg »

Like the subject line says, is it possible to use a SmoothValue object to effectively eliminate transient clicks and pops from known points in the stream?
Cyberwerks Heavy Industries -- viewforum.php?f=76
ColinP
Posts: 935
Joined: Mon Aug 03, 2020 7:46 pm

Re: SmoothValue as Click Filter

Post by ColinP »

By stream do you mean audio? Also what do you mean by known points?

I think SmoothValue is intended just to smooth fairly low frequency control voltage changes given that the SetGlideTime() method's parameter is expressed in milliseconds but my guess is that it's just a simple bit of slew-limiting code. The parameter is a double so you could try it with a small value to see its effect at audio rates.

If you have some special application to remove one or two rouge samples then writing your own code to detect out-of-bounds samples and replace them with either the last in-bounds value or a linear interpolation is pretty easy.
UrbanCyborg
Posts: 585
Joined: Mon Nov 15, 2021 9:23 pm

Re: SmoothValue as Click Filter

Post by UrbanCyborg »

What I had in mind was a situation where there's a big discontinuity introduced in the through signal at a known point, i.e., I just created the discontinuity, and I want to fix it on the fly. 2ms would probably be enough to do so reasonably. The signal could be anything, from CV to audio. I suppose, if I maintained a buffer, I could use an LP filter to do it, but that would have a more audible effect on the transition, effectively spreading it over more time than a simple one-sample pop.

I was wondering about the SmoothValue object as a possibly cheap way of preventing a pop. I suppose, depending on the frequency involved, that it could warp the response about as much as filtering, and implementation would probably involve the overhead of starting and killing a named timer. I wanted to get others' take on the possibility before mangling a working module.
Cyberwerks Heavy Industries -- viewforum.php?f=76
farbstoff-fabrik

Re: SmoothValue as Click Filter

Post by farbstoff-fabrik »

Ah, that's funny - I have the same question. I know nothing about code, a newbie and I am learning day by day.

I would like to push a cv signal through a "glide" (static ms in glide_time) but I have no idea how to code this from start to finish.

Any help is very much appreciated! :idea:
ColinP
Posts: 935
Joined: Mon Aug 03, 2020 7:46 pm

Re: SmoothValue as Click Filter

Post by ColinP »

Here's one way to code slew limiting...

Code: Select all

if( newV != oldV )
{
	if( newV > oldV )
	{
		delta = newV - oldV;
		if( delta > slewLimit )
			delta = slewLimit;
		newV = oldV + delta;
	}
	else
	{
		delta = oldV - newV;
		if( delta > slewLimit )
			delta = slewLimit;
		newV = oldV - delta;
	}
	oldV = newV;
}
This limits the change in value of newV between samples (so the slewLimit variable is expressed in volts/sample rather than milliseconds).
farbstoff-fabrik

Re: SmoothValue as Click Filter

Post by farbstoff-fabrik »

farbstoff-fabrik wrote: Mon Mar 21, 2022 3:00 pm Ah, that's funny - I have the same question. I know nothing about code, a newbie and I am learning day by day.

I would like to push a cv signal through a "glide" (static ms in glide_time) but I have no idea how to code this from start to finish.

Any help is very much appreciated! :idea:
In the end it was quite simple to fix. Make the variable a smoothvalue and set variable.SetGlideTime(ms); and it was okay.
Post Reply

Return to “Module Designer”