First time here? Check out the FAQ!
x

Is it possible to over sample in Kyma?

+1 vote
129 views
Hi,

i am looking for ways to over sample for example a feedback loop, but I can't find any way to do this.
is it possible to over sample specific sections of a patch?

best

paul
asked Mar 24 in General by paul-louis (160 points)

4 Answers

0 votes
Best you could do for now would be to raise the overall SR for the entire patch.
answered Mar 25 by ssc (Savant) (101,320 points)
ok thx, sounds like this could change in the future ;)
best
0 votes
I think it depends on what you're trying to do but you can do oversampling in Kyma. In the Kata we've just built a 3-times oversampling state variable filter.

We did this by kind of replicating the processing within our feedback loops three times and throwing away the first samples. That is a terrible explanation. Pete Johnston led us through the design and he would be a great person to explain how that works.

Pete? Where are you? (If you say "Hilbert Transform" three times he usually appears).
answered Mar 26 by alan-jackson (Virtuoso) (12,590 points)
ah thats sounds interesting, tell me more :) What is the Kata by the way?

best
0 votes
Although there is not (yet) a way to run different parts of the signal flow diagram at different sample rates, there is a way to emulate oversampling (which it sounds like Alan & Pete may be doing?):

Imagine you have a stateless function f(x). To emulate n-times oversampling, you could make n copies of f(x) and let each one operate on a different time step, where there are now n time steps for each sample at the old SR.

Since the rest of the signal flow graph is feeding f(x) at SR, where do those n new samples come from (the time steps "in between" the actual input samples?)

To guess what the values are between the actual input samples, we can interpolate from one sample to the next. One simple way to do this would be to use linear interpolation. If your input samples are A and B, the n samples in between would be (A * (n - (i - 1)) + B * (i - 1)) / n

So the sample points  "in between" A and B would be:

x1 = A

x2 = (A * (n - 1)) + B) / n

...

xn = (A  + B * (n - 1)) / n

Now we can apply the function to each of the new time points:

f(x1), f(x2), .., f(xn)

which you can think of as n-samples of a signal running at SR*n.

To use the output of this higher rate signal in combination with the rest of the signal flow graph, you have to filter it at half of the sample rate (i.e., put it through lowpass filter whose cutoff is SR/2). For example, one simple (but not very high quality) way to low-pass filter the signal would be by averaging:

[f(x+1) + f(x+2) + .. + f(x + n)] / n

In other words, you could take the sum of the outputs of the n copies of f(x) and scale by 1/n and use this output with the rest of your signal flow graph.

The emulation could be improved by using a more complicated interpolation function on the input and a better low-pass filter on the SR*n signal output.
answered Mar 26 by ssc (Savant) (101,320 points)
thanks a lot for the detailed answer, I get the idea but have some questions:

what is the variable "i" and how does the lowpass filter work by averaging?
how does a more complicated interpolation function could look like and as well a better lowpass filter? Is there some literature that explains this?

best
Paul
For more multi-rate signal processing techniques, you could start with the Wikipedia entries on upsampling (https://en.wikipedia.org/wiki/Upsampling) and downsampling (https://en.wikipedia.org/wiki/Downsampling_(signal_processing)).

Averaging is a low pass filter because it smooths out the faster changes in the waveform.

In (A * (n - (i - 1)) + B * (i - 1)) / n, the i is the number of the interpolated sample, ranging from 1 to n. (The time points in between the actual samples A and B)
thank you! I will have a read @alan_jackson do you have examples of you oversampling as a patch?
0 votes

In many cases you don't need to interpolate up because you are not staying at the higher sample rate but immediatly coming back down again and the error will be un noticable. Therefore you do the calculation three times with the same input sample repeated three times and when you output it you just take the last of the three calculations and egnore the other two.

in the attached diagram below, I start with a state variable filter and re arrange it so that inputs and feedback outputs are on the left and the output and feedback inputs are on the right. Then you can see what you need to do to to repeate it three times at the same time. 

I hope it makes sense.

StateVarOversample1.pdf

BTW in fact I think you may find that the error due to not interpolating cancels out. By not interpolating it is like adding a step wave to the signal which only contains frequencies at the higher sample rate (no aliasing). When you come back down in sample rate, those frequencies get dropped as the down sampleing is an exact sub division of the sample rate so you end up with the correct signal. The numbers may be different to the interpolated version, but may be more correct as if a non phase shift filter had been used.

 

answered Mar 29 by pete-johnston (Practitioner) (400 points)
edited Mar 29 by pete-johnston
thank you pete!
I am not really sure how to translate the schema to kyma but I guess i will figure it out!
thanks a lot
Hi Paul, It's quite simple, the circles with plus in are mixers the circles with plus but a little minus circle are mixers but with 0-1 in both levels hot fields, and the triangles are mixers with the Ff or 1/Q formular in the level fields , or if you need control at sample rate then these are product modules  and the result of the formula becomes the second input. I hope this makes sense.

BTW Alan will be posting the finished thing, but it has few extras like distortion option in the feed back, stereo, greater order of filter if needed, sample rate or non sample rate control.
...