First time here? Check out the FAQ!
x

(!thingy smooth: 1 s) How can I make a different non-linear smoothing response?

+1 vote
323 views
When modulating wavetable position for example, is it possible to increase the smooth time once the value has stopped moving?

The closer it gets to the target value, the larger the time value would need to be

Does this make any sense at all?
asked Oct 11, 2016 in Capytalk & Smalltalk by charlienorton (Adept) (2,650 points)

2 Answers

+1 vote

The System Prototypes Sound LossyIntegrator as Exponential Smoother is an example of an exponential smoother (as opposed to the linear smoother that the smooth: expression implements). Will that work for your application?

Another option would be to open your wavetable in the Kyma Wave Editor and create a Gallery. In the Sources category of the Gallery, there should be an example that includes the word "scrub" which has a control over a similar exponential smoother for the time index.

answered Oct 11, 2016 by ssc (Savant) (120,590 points)
I've been reading the help on the LossyIntegrator and looking at the Exponential Smoother prototype. The help text makes it sound linear:

"The scaled slope value is integrated to give the output.  You can think of this as the rate of change per sample in the output value.  For example, if the Slope has a range of (0,1) and were to set the Sale to 1 / SignalProcessor sampleRate, the output value would increase by 1 over the course of 1 second."

Playing with the Exponential Smoother prototype it obviously isn't linear. The help says it will increase by 1 over 1 second if scale is 1 / samplerate. If I set the Tc to 1.0 in the prototype that should give a scale of 1 / samplerate but watching the faders the smoothed fader does not reach the value of the random fader within 1 second.

Slowing it down by setting !Tc to 10, it looks like the smoothed fader reaches about 64% after one time constant.

What am I not understanding from the help text?
When you change the value of Slope from 1 to 0 and the Scale is:

SignalProcessor inverseSampleRate

then, in ReleaseTime it reaches the inverse of the natural log:

1 exp inverse (or 0.36787945234315d)
 
If you change Slope from 0 to 1, then in the ReleaseTime the output value reaches

1 - 0.36787945234315d

or the ~64% value that you observed.

Looks like the mistake is in the parameter help (fixing it now). Thanks for questioning it!
The linearity of the LossyIntegrator depends on the value of ReleaseTime. For a very long ReleaseTime (like 60 s), the loss is negligible so it behaves as a linear integrator. For shorter release times, there is loss that counteracts the linear integration and gives a characteristic exponential response.
+1 vote

I don't know if this would be useful to you - here's a non-linear smoothing function implemented with a TriggeredSoundToGlobalController.

The salient part is that the !Smoothed value is:

!Smoothed + ((!Input - !Smoothed) / !Friction)

If you set !Friction to 1 then the !Smoothed value will instantly be equal to the !Input value.
If you set !Friction to 2 then the difference between !Smoothed and !Input will halve each cycle. In other words the closer !Smoothed gets to !Input the slower it will approach.

 

 

Drag Input around and watch Smoothed react


 

The sound file

answered Oct 11, 2016 by alan-jackson (Virtuoso) (15,740 points)
oooh wow, this might be an even simpler implementation. Thanks so much. Will give it a go now!
I love this very much, thankyou. It is yet another example of how awesome the STGC is. Self referencing the !value. Magic.
another quick and dirty way is to make the smooth time constant a ramp function.

For example:

!thingy smooth: (((!thingy hasChangedInLast: 100 ms) ramp0: 30 s) * 30) s
...