cubic interpolation sophisticated example

Post any examples or modules that you want to share here
Post Reply
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

cubic interpolation sophisticated example

Post by tulamide »

interpolation_example.jpg
interpolation_example.jpg (133.46 KiB) Viewed 17291 times


Just as promised, here's a schematic that makes use of cubic interpolation (see http://www.dsprobotics.com/support/viewtopic.php?f=3&t=2769) in various ways:

    - cubic spline module renders it visible
    - wavetable synth renders it audible
    - cubic colored dBFS uses it to colorize in 2 different ways

The schematic is saved with volume set to zero. So make sure to turn on the volume in order to hear the synth. Things to meantion:

    - The spline module is completely size-independent. No matter the size of the view, the left and top edge represents -1, the right and bottom edge represents +1, the center represents 0
    - The spline itself is rendered with a resolution of 512 in order to have enough samples for a detailed waveform. You can change the resolution to any value you like, as long as it is equal to or greater than 4. To change it look into the module "cubic properties"
    - For this demo, it's only a one-segment spline. Extending it would be done by creating another segment in a way that the end-point of the previous segment is the same as the start point of the current one, and the end point of the current one equal to the start point of the next segment, etc.
    - The synth is just a very simple one, it shows the x-values, y-values and the multiplied values as seperate wavetables. When playing a note, all three wavetables are used to build the sound.
    - Note that no matter how short or long the spline is, you'll always get resolution amount of values. This behaviour could be changed to get more interesting wavetables, but for this example you have to live with it ;)
    - the level meter shows two peak bars. The first one picks the current interpolated color and draws it over its area, while the second one renders a gradient of the interpolated colors up until the current peak point.
    - Keep in mind that it's just an example, so no optimizations are done. You could speed it up a lot.
    - Thanks to those involved in solving the trigger switch issue: billv, tester and perfect.

Have fun exploring it! :?: :o :idea: :!:
:mrgreen:
Attachments
interpolation_example.fsm
(89.28 KiB) Downloaded 1206 times
"There lies the dog buried" (German saying translated literally)
Exo
Posts: 426
Joined: Wed Aug 04, 2010 8:58 pm
Location: UK
Contact:

Re: cubic interpolation sophisticated example

Post by Exo »

Really great stuff thanks for sharing :)

Might be interesting to use that as a waveshaper too.
Flowstone Guru. Blog and download site for Flowstone.
Best VST Plugins. Initial Audio.
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: cubic interpolation sophisticated example

Post by tulamide »

Exo wrote:Really great stuff thanks for sharing :)

Might be interesting to use that as a waveshaper too.

Indeed!
You can use it for pretty much everything, that's so great about it. In case you want to give it a try for whatever you're thinking of, here's a dsp version of all three interpolation methods (linear, quadratic and cubic).

interpolation_dsp.jpg
interpolation_dsp.jpg (140.02 KiB) Viewed 17254 times


Just remember, whatever you feed it with, it interpolates from a (t-value = 0) to d (t-value = 1), over b and c. So t-value = 0.5 means, all 4 inputs are present with all the same shares.

Would love to see something made from it :)
Attachments
interpolation_dsp.fsm
(23.68 KiB) Downloaded 1193 times
"There lies the dog buried" (German saying translated literally)
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: cubic interpolation sophisticated example

Post by tulamide »

And here is an animated gif I found on wikipedia, that visualizes perfectly what the cubic modules calculate:

Image
"There lies the dog buried" (German saying translated literally)
Exo
Posts: 426
Joined: Wed Aug 04, 2010 8:58 pm
Location: UK
Contact:

Re: cubic interpolation sophisticated example

Post by Exo »

Cool!

I will try and knock together a quick waveshaper tomorrow if I get time.
Flowstone Guru. Blog and download site for Flowstone.
Best VST Plugins. Initial Audio.
Post Reply