Arduino + MAX/MSP
Hi! I’m a total newbie, and i really need help with a project that uses both MAX/MSP and an Arduino board.
I have to complete a project where there’s a toggle button that alternates between two sounds… i.e. When I press a button on the arduino, the toggle button on MAX/MSP turns ON and it plays Sound 1, and when i press the same button again, it’s turned OFF, and it plays Sound 2. I’ve already sort of got the MAX/MSP bit figured out (if you press the toggle button on maxmsp it alternates between the two sounds), and i just don’t know how to get my arduino board to talk to the patcher. I’ve uploaded the Firmata to my arduino board, and i’ve got the button set up, but i just don’t know how to integrate it such that when i press Button 1 on my Arduino, it interacts with Toggle Button 1 on MaxMSP. Did that make any sense? I’m very new to all this so i kinda need explicit, step-by-step directions! :s
If your Max patch is functioning the way you require, then that’s half the battle. When you say ‘Firmata’ do you mean Maxuino or some such? This is an extensive program that reads all the analog and digital inputs on the board, and also a Max patch for reading the serial data. If, as you say, you’re a newcomer to programming, then troubleshooting the code will be a little tricky. If you spend some time with the Arduino tutorials, you should be able to write your own simple program for reading a switch yourself. I’m not in front of Max or Arduino at the moment, but for the time being see if the [onebang] object helps in your Max patch. If you can hang on a few days I can write a suitable program and patch for you.
Look at the Serial Call and Response example that comes with the Arduino. There’s a Max patch in there that you can easily modify.
Brendan: I’m using Maxuino… or rather i’m trying to! I’m not too familiar with the programming bit which is why i’m having a lot of trouble and the project is due next monday… if you could help me with a patch i would really really appreciate it!
Scott: Thanks, i’ll look into it!
here are two resources which should keep you busy:
You might also have a look at my SensorBox firmware: http://pixlpa.com/blog/arduino-sensorbox-firmware
The intention was to create a simple and straightforward patch and firmware that reads the inputs of an Arduino board. The Firmata project has made a lot of progress recently, but it might do more than you really need right now.
read up on something call switch debouncing too, it might be helpful.
Thank you guys so much. You’ve been really awesome! I managed to hook up my arduino to Arduino2Max and the buttons are responding! The only problem is that now, whenever i open a file, the sound comes out all weird and distorted and I don’t know enough to figure out why. I’ve attached my file for reference. I’m sorry i’m being a bit of a pain in the bum!
Tested your patch and it works fine, no distortion or other issue. Check your Options/DSP Status; i've attached a screenshot of my own settings
Forums > MaxMSP