[HOW TO?] table average with a jstrigger
Hi everyone
I have this algorithm in which I try to make an average of the degree of consonance of what I am actually playing on viola, for gesture analysis purposes/parameter triggering.. I am converting midi values to a pitch class (%12), and then streaming the two latest events with a zl stream 2, that goes thru a patch that converts me everything to positive values, in order to get only the steps I am making (I am not interested in analysing the harmonic/tonal content, just the degree of consonance), and then making these values go into a table that triggers me the degree of consonance of the current value, that then goes thru a histo+table chain, to alow a stathistical anallysis of what I am playing.. My question is.. how do I set a jstrigger object, to make me a recursive addition (fast iteration cycles with almost no latency), in order to tell me.. in 0-5, your current degree of consonance is x.. kinda what is the script I need to use to make this in a very cheap way, without having to set something complex in terms of adding a lot of objects?
thanks in advance
tiago morgado
I haven't really answered your question-- depends what staistical analysis you want to do-- but I have simplified the existing patch for you (3 objects replace ten). Table has (sum) and (length) and (quantile) amongst other commands to aid in statistical analysis.
hi terry mcdermott.. first of all, let me thank you for your precious help.. this section of the patch looks now much simpler. and I've been able to realize an algorithm that supposely wold be able get the average from the table.. the implementation is just not the best reason why think that getting all the values out and using some sort of javascript script with jstrigger would solve the problem.. anyway I've already been able to get the algorithm
you need to cause a sum.. and then iterate a variable of the values, that will divide the sum I am doing this with a counter and a "t b" and expr but for some reason it's working kinda slow and is not giving me proper values.. if it could work with jstrigger.. it would be just great
correction.. it's the sum value divided by size of the table.. I am just not using the right message to trigger the sume of the indexes
I ended up by making a zl stream of the last five values followed by a zl sum.. and a division by 5.. by doing so I get the average immediately, and I don't have the problem of latency because I initialize it with a loadbang uzi 5 -> int 0
the sum of your consonance scores divided by the length of the table is fine, but hard to do with 'old hat' objects like histo and table-- I believe you want the average of the consonance scores over a defined period-- use zl objects for this. Someone correct me if I have missed something:
(as for java script-- no need to resort to that)
BTW your 2nd table kept crashing max-- it had a size of 4 million or something, so I deleted it
Ok i just noticed you already came to the same solution out before I posted my last reply... ;-)