Smoothing a certain Number of Frames

While I was enjoying my christmas holidays the last week, I couldn’t help thinking about Kyma stuff This tutorial will certainly contain some math but don’t be afraid, it will not be that hard. At least I figured it out and I’m not a math genius at all..

Adjusting the feedback parameter to control the level of smoothing was something I was always unhappy with. Until you reach about 0.8 there’s not too much happening, but then a very small change makes a huge difference. Luckily I found a way to control the number of frames the smoothing will be applied

If you don’t know about smoothing spectral data have a look at these tutorials:

The Wire Between

Deeper in the Wire

So let’s start with a simple delay and see what happens if you feed an impulse (1 sample with the value 1) in it.
See what comes out if you use 0.7 for feedback:


Looks like an exponential function, right? It certainly is and we can prove it: The feedback parameter controls the amount of signal which is fed back to the input. So the signal gets multiplied with the feedback parameter value each time it is fed back to the input. In this case this means that our impulse with the value 1 gets multiplied by 0.7 for the first delay, resulting in a value of 0.7. Now the result gets multiplied by 0.7 for the second delay, resulting in 0.7 x 0.7 = 0.49 for the second delay. The third delay will have the value of 0.7 x 0.7 x 0.7 = 0.7^3 = 0.343. And so on! So the n-th delay will have the value of 0.7^n – it is an exponential function.

This function will never be zero but it will be very very small. So let’s define a threshold t of 0.001 which is -60dB, similar to the RT60 value used in measuring the reverberation time (Reverberation on Wikipedia).

Now what we want is to define a value for n and calculate a feedback value that reaches the threshold after n delays. This way we could set our feedback value in a way that after n delays any other delays will be below the threshold and therefore negligible. Mathematically this means:

x^n = t

where x = feedback, n=number of delays, T=threshold

Let’s try 10 for n and 0.001 for T:

x^10 = 0.001

We could just use the 10th root but for later use it is better to use the log function to solve this equation:

10 = log(x) 0.001

To solve this we need the log function to the basis of x. To calculate an arbitrary basis we can use the formula log(x) y = (log(2) y) / (log(2) x). So log(x) 0.001 = (log(2) 0.001) / (log(2) x). If we insert this in the equation above we get:

10 = (log(2) 0.001) / (log(2) x)

which can be transformed to

log(2) x = (log(2) 0.001) / 10


x = 2^((log(2) 0.001) / 10)

which solves to

x = 0.5011…

Let’s see if it works:

0.5011…^10 = 0.001 – alright!


So let’s transcribe this to CapyTalk:

((0.001 twoLog) / 10) twoExp

or in a more general form:

((!Thrsh twoLog) / !NbrFrames) twoExp

Use this for the feedback of your smoothing delay (and 1 – the expression for Scale) and you can finally adjust the number of frames to get smoothed!

You can even use that expression with a “normal” delay and adjust the time it takes for the delay to reach -60 dB by putting in the resulting delay time (DelayTime x DelayScale) like this:

((((-60 dB) twoLog) * (!DelayScale * YourDelayTime)) / !DelayRT60) twoExp

Use the expression for Scale and Feedback and use a comb delay to make it work properly.




Visit the Kyma Forum Thread


0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply