Single bang from several numbers HELP NEEDED (probably very simple)

guyrich123's icon

Hi guys, im new to max msp and i have a patch that reads serial data from my arduinio.

I essentially have a piezo creating what should be 1 number to assign a midi note, but because of he sensitivity i need for my project, sometimes i get about 3-6 numbers printed when i hit the piezo..

I need to create a single bang every time i hit the piezo as this will trigger a (random) object. What is happening is the random object is being triggered really quickly a number of times, now i need to tell max to 'only bang' on the first number it receives for each sensor hit. So somehow turning what is essentially more than one bang into a single bang every time the sensor is hit..

The project is to detect water drops hitting trays without mounted sensors and this randomly triggers notes and velocities to create generative music.

Any help would be great, but please bare in mind that im a newbie.

Thanks Guys
Guy Richardson - UCDCMT

guyrich123's icon

correction ( with mounted sensors on the trays )

Christopher Dobrian's icon
Max Patch
Copy patch and select New From Clipboard in Max.

How about passing all bangs through a onebang object, and resetting it after a short wait?

yp's icon

check out [speedlim]

brendan mccloskey's icon

Hi
you neglect to say what those numbers are, ie in what range; if they are, for example, 1 - 10, then a simple [> 1] --> [togedge] will suffice. A changing value will generate output for each change, so [onebang] is also applicable here.

Brendan

brendan mccloskey's icon

ps

Max Patch
Copy patch and select New From Clipboard in Max.

guyrich123's icon

Hi, thanks for your posts guys, I'm new to the forum and max, so forgive me if I don't make myself clear from time to time.

the data coming through is varied, the harder the piezo is hit, the first number would be like 117 and then 3 would follow just as the patch creates (the one Christopher made). So essentially I need to remove all the extra bangs so no matter how hard or soft the piezo is hit I just get one bang per time. I can upload my patch but its a little messy at the moment. It listens to the serial data coming in from the arduino. I'm sure its simple enough to apply something to the serial data to scale each hit to one bang, but i have read and read all over and I cant seem to work it out. ( I scratch my head on this one) Oh the patch you sent Christopher, it creates a list of bangs just like the patch i have, how do i get this to 'reduce the bangs lol''

3546.midiserial2.maxpat
Max Patch
guyrich123's icon

Any help would be 'banging', Im as good at comedy as i am with max msp.. not very :/

guyrich123's icon

I tried the [speedlim] object and it works, however there is about a half second delay now when the sensors are touched. So, were one prevails a failure takes its place. Cheers for the help though YP, much appreciated.

Chris Muir's icon
Max Patch
Copy patch and select New From Clipboard in Max.