I have implemented this code.
It aims to determine the coefficients of the 8 drivers for a headset with 4 drivers on each side, depending on the position of our virtual source.
For this as input values we have a hslider that takes values between 0 and 360 for the horizontal position, and a vslider that takes values between -40 and 90 for the vertical position. In this way we can define the position on an almost complete sphere.
I am not an experienced user in Pure Data and I have several errors that maybe someone can help me to solve.
- When I generate a number object, the upper and lower limits are not respected.
I have the intuition that this is because the limits are only respected when the user manually slides the cursor to change the value of the number object. On the contrary if the value of the number object is modified by the code itself these limits are not applied.
- This raises my second doubt, since theoretically these coefficients are calculated in such a way that the maximum value of 1 is never exceeded. The problem is that the conditional <> sometimes do not work correctly.
If the initial value is lower than 90 or higher than 120 the spigot should receive a 0 and therefore not pass this value.
We can see how 121 is higher than 120 but still the spigot transfers the value. The subsequent calculations are designed to result in a minimum of 0 and a maximum of 1, which is not being fulfilled due to this error.
3 Finally, I have calculation errors in basic operations such as subtraction.
1 - 0.652 = 0.348 . The calculation performed by pure data results in 0.307 .
If anyone has any suggestions or explanations as to why this is not working properly I would be very grateful.
If there is any doubt about my explanations I will be happy to try to explain.
I insist that my level in Pd is very low and I may be making very basic mistakes, do not hesitate to suggest changes or improvements.