Hi again Rob and thank you again for your time.
So... I understood everything except from the part with the (scale/10+1.7) from the noteoffset but I get that it calculates the semitones, I just don't get how the 0/10 or 1/10 depending the scale number works. Also the 1.7 does by any chance come from 12/7?
Also didn't understand why you multiply the notenum with 127. I believe I don't get exactly how the equation should be written.
Your code is great and works as I want but since I don't fully understand it I can't create other scales.
So what I did was to take all the note numbers from 36 to 96 and put them in excel in a column I also put in another column the note numbers that I wanted as my output.
From this I created a graph and got the polynomial function
((-0.00007*(x^2))+(1.724*x)-37.735)
which is basically an equation that gives the major scale.
I also checked this function in python and gives the correct numbers. I also used the Round function and again it gives the correct number.
I did the same thing with the minor scale and got the same results.
But....I couldn't make it work in the plugin.
For example, using this code
Round(((-0.00007) * (Pow((notenum),2))) + (1.724 * (notenum)) - 37.735,0)
should give me the note number (of a major scale) I want at the output.
If I put this equation for every input should give me what I want but it doesn't and I just don't know why.
Maybe it is not possible this way because you can't have an output that is dependent on Y.
I also don't get why the following code doesn't work. It uses the equation of the major scale to check.
I double checked for typo errors like brackets but maybe something else is wrong.
Thanks again Rob.