I have a Pure Data patch that reads some MIDI files and performs an analysis of them and then creates a table with some values. I need to extract the MIN and MAX values of this table and then use them to set the range of a KNOB object. For example, let's say that after the analysis turns out that the min and max values from the table are, say, 3 and 29. Now I have to give a KNOB object these values as min and max range. Is this possible? I know you can change the range on Properties, but the values in the table will vary each time, so I need to set the KNOB's range automatically according to the values obtained from the table.
In that matter, the table always has a 0 on the first position, so the patch always finds this 0 to be the min value. How can I ignore this 0 value? I am computing the min and max from the table using the object list-minmax.
To algorithmically define the range of the knob
object, you can send a message range <min> <max>
to the it:
As for the table having always a 0 in the first position, I don't understand why that's the case. You can have any value at any index in the table. Maybe you are unaware that in Pd the first index of a table is 0, so if you are writing values to it from index 1 onwards then index 0 will have the default value of 0.