Author Topic: More types of interpolation  (Read 3620 times)

Offline Rakib

  • Crazy artist
  • ****
  • Posts: 880
  • Operating System: win7x64
More types of interpolation
« on: October 20, 2009, 20:44:18 »
Today we can interpolate linear on the effects, can we have logaritmic/expontetial/Polynomial interpolation also.
^^

Offline Sam_Zen

  • Extreme artist
  • *****
  • Posts: 3,689
    • http://www.xs4all.nl/~samzen/
More types of interpolation
« Reply #1 on: October 20, 2009, 22:45:52 »
I maybe support this, but I first want to know the ins and outs of the different algoritms.
0.618033988

Offline Rakib

  • Crazy artist
  • ****
  • Posts: 880
  • Operating System: win7x64
More types of interpolation
« Reply #2 on: October 20, 2009, 22:54:08 »
Look at renoise and se how its done there.
^^

Offline Paul Legovitch

  • Workaholic artist
  • ***
  • Posts: 145
    • http://legovitch.blogspot.com
More types of interpolation
« Reply #3 on: March 22, 2010, 22:45:01 »
Discussion continued from http://forum.openmpt.org/index.php?msg=32279.0&sid=416a0ad8b215a1f739ba3d56053afd95#32279

To do this you have to consider your 2 points you want to interpolate :
(X0,Y0) and (X1,Y1)
X being the row and Y the value of the parameter.
Each param value Yi between row X0 and row X1 is given by :
Code: [Select]
for i=0 to i=X1-X0
Yi = Y0 + f(i/(X1-X0))*(Y1-Y0)

This will work for any function f with 0<f<1 and f(0)=0 , f(1)=1 :
Code: [Select]
linear : f(x) = x
cubic : f(x) = x²(3-2x)
cosinus : f(x) = 0.5*(1 + cos(pi(1+x)))
exp : f(x) = (exp(a(2x-1)) - exp(-a)) / (exp(a) - exp(-a))
exp inverted : (exp(a) - exp(a(1-2x))) / (exp(a) - exp(-a))

For exp the higher a is,  the more flat the curve is.

This is from my notes so it could be wrong and needs to be verified (with a graphic calculator f.e.)
This should be easy to implement (at least it was for me).

Offline Really Weird Person

  • Crazy artist
  • ****
  • Posts: 818
  • I love Daisy (デイジー)!
  • Operating System: Windows 8 Pro x64
Mathematical Algorithms
« Reply #4 on: March 23, 2010, 04:34:27 »
The linear and cubic ones look right as far as I can tell. I took advanced algebra last year, but I do not recall how all of those functions are formatted (at least, not simply off the top of my head). It is odd though how I do not see at least the quadratic function (f(x) = x²) is not there though. Perhaps that one was forgotten.

Offline Paul Legovitch

  • Workaholic artist
  • ***
  • Posts: 145
    • http://legovitch.blogspot.com
Re: Mathematical Algorithms
« Reply #5 on: March 23, 2010, 09:22:55 »
Quote from: "Really Weird Person"
It is odd though how I do not see at least the quadratic function (f(x) = x²) is not there though. Perhaps that one was forgotten.

Like I said any function f with 0<f<1 and f(0)=0 , f(1)=1 will work so f(x)=power(x,n) will work for any real value of n>0.

The x²(3-2x) and the cosinus ones have 0.5 as a symmetrical center, so they make the interpolation of several points very smooth.
In the last version of VolFX I've been working on, you can have a custom function to interpolate values. You can f.e. enter a sinus like function that will oscillate several times while sliding from the first to the last value.

Offline Harbinger

  • Extreme artist
  • *****
  • Posts: 1,136
  • Gender: Male
  • Operating System: Windows XP
More types of interpolation
« Reply #6 on: March 25, 2010, 20:16:25 »
Would you all be in support of a separate dialog in which you can assign different interpolation algorithms/methods/filters, or do you want to keep it in the contextual menu (one-click and it's done)?

Offline Paul Legovitch

  • Workaholic artist
  • ***
  • Posts: 145
    • http://legovitch.blogspot.com
More types of interpolation
« Reply #7 on: March 25, 2010, 21:58:01 »
I'm for sub-menus of the contextual menu with a list of interpolation types (a sub-menu for "Interpolate Effect" and another one for "interpolate Vol Col").
The last used type would be marked as "(current)" in the list and remembered by the interpolation shortcuts (Ctrl+K and Ctrl+J).

It would be nice to use interpolation also in the param editor (press shift to interpolate values between two clicks) but that's another story.

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,197
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
More types of interpolation
« Reply #8 on: March 25, 2010, 22:13:47 »
well, as rewbs has pointed out before, there are probably dozens of desired interpolation algorithms, pattern transformations etc. that could be added, so it would probably better to go with some kind of scripting system or formula evaluation instead of adding yet another context menu with 100 types of interpolation.
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.