SmoothValue as Click Filter
-
- Posts: 599
- Joined: Mon Nov 15, 2021 9:23 pm
SmoothValue as Click Filter
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
Re: SmoothValue as Click Filter
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.
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.
-
- Posts: 599
- Joined: Mon Nov 15, 2021 9:23 pm
Re: SmoothValue as Click Filter
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.
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
Re: SmoothValue as Click Filter
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!
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!
Re: SmoothValue as Click Filter
Here's one way to code slew limiting...
This limits the change in value of newV between samples (so the slewLimit variable is expressed in volts/sample rather than milliseconds).
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;
}
Re: SmoothValue as Click Filter
In the end it was quite simple to fix. Make the variable a smoothvalue and set variable.SetGlideTime(ms); and it was okay.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!