Re: comparing arrays in ruby (problem)
Posted: Fri Dec 24, 2021 8:57 pm
tester wrote:tulamide,
By getting index of a certain value (that meets specific criteria), you can easily build a matrix of reference indexes, and then you can get various different kind of values (correlated but from different pools) at thexe indexes. So this is more generalized and scalable approach.
By getting individual values through (more complex?) computation, it's less efficient, and you need to approach each value independently.
In case of this simple equal-loudness autogain compensator - getting single index, gives you a matrix of 4 idenxes, that operate on 2 correlated tables.
As for efficiency, there is no problem if the input value just changes into something else, but the issue get's more pronounced if the input changes live at some speed (each step = full computation), and blue scenery is extensively active.
*
As for second part of your question, look inside the interpolator.
Input - bottom_neighbour / top_neighbour - bottom_neighbour = output - bottom_neighbour2 / top_neighbour2 - bottom_neighbour2
So the output follows the input curve, and the curve doesn't need to have equally spreaded points in this case.
Reference table is always present, array of values to compare too, because it's hardwired.
Yes, if the goal is to access several arrays based on an index, it is mandatory to evaluate an index. Context would have been nice, when asking the question, because I certainly had offered the second solution first then.
Using this while running live input reference might be a little too much ffor green and Ruby. Have you considered the DSP editor? As far as I know, it allows creating arrays, so that could be done in stage 0, and getting an index number from a stream value would just be basic math, which DSP does fast.