Forums > MaxMSP

[HOW TO?] table average with a jstrigger

Apr 04 2011 | 10:50 am

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

-- Pasted Max Patch, click to expand. --

Apr 04 2011 | 10:28 pm

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.

-- Pasted Max Patch, click to expand. --

Apr 05 2011 | 9:09 am

-- Pasted Max Patch, click to expand. --

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

Apr 05 2011 | 9:32 am

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

Apr 05 2011 | 10:29 am

-- Pasted Max Patch, click to expand. --

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

Apr 05 2011 | 11:15 am

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

-- Pasted Max Patch, click to expand. --

Apr 05 2011 | 11:21 am

Ok i just noticed you already came to the same solution out before I posted my last reply… ;-)

Viewing 7 posts - 1 through 7 (of 7 total)

Forums > MaxMSP