loading

Create Interactive Electronic Instruments with MaxMSP

Featured
Picture of Create Interactive Electronic Instruments with MaxMSP
This Instructable is part 3 in an Intro to MaxMSP series I've just finished teaching at Women's Audio Mission in San Francisco.  Part 1 is an introduction to MaxMSP and MIDI, part 2 is intermediate Max and Audio, and this Instructable is all about interfacing MaxMSP with hardware.

I recommend at least skimming over my last two instructables before diving into this one, many of the example patches I use in this instructable are derived from patches built in the last two classes.  In this Ible, I'll be going over how to get MaxMSP connected to Reactivision, Kinect, Arduino, MaKey MaKey, and the Novation Launchpad.  The last step has some useful links and ideas for more ways to extend Max.
 
Remove these adsRemove these ads by Signing Up

Step 1: ReacTIVision and MaxMSP

Picture of ReacTIVision and MaxMSP
Screen Shot 2013-09-29 at 11.22.15 PM copy.jpg
Screen Shot 2013-09-29 at 11.50.20 PM copy.jpg
Screen Shot 2013-09-30 at 12.41.48 AM copy.jpg
ReacTIVision is a free, open source tool that communicates with MaxMSP and allows you to track objects with a camera by attaching small paper markers to them.  The software tracks x and y position and rotation and it's great for incorporating real world objects into your MaxMSP patch or making table top interfaces.  It was originally written for the ReacTable, a table top multitouch instrument:

Here are some ReacTIVsion projects:

Here's how to do it:
- Download the ReacTIVision vision engine
- Download the ReacTIVision TUIO client for MaxMSP
- Print out some of the fiducial markers (look in your ReacTIVision vision engine download, under symbols>>default.pdf)
- Run the ReacTIVision application and hold up the markers to your webcam - you should see the number of the fiducial track with it as you move it around the screen.  You may need to adjust your lighting to help reacTIVision see the markers.

By default ReacTIVision uses background subtraction to help it with tracking, in some cases this can be a hindrance.  Use the 'E' key to toggle in and out of background subtraction mode and use the spacebar to recalculate the background until you find a setting that best tracks the fiducials.  Pressing the 'S' key will show to the original source image.  Pressing 'T' will show the binary tresholded image, and pressing the 'N' key will turn the display off, which reduces the CPU usage.  The thresholder gradient gate can be adjusted by hitting the 'G' key, lowering the value can improve the thresholder performance in low light conditions with insufficient finger contrast for example.  You can gradually lower the value just before noise appears in the image.  The camera options can be adjusted by pressing the 'O' key.  You can read more on the reacTIVision website and the README.txt (comes with the ReacTIVision vision engine) about the optimal lighting, camera, and background setup for the software.

- TUIOClient.help/mxe/and mxo are the files that allow you to pull in data from the ReacTIVision vision engine into Max.  You must include these files in the same folder as any patch that requires them  You can also add them into a directory that Max knows to look for external objects.

First open the file TuioDump.pat in Max (find it in the TUIO_MaxMSP folder), open up the Max window to see the logged output (Command + M / Ctrl + M).

----------begin_max5_patcher----------
489.3ocyTFraaCCCF9r8SgfNmMD45llzaC8TOsKcmFFFjsYRXgrjgjbm2J56
9josic2pSSCFJ1EZqeJSS9QJ8XbDOyz.NN6Z1WYQQOFGEQRsBQ8qi3kxlbkz
QaiqgeXxtmunykGZ7jbkE09A0JoOeOp28cKj66Bd5xOtbAayUs1jUsVQ3c12
5+BrfhRHxePLDksFsWKKAxymrnTM0iC+E4YSHVcp55RTq.OkmhQQSsePcYq3
SwwslEmXAmU68F8QJsq1Pk1Zpntbv9RkVB+XoZWd5+YEzEWdlTuieHNOuRDm
QkLSq6tZzbiBgSn+ktYzNW+6h+o8u+BJJzExyiCmjy.N4lxxIH3.cbXYkBXP
ijdRng42K8LZj2EdGXnN74Afwt6K29YVI3bxcPvkg7lazNiBFBsB0PtoVSwO
YdjKRRIZS1jTA8XJz2Z2kQS0GP3j1P5+YGilku.PPZOnp5o6VikjFGLIoRis
kzaM7WkYqESXl3jY1kuSLixFZN3Ot5kpnV8mCRmo1lOb.n+LFSbnlJ.mG0RO
FtlZbOgKaXi08drn.H2C4bA5jYJnX9F5aIaV9JYi3LylNTIqpd.rt9PRIRX5
5disc4pEzRT2sjvO2BOfC6+BRQZCCK9vjRssqu1rdEOt8+7T7uQCg2J3
-----------end_max5_patcher-----------

Here is how the TUIOClient sends messages into Max:

When an object comes into view an addObject message is sent:
addObject session_id symbol_id
session_id is the number of the current session, we don't need to worry about that for most applications.  symbol_id is the number of the symbol that came onscreen  - these can be found on the defaults.pdf that you printed out.

As the marker is tracked around the screen, an updateObject message is sent for each frame (my computer runs at about a 15fps frame rate, your machine may differ depending on how hard it is working):
updateObject session_id symbol_id xpos ypos angle xspeed yspeed rspeed maccel raccel
session_id and symbol_id are the same as the addObject message
xpos, ypos, and angle are the x position, yposition, and angle of rotation of the marker
xspeed, yspeed, and rspeed are the x, y, and rotational velocities of the marker
maccel is the acceleration of the marker across the screen
raccel is the rotational acceleration of the marker
you may find that you need just one or all of these pieces of information, but usually symbol_id, xpos, ypos, and rotation are the most useful

And when the marker is removed a removeObject is sent:
removeObject session_id symbol_id
session_id and symbol_id are the same as the addObject message

Use the patch below to read in and parse add, update, and remove messages for marker id, xpos, ypos, and rotation.  Be sure to save it in the same folder as the TUIO objects you just downloaded.

----------begin_max5_patcher----------
905.3oc0XlsbaCBEF9Z6mBM5pzNNdDKZw8tN8An2z65zICxhjPhLRCBk3zL4
cuBzRTVjQdC6NwQKGvvOebNGv77zItwYqoEtNey42NSl77zISzlTFlz79D2U
j0KSIE5p4tLa0JJW5NqtLIcsTaWPWk8.8mw2QW1UXNQt7VF+lqDJi5NADFM2
alCLxScaAP+R0yN+o46bs3lXUUUkWagkn6fr36tD521zWmwkbxJptnuKXjz9
kTv9qtD.rqUxEzhJcSjrLde8DAq0CRcyq4RmZ3kqX7TpTO1AuZLqT1Z0SY7k
oSUWlsmPjjjXjfXud.LHZKAHdmAnkQgHqdtx4BuKgeMm8k1Zjx3zkYkbc0fC
yIebnlM99pa954WDZzfBbn8zvAf4g9JMDbN3psNOqvgvSbdR8vEwT4iTJ2wS
aCr0zFi.y86nMvKrYrNZd6cv4Mpl2vP74.uWQD2SENUcPLUrszEEhpGK6lyL
Xw4VT+0oYUMhq4nW3B8.16Co45O7BMO7xIhJ6Rp3JJmDmpqg2N4W4CqECxa7
tU0zR9TNstMTieRkOhiaLgeia+ubOvBOFfEGsXNzerjMvljE2rZFL7+Sx1jB
bTf0+n.1SLhhKkxL9FPDBDzKpFCZu9oHB5tY2EDnNEABrGtKaBAfc.AuM+9l
RkOJ2DjMi+PAG.fx3GEWKN8wJf7gUUK44jk2Wsqkp+lW+wr6GHp1Kz.6OvaU
dHR0bqKn7cOL.C8OFgms+3rwDdtvPzYaasWKSZ8nSHLZ7a6vylAmsJau34oJ
3zrOWSLYvhMR7C9OJqq2C2epptYyESaNHfwDrF4ddG1svazQcAmvMNcFF9T6
DLpnGe6sd1wGNhplk5zcdYN8O9Qmx7DhjNxSRC.0rCiPaBdGnMCfGBdJx08+
.3CeLxhDoOQgvNOmgQ.5DmD4ycD9UIK6GordG4xfyzHcR9.7FWh4HGjjxJ1p
bH5pnOmn2cJ85Qox9aQVQVoXYam0tMVGbWOkPKjLtdYv9UJrpRuxiaYIITd+
zlIrBUlzjgOumsROHS5Ivt5AZRO91UO.S5AYW83YROPqomQMcgspbLNaAr2r
EXL5wyt5wj2yBqIG+QnlHqpFSyUAV0S1DarXZvQnFrUUioYpcMkb8J7j77Gn
hhllTKjps+bWlP8ZvL8qLd8q5MW3JnOvZqORagHp12irZSOkh5ssrNJvcppe
dY5+.7jck4O
-----------end_max5_patcher-----------

Try wiring up the data from updateObject to the frequency modulated synth from the last Instructable.  See if you can get the rotation of a fiducial to control the rate of frequency modulation.  Or use the y position to change the pitch of the main oscillator.  Hint: you'll need to use a scale object to scale your range of values to something appropriate for the synth.   In case you get stuck:

----------begin_max5_patcher----------
1285.3oc4ZsrbahDEcs7WQWrJiihp9MP1kZ9.lMytoRMEB53PhDnRBMwNoh+
1GnaPF4BCWkft5gqxFjZ0Bctm649na3G2Lwad98lMdj2S9GxjI+3lISrCUMv
j52OwaYz8wKh1Xml2mVjmsco2T2GU9xzrElB6mwdZv7sEMixqG8S4YEaR+tw
NS9LZ8vtYV7vJiCEU+.QEdSIdyixtyi7w54sJpH9yoY28uqMwEtoFP0kWFhv
mUcRQqNxKOt66jlXgb97u7NI0qENxhVZ+479v5znEdUevOu4lpCSARCYluUd
YatlEl6sXxaSbzBCgNivlUBEJQRoy5jqzcxUrCjq.QOhfpSLlpW9gMt7yYjL
IjGZ0Gb9vxDNlpj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R3xRp8r+tQjFUDU833NHIUciHvDSTHZIApZII.HovkkJ+03CfHlDcHMj7l
wPERU2WpAcbZ94GlD93hIMDLEhKlfj.WHO+vDGYem3Lz2ABSHG2wf56vqth.
RsNNt9NNn7S3lGmG.gmD3hIen8oblgINt8XxAkK.2tm3PaK.uTALHRbbqrv.
olvcMTLHcpHwM6jsOa4Pc95iOlDCgIM9XZvEsnvGSCtpEA9XZHMNC2tmXP5d
JDeHMnqC2Mu.z9ofNhFhj9cj2ku4m27+.Mt0nqC
-----------end_max5_patcher-----------

Step 2: Installing MaxMSP External Objects

Picture of Installing MaxMSP External Objects
Sometimes you will find useful objects created by the MaxMSP community that you'd like to use in your Max patches.  There are two ways to do this, you can add the external files to the same folder as your patch or you can add them to Max's externals library.  If you want to use the external object in many patches, it's best to do the add the object to your library with the following steps:

- Navigate to the MaxMSP Program Files on your computer.  Find a folder called "Cycling '74"
- Inside Cycling '74 you'll find folders with the following names:

max-externals
max-help
msp-externals
msp-help
...and so on

- Copy the .mxo file of your external object into the appropriate folder.  Copy the .maxhelp file of your external object (if it exists) into the appropriate help folder.
- Restart Max, open a new patch, and type in the name of the object.  You should have access to the object as its help file, just like any other Max object.

If this does not work for you, try one of the other strategies outlined in this thread.

Step 3: MaKey MaKey and MaxMSP

Picture of MaKey MaKey and MaxMSP
IMG_6723 copy.jpg
Screen Shot 2013-09-30 at 6.40.35 PM copy.jpg
The MaKey MaKey is a USB device that you can clip to anything conductive to transform that thing into an interface.  Essentially what it does is trick your computer into thinking that it is an external keyboard, then the things you clip to it become keys.
 

You can read the keypress messages coming form the MaKey MaKey using the key and select objects in Max, just like with a regular keyboard.  First get the MaKey MaKey setup with your computer, the MaKey MaKey website has great instructions for how to do that here.

Then wire up all the pins on the MaKey Makey with alligator clips (use jumper wire to connect to the pins labeled W, A, S, D, F, G), and run the following Max patch.  It demonstrates how you can use a combination of "key" and "select" to pull keystrokes into Max and sort them.  From there you've got some bang messages to work with, you can do anything you want from here.

----------begin_max5_patcher----------
678.3ocyW1saaBCE.9ZxSgEWyP9ev6t8bLUUAIdstiXhLNcoqpu6yXHoIcI0
jHDEj.DGLb93ylClWWDEWVuS1DC9N3mfnnWWDE4C0FHp+3n30E6VVUz3aVb4
VqsVGmzcp5s1Jo09xFY28HtrP+PL3t9Suovt7Qk9g6Mxk1tVvxYoB2BQj.PD
dJLAPD62d3BUq7Iqt7ouwD6Sld6Zk1kNOHn2C1AwIQ2XjMRssvpp0mj77zLW
xyyOjbX+FvcsW4aKVztIYpjAA9QdBHirQTFD+yNhf+x8.MikxgtE9P8P934g
1jOW7.FlRZe6fNTOPFQOfoyEOP3rTra3.BOTOPGOOP3hYiGP8uhNDEvFQEfH
yEEfYzqrDIe77.lkOW7.RHtxRjnQzCvrYiGnzqrDId77.hgmKdHWjhZ0P1P0
.b7zff2YA3WeAR5fqORup4QdCOKZ4eb4YeRrxcdFiajUNbAHj.Hxb6X.DD5V
wtUBffA3b.V.HPWU2OWDIi+9AHWguDHGy8i2XnDW0fya3CyE4W0ZqtXsG93e
XTEUmW83iZei5uxtftzc1tD7szmrccozbQspz1C1HrI59X.yOf+RN.G1AaJL
t3Vo4dotnrx2B3mMzbP5AOdiX+s7kPF6+2EVe3N8IRYWVenqbHD7ZTD8HE4S
dbkR+w+90iea7S8VS8Vyx8Rnevt6E3COCqjMVk1Wn7nF09uqf2azipUqj5i4
dkpocHfW.vy1CNTdvmjoyiCYxngL.ZnhIEGTn9J3jhCNDN3IEGRHbPSJNzP3
vmTbXgvgMo3vCgCcRwIKDNSacm7P3jOo3HBgS1jgCZ.Uku0xNcePsXylmkll
9aoGD2TNdp1zdHOwenR2cne5MwF4yp8sm3iTXbyev5l7vVS2m+2kyiWzlm2V
7OfiVWSP
-----------end_max5_patcher-----------

Step 4: Write MaxMSP patches for Monome / Novation Launchpad / Grid-Based Instruments

Picture of Write MaxMSP patches for Monome / Novation Launchpad / Grid-Based Instruments
Screen Shot 2013-10-03 at 10.33.22 PM copy.jpg
Screen Shot 2013-09-30 at 1.36.56 AM copy.jpg
Screen Shot 2013-09-30 at 1.36.54 AM copy.jpg
The Novation Launchpad is a relatively inexpensive grid-based controller that's super flexible with Max and Ableton.


 
I highly recommend checking out the nonome monome simulator to connect your Novation Launchpad with MaxMSP like a monome (check this thread for updates).  This is a really awesome solution because it also allows you to access all the max patches available for monome (I think there are hundreds at this point):


 

- Download the Launchpad drivers here
- Download the latest release of nonome.zip (find the mediafire link) and open the patch in Max
- Choose your Launchpad from the drop down menu
- Open any monome app <-- that is awesome, there are so many to choose from!
- Set the app prefix (press the message button called "/sys/prefix/something"
- Select LED color from the nonome dropdown menu

Below is an example patch for creating your own matrixctrl-based Max patches with Lauchpad and nonome:

----------begin_max5_patcher----------
703.3oc0W1zbZCCDF9r4WgFclBVF+Ymbo2Zuzo2axzwQdSPsxRLVxAnYx+8p
OLDRwPgVvyzY.azpUx66iVo077n.78xUfBidO5qnffmGED3LYMDz0N.WWthx
KUN2vTYcMHz3w99zvJsy9mPsJnBomCHQYMftEuV117kRMc9mMs+Hz.2hQZIR
CbNRHERiS54kZyElBY9XG5Bq+VuTfnBUCJU4ifoK4XjY5PzRApAVvKofeXKY
54nklYAdBZ7OXqeb1OfMQHmI.prU3ByzNih1ZlfCZmlHuZT1p2XMry5CRgVw
9I37LZxFytHkId7aM.U6AXRQgoaTZh8JweK2XBcW2XXUNTIu+6uq.uyzaiaW
OengUxw1NdYzH6kw+iqJ2bCZQighdZceqVKEV7RkBCUrqFxt0hdwUz0DWooD
Kglk44URnqUb+7J8xxKArzLq6gqFif.zz8xbm5fH9zoQTOznXKL7NpWu.7j.
iGa9tU18vpBGphycjJ1CrrCPpjAAUsUFlPA1S.JOLL7LXC4LYyQ4hMCCE42p
kdTrbgyf5NaZOtLUsVYSWdfspmDodwTzUGSIjY9sZdDEG52wc.RQFpDH2g7b
IsjOWpzl7n7yIOJ7n.pGJDm6nPbr6Fgb7sQwCBELYJKrTX+TE8TNTswepjKa
7pHbRVgYEjLt2eQ1QMC7dwM3kDty44GBuYQCSAPCCU3qYUr3nzIIiQEYV0l3
HPTX+ZNYXjruJ+0U0jHWAoSQ0W38Q0k5F1Jptg+WTNduDZNSosEec22F8Mxk
tgkeX.LqqV7L2IpQ9b9nvCbjZz+wJM4bDJYWg5bv8Bk+1+vv8Tr1eq5Uli.o
ahWO1LGss8wTAJMSTpYRwN9j8Vmlypp.wtI00rpERlP2ECn65co3TCorSIlr
0NFvXx9pM+4XJYXiojSHlHCaHQt1KclFuL5Wi5ZouC
-----------end_max5_patcher-----------
Open the patch and press the message button labeled "/sys/prefix/yourPatchNameHere".  That sends a message to nonome and updates its OCS prefix field.  Now message coming in to nonome will be directed to your patch.  I used the name "yourPatchNameHere", but you could use whatever you want, just be sure to find all the objects that have "yourPatchNameHere" in them (there are 3, the message, udpsend, and udpreceive) and change it to your new name.

Press buttons on your Launchpad, you should see the matrixctrl object, labeled "buttons", light up.  Now lock the patch and use your mouse to click on the matrixctrl labeled "leds", you should see the leds ont he Launchpad light up.  Try wiring up the output form the button matrixctrl to the input of the leds matrixctrl, then press keys on your launchpad, the button you press with light up.

I copied the step sequencer example from last class into this simple Launchpad patch and wired it all up together.  Try it out for yourself:

----------begin_max5_patcher----------
1680.3oc4bssbaaCD8Y4uBN5wNpND2A6a8anO1ISFZJXYlPQpRBk3zL4euD.
TxJJhffJPvHoiGKZAJSb1CNX2E.q8WtawxGZdVzsL4OR96jEK9xcKVnaR0vh
g2uX417mKpx6zerkaEcc4aDKWYtmT7rT2NIAlTVWbn858aKqqDR8uD7kFa1K
OzJXn0c4xhmJq27tVQgz.EN+9zUIjTp4h5UPeSIuc3WobstOad38+NL6PW9X
SsrNeqPeq+rsLu5z6zU9u56.f8OMSyFrH+7NgoWWtL4sp6706tS8xJGYjZwm
5Ax2QH6xK9PRZ+WiwJn4xJLlhHvDMqvHpWgoivJrHkU1jKE9QiLvF.8ED1Ja
PhT1Xe8QUR5EYEvEYEz3rRFTSGLiFIyJqf8GqTVKWt5atbUzzXNWJp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0P8G030ISuo6ycJ4xikOelHxS4ov04oLjzOv
TwufQJdMJ3UlkFW7zIpWmT0TjW8TSmrWCwmiFxRV+HB2TRiloV.hUYDd1DjG
KJ9VwNEKblulJwZ+La5.S.3FeMXaLAygMwpOi6lVyyN8dVF.mBVcwe5zkSbS
0WisNSSwhdyVx8fe6L1PIzZa+iCyxJ8c9uFICxDM+vt+MhWFvMN6W8M0KE9r
+3bz.W092xLcM6aKNzMGxOO4EnuVzIKqykkM0m7gTS.N4C8T450h5Ssf0kcJ
iRa2WdLxU7bVWcY7nbMEH7nxyXR7.hK3nFRAgANTWFsHgS8vbQMGP73xvEKb
p4y5pQvS3jym0UiL6Jf3I0E7vC2z8rHCO7HCOrHCOfHK5UTE7h3xnEJf3g5J
dBSzTUIHEU7CLt3GbVbwOXdjwOrHCOz3Z7B4h2YDLr3A3BdBy3EzE8i5+iBw
DdBXzcHMxviKqt3LR7lhGrC5YMd.gCOSxOjvhGnK3IPiWnHSOCbfennvhmoz
yTXXwCZB7PXQFdnwk9gfhL7.iK87YIY+5im.6+YJ+gXVjgGZbgG.It7+.B2t
s3zYoDtzmAbWRGCDV5YJ7nJqxPwOQ1xK.QV5X.XjgGkTkL0gWjFV7vlJ8vrv
hG5T3IviW3ovCKr3YpvEPZXwyj9CCL+LU5p.TXwyj9eBW5yt.GHNpfipLiup
nol5JIe2tOJZ6FdlZjrba96ME5Dck9sk0l2pqilkshOVd3yq+CqaYdawSkRQ
gbeqo9ddlSWdmpe95c+WhiKpK
-----------end_max5_patcher-----------

Attached is an example monome patch I wrote, use the app prefix /arp to run it with the Launchpad (press the /arp button right under my name before starting):



Another option: Lauchpad Abstractions are a set of objects that can be used to send MIDI messages between Max and the Novation Launchpad.  Download Launchpad Abstractions here.  The zip file contains the following files and their associated help files, make sure to include these either in the same folder as your Lauchpad patch, or in a folder where Max can find them:

phi.lpad.in.maxpat - gets input from the Launchpad.
phi.lpad.out.maxpat - manipulates Launchpad LEDs

The help files for these objects are included in the zip file and are extremely helpful to get started, though there is a bit to read.
 

Step 5: Xbox Kinect and MaxMSP

Picture of Xbox Kinect and MaxMSP
Screen Shot 2013-10-03 at 10.48.04 PM copy.jpg
Screen Shot 2013-10-03 at 10.48.56 PM copy.jpg
The XBox Kinect is a hackable depth sensing camera and gesture tracking device.  Since the Kinect was first hacked, it's been a popular choice for tons of interactive projects, and eventually the Max community developed a bunch of ways to pull Kinect information into Max.  If you are going to buy a Kinect, be aware the the newer model 1473 does not work with any of the options listed below as of the Sept/2013, the older model 1414 will work, also make sure it is called "Kinect for Xbox".
 

The most popular program for connecting to Kinect is caled Synapse, though this program can only track one user at a time, it's relatively easy to set up and it communicates with Max through a patch called Kinect-Via-Synapse:
 

- Download Synapse (you may need to install drivers here)
- Plug in your Kinect via usb port (also make sure to power on the Kinect)
- Run the Synapse app (it will crash if you do not have the kinect plugged into your comp)
- Open Kinect-Via-Synapse.maxpat
- After starting Synapse, don’t forget to stay in position (stand up and put your arms up) and wait for skeleton detection
- Download and run the Kinect-Via-Synapse maxpat to pull Kinect data into Max

Once you have Synapse doing skeleton tracking, click on a joint in the Kinect-Via-Synapse Max patch to start pulling in info about its location.  You can toggle between x, y, and z coordinates and you can also select the coordinate system you would like to reference to:

Body is the distance between a joint and the torso, this is good if you want to look at a person movements without an reference to their surroundings or location in the frame of the shot and capture specific body gestures
Screen is the position of a joint in x, y, and z coordinates across the screen, measured in pixels
World is the position of a joint in world space, measured in mm

Double click on the object labeled "User 1" on the left side of the patch.  This will open up a subpatch that tells you where all the kinect data is being sent.  Remember the send and receive objects from last class?  Instead of writing out the full words "send" and "receive" in the object definitions you can use the abbreviations "s" and "r".  For example, if you wanted to grab the left hand x coordinate, you would need to create a receive object "r lhnd1x" in your patch.  Here is an example patch that calculates the distance between a persons hands to apply a low pass filter to the looper that we build last class:

----------begin_max5_patcher----------
2585.3oc2b0zjhaqEcM8uBUTuEujpGh9zx9UUVj8ucY4To5x.BZmwXSYa5om
jJ8u8HKYCXveHXDFwLUAziLt8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igGrigGnao8PLZR6vwCOb2Z7xj4r6OZnA66VVOHWCOl
LbgbQ7LNQKPlnFhGOucjwYMOR7SYfa1Pt6iWtFJ73MDdHiKd3CgG73hmAkmQ
iKdnCgG33hGxPSCLXbwCdH73Ot3YnhHvGuY5fLI6PzHZOa.btV0G8xecxQDu
DHmbzvO4Xge9QBuqiCt747OO8uf5c8kB
-----------end_max5_patcher-----------

And here's another patch that watches you dance and speed up or slows down music according to how fast your dancing.  (it measures dancing by looking at how quickly you raise alternating hands up in the air, I was in a rush to get this done so I had to pick something really exaggerated, but you could definitely adjust this to fit whatever you wanted)

----------begin_max5_patcher----------
2945.3oc2cs0iihiE94T+JrhFMZ2Q0lFeEXk5UZeeeadbznVjDmDll.Q.o5t
lQS+aeMXfPR3hSZiiS+PBoLgvm+3byGerq+5kYyWl7Ud1bv+F7afYy9qWlMq
rohFlU82yluO3qqhBxJ+Zyi4eIY4eL+U4ox4eMur4T9Jd3abvxC6qOW7w8gw
Q77xqy4TiIGyqaEV05gf7U6Bi29IwOStDMtT5BW5q.jyBmWAtrh2K9L32qtl
v0k2XAX9WLV88bSRbdbvdd4o9uogAQsOSV3eVdFHZQMdjfI+8Cb4sc9bvuWb
l+9kWJd60uOVIiGutWJA1Ik3zOkfwkr.C6KOLHk3b6Txczu2DkHf+Mz8Pi28
bJOPcFp6Q8Fu6cHHUzdNO8S73fkQ71rqpRCh9WP97WAyWFDuUqhFe.3rnSdC
cqZJU7F0kTb.iVPGf2znlhjatKNYBDanDUDaHO6hM+hnGpaAGXofCAMHyg+Q
Uvg34offC542dCSyxMDZoeHLYHhi3YExM85eNRzq.9t.HjBfNNhWHwKr3EQ7
hId41Io42Io42Oo4gjFlkVoQH3PrFDpOVqTR506+3cR3G2ujmpGE0ZpifGWQ
E5XFE0v3oQM8y72ug3mIiSZPIo4OTTAXe8ItUQLWePqdA0igLeHqbLFXeEBc
xGqWR5t3i87rrfs7qHDG8PHtdRS5P2S7Azqa9vC9nGzUejgqdHCg4e1B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R3g2IZjEQ1Eaw7E
.4hsV9K1V4udKkuusSdw84ue4+uJaP5G
-----------end_max5_patcher-----------

Another way to interact with Max via Kinect is called OSCeleton (works for Windows, Mac, and Linux).  It works by allowing Max and the Kinect to communicate via OSC messages (kind of like a fancier version of MIDI).  OSCeleton allows you to track multiple users at a time (Synapse can only do one at a time)

- Download OSCeleton (look for the cloud-shaped download button "Download Zip")
- Follow the instructions of the OSCeleton GitHub page - you will need to install drivers
- Run the Kinect-Via-OSCeleton patch, like Kinect-Via-Synapse, it's a patch that pulls in data from all the major joints in the body,  it works in a very similar way.

To extend this even further, jit.freenect is a jitter object that lets you grab depth and camera data from the Kinect:
 

Step 6: Arduino and MaxMSP

The Arduino is an open source microcontroller (tiny computer) that is used for tons of creative projects and interactive installations.  It is definitely my favorite piece of hardware to work with, and the brains behind many of my own projects. 



I could write another Instructable about the subject of Arduino and Max (and maybe I will one day), but for now I'll try to summarize what I know in a few paragraphs.  First of all, there is a growing list of ways to make Arduino and Max talk on the Arduino website.

My favorite option for beginners is to read information from each of the Arduino's Digital and Analog Pins with Arduino2Max (download it here).  This is by far the easiest to get started with and doesn't require extensive knowledge of Max or Arduino (though, feel free to check out the others if you need more flexibility).

Setting it up is easy:
- Download Arduino2Max
- Download and open Arduino (if you'd like to learn more about the Arduino IDE and Arduino Programming, read sections 1-3 of these tutorials)
- Plug in your Arduino to your computer via usb and open the Arduino2Max .ino file (from your Arduino2Max download) with the Arduino software
- Upload the program onto your Arduino board (here are some tips in case you get stuck)
- Quit Arduino
- Open the Max patch "Arduino2Max"
- select your Arduino Board from the dropdown menu (mine is called usbmodemfa131)
- click the toggle button to start

Once connected, you should see the Arduino sending analog values (between 0 and 1023) through a0-a5 and digital values (on/off) through d0-d13.  Wire up some components to the Arduino.  Try wiring up analog components like potentiometers and light sensitive resistors to the Arduino's analog pins, and digital components like buttons to the Arduino's digital inputs.  Then see what kind of effect these components have on the output from Arduino2Max.

Just like we saw with kinect, you can use receive objects to pull data from the Arduino's pins into your Max patch.  Try this simple patch, it uses info from pin A0 of the arduino to set the pitch of an oscillator, and uses the output of pin D7 to trigger notes:

----------begin_max5_patcher----------
839.3ocyXEraiBCD8bxWgEZOr6prUXBPHqTOreGqppb.GhqL1QFSaZqZ+1Wy
XnMoEHzrTRuPBic77l2L9M14woSbVI2QycP+F8WzjIONcxDvTogIUuOwIirK
lSxgo4rlKEEYNyrCY9JSvoZXL7qFkE5ZqdUV2RzwaXhzqUzXs0iyc8uvcFZN
1q7i.2xmdlmnqp9MrDvmxU27K7hZetVJzBRFEF5OJFg67hKTF6Zp5ZpfrhCy
vcueUN6AvF3OqYKP02ukZgTY7QzNyPNqHhTGzUkS6ooSKeLqmTTrLKiJz0nR
S2AwqSVAWy1xuGo2PQFGusPiVqjYHNSPQ2wzafQxYoBBG88hbJ5mO+CjVhhM
fWI4vvjrsbltHwrDqsqTdLiyIZop1ikqWrrP.t0uqT0ZU5JfkdgPNL441QxK
LXujG1l8BaK6Ed7r2ayPCHyCrbBKkoMDKSXHdmOKVwGXE+n8HkVKocO+jBwT
pIS+b4Dr6RX+cPO3j4iBkjQyyIoz2QItWX.qqaiDgWigMt8v1OZADvKg3N.C
uD0RovxOdb2lB1oIZ0NkDUxICCkTI32OJI5bSIB5cFf7NFgsF8MFFc4kHbo9
q.U1o.Q44fntG75f1eDG3Y2x30oZh+.xWyFXNC5vY1c4dAtQpY9IRMdKBg1N
y6jY79JvLzGRHwO+A1G0khpOHhNeATQT0xInknG6Lb4w36i4zmGFwfpfnRLv
FDskBGP4Q6wqFzp67XB2TdazI87MgfoN22DaMxRgmJKY0.vy6TC37KYVjshp
FF0u5HGu732NXjtb.S7ed0fVJfTHRycXcOwxkn41yl2EmEdtKVzxzTN8CTrb
7SVDgescP4ylh6f9TQzXpeXS4IKFlTdUnauxQ2ob7mUJGbFzk+M+YB.dKseH
CkKKTw0KUcOZzqXNglqYBhlIE6OoEGLoMrjDpXeNKgkWlHg.t46EzW7rrOvw
Pmly.9kBNiC6rnGvIZzPSTOPyxQCMg8.MiWcbPeJb7GM3f6Ugr23gmnuX3w+
.IkVvyxwEOGkeFus53d.mfSDM1dXjsaukpxqVR.Hl942HUub5cGSyZ6qPSYG
E8VV87g6w5PTldzZSC5BksC6tnPykvL94oo+CLsikUK
-----------end_max5_patcher-----------

Other options for sending messages between Arduino and Max include:

- send and recieve MIDI with Arduino - once you get Arduino up and running with MIDI, you can use notein and noteout to write this up to Max.  Here are some projects that use this approach:


 
- serial communication via USB - I tend to use this a lot in my projects.  Serial communication is a lot like MIDI, but there aren't any preexisting protocols to work with (pitch, velocity, etc), so you can configure things to whatever suits your project best.  Check out the serial object in Max if you are interested.  Here are some projects I've worked on that use this technique:



 

Step 7: More ways to interface with Max

I just don't have time to get into the details of the rest of these, but here are some more hackable objects that are worth checking out.  If you are interested in learning more, Google is your friend.

One more thing  - check out Soundflower for audio routing between programs.  It's free and works great with Max.

EEG - Emotiv and NeuroSky Headsets


Leap Motion

Nintendo Wii

Face OSC

Open CV


And so many more.  If you like MaxMSP you might also want to check out:
Jitter - graphics and video processing in Max
Arduino - control electronics
Processing - 2D and 3D graphics programming environment
Pure Data - the free version of MaxMSP
Grasshopper - generative 3D modeling - similar visual flow-based layout as Max
Lilypad  - an Arduino that you can sew into fabric
solohust2 months ago

What application should be used to open the Arduino2Max_Nov2012_V.6.maxpat? There 's no application available in my macbook. Thank you. And btw, is MAX Patch an application or just a file?

Pierred351 year ago
Whaouuuuu. Thanks alot for this incredible job and for sharing your knowledge, I will read all this instructables with a big interest. Thanks again
techbitar1 year ago
This is fantastic.
THIS IS SO AWESOME MY MIND CANT PROCESS IT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!