Open mhamilt opened 3 years ago
I would also start with a double float pointer, that way you can essentially access an array like a matrix
float** lookup;
lookup = new float*[order]; // create an array of float pointers
for (int i = 0; i < order; ++i)
{
lookup[i] = new float[resolution]; // for each pointer create a float array
}
you can now store data in lookup
with the syntax lookup[x][y]
I would also start with a double float pointer, that way you can essentially access an array like a matrix
float** lookup; interpLookTable = new float*[order]; // create an array of float pointers for (int i = 0; i < order; ++i) { interpLookTable[i] = new float[resolution]; // for each pointer create a float array }
you can now store data in
lookup
with the syntaxlookup[x][y]
Hi Matthew, I'm having another shot at this but could you clarify something for me. In the example you've written is lookup == interpLookTable (ie. just a typo)? also in the suggested syntax would x = order and y = resolution or the other way around?
Yes, lookup
== interpLookTable
and x
and y
are essentially interchangeable, but x
== order
and y
== resolution
would be a sensible approach. Naming convention is your call. I originally tackled lagrange in c
, so wrapping in a class wasn't an option. If you wrap everything in a class you can avoid being tautological and give your variables some more sensible names. interpLookTable
is pretty ugly all things considered.
Edited the original snippet to actually be consistent.
okay, I think I understand what's going on. Thanks for clarifying! I was still having some real trouble with this Lagrange interpolation today, however I did just try the cubic spline method from the delay class you pointed out a while back and it was infinitely easier to implement so I think I'll just stick with that! This will probably still come in handy later on though
I think Cubic Spline is the way to go. Lagrange is only really helpful when missing massive chunks of data e.g.
still wouldn't hurt to give it a go, I'm sure you could program a nice way to switch between the two so you can easily A / B against a spectrogram.
If you are making your own class for a lagrange lookup table,
https://github.com/Cameron1470/audio-programming-project/blob/master/Source/LagrangeTable.h
definitely split this up.
First step is to figure out what it can do
.h
We know for setting the table it will have to involve something like
Sure you can probably make this nicer, but start of verbose and chip it down