How do you set up a patch so that there is an object that gives you a percentage of squares that are white or black for a matrix displayed in a jit.pwindow for example
Ideally in a number box that updates as the program runs
look at jit.3m. If it’s just b&w image, the mean value of any color should be representative of the % white vs. black (scale 0-255 to 0. – 100.).
thanks David thats a nice simple solution. Cheers.
If I wanted to develop this further I ahve a question about maths. Awesome I know,
Now that I have a % of ‘life’ (white squares at a given time I want to write a mathematical expression that says something like:
‘if life = <25% tell oscillator, midinote, etc to play note A, (could be c1)
‘if life = >25% but <50%tel osc, midinote etc to play not B (could be c2)
…..etc for >50% and less than 75% = c3, and >75% = c4
To wirte an instruction/statement/message like this my head says if I put it between the two objects in question it will act as a sort of ‘check’ before produceing the outcome.
is this the case or is it better to have some sort of global message that applies to the patch as a whole? Also im trying to work through some examples with vexpr to try to acheive this – is this the right object to use?
appreciation in advance
There are a couple ways deal with conditions in Max. Start with if/then, e.g.:
[if $f1 < 25. then bang]
----------begin_max5_patcher---------- 313.3ocoSEraDBBE7L9UPH8n0.Z8Pa5k9czroAUbkFEL5yTa2r+6Eep0tapY c6dABCCu2LCvAOBKw1qZYzmnuRIjCdDBBM.PlVSXUx9zRYKRikzAf0v7G2pV BoEZy92ZTovXYh37.tOMLVfS74Q5toyX5pzlREf0SLApyvpaSd+9X1BQaGbN yQH3yZ0X+XIRydFc2vtG87FF72nWxKstdbYuHdLZXJ958RzbwysFvHqPMydo QKK+aWFtlKcZUBL+er6upaq9KjkHLf+ORAi5CmTmkCn5Qyyz4z6xEzmc2jAT nPYnXmu7EeXHlYgOb0ok3ZSqUeSro.B4vJ0ly+Afla.+zTq010jN2gI8RWbW lpEzFInceOV3DeBmBcVlB2lOgToypsZCLIgUdGuUEEsAEItAE4Vbz6a.cOB9 hA -----------end_max5_patcher-----------
Check out the if/then help for more syntax, multiple conditions, etc.
Forums > MaxMSP