Forums > MaxMSP

MAX/MSP Help for new user! senors to trigger audio files.

May 01 2010 | 2:57 am

I’m new to MAX and have worked some with arduino and their boards.

I am looking to create an art installation consisting of multiple senors (mainly IR, pressure, motion; from starter packs). It will need to play audio samples real-time from human interaction via sensors.

Question#1- If I have a sensor that is run through to MAX do I need to use an arduino board (something cheaper) and/or can I gang a couple of sensors through that board (Duemilanove) and still get independent signals? I am looking to have 6 to 10 sensors to multiple folders of audio.

Question#2- If I need to make some kind of router or interface what would be the best way via MIDI or USB? I’m looking cheap and DIY.

Question#3- How would I set-up my audio files to have one sensor per audio folder? (for example I have sensor #1 that once triggered would only play audio files from folder #1). That sensor would also need to randomly choose different audio files from only that 1# folder.

Question#4- Once a sensor is triggered and audio is playing, what is the best way to manage the sensor (or audio) being retriggered before the sample has completed?

P.S. I’m running MAX5 on a 1yr old MacBook w/ a express slot

Thanks Brian

May 01 2010 | 9:22 am


#1, #2: not sure.
#3: Here is a snippet for getting the paths of audio files from a folder:

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

you can then use sfplay~ to play the files stored on the unemu. Look at the helpfile.
One nice feature of sfplay~ is that it bangs when it finishes playing. So,

#4: With that bang, in conjunction with some logic, you can sample the next value from your sensor (maybe with [snapshot]?). Look for helpfiles on [gate], [snapshot~] and possibly [onebang].

Here is an example with sfplay~:

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

May 01 2010 | 9:39 am

Hi Brian
I think I can address at least some of your queries.

#1 You can access 6 independent analog sensors via the arduino board; if you wish to use more than this number you will need to add a multiplexer to your circuit. You could add switches etc to the digital inputs though.

#2 A router to do what?

#3 You don’t mention how you are getting serial data into Max: have you built your own patch or are you using an external such as Maxduino, Arduino2Max, SARCduino? Gettin ‘random’ audiofiles into your [buffer~] is actually quite straightforward; I would use the following:

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

see the sticky at the top of this forum if you don’t know what to do with this garbled text.

#4 [onebang]

Good luck

May 01 2010 | 11:33 am

…and let the "end of term project" regatta set sail! :-)

May 01 2010 | 12:03 pm

LMAO – if a little cynical Greg, but i think "well-spotted";
in my haste to be helpful, I missed the faint whiff of newbie desperation


May 01 2010 | 12:16 pm

Well, at least we left some room for ‘free will’ no? :)


May 01 2010 | 1:00 pm

yes we did;

loved your solution btw

May 01 2010 | 1:10 pm

Hey, Brendan, thanks. On the larger scale of things this patch has served me well. It is usually the first bpatcher I put in any new sf/buffer playback based patch. Usually sprinkled with a named coll object and an uzi to collect paths.


p.s. @ Gregory: Hey, the other day I was hearing "Seismic Profile". Nicely done! Somehow fits with the wavelength of my brainwaves when programming.

May 03 2010 | 12:36 am

Thanks for the tips, sorry for such the newbie questions. The router was a though as to using a wireless router with a number of shields available for the arduino boards; I was also thinking of MIDI but that is past musician in me (maybe I’m over thinking this).



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

Forums > MaxMSP