In this lesson you will learn how to bridge your Mobile Phone to Max/MSP so that you can use the sensors on your phone as controllers for Max.
Step 1 – Download : Max OSC Module
Download the Max Module from the link above from gitHub. Once you are on the page click on the download zip link:
Once you have downloaded the Module and installed the App you can get started.
On a Mac: Open System Preferences/Network. Under Status you should see the IP Address.
On Windows: Select Start > Settings > Network & internet > Wi-Fi and then select the Wi-Fi network you’re connected to. Under Properties, look for your IP address listed next to IPv4 address.
In the image you see there are 3 sensors selected (Accelerometer, Gravity and Gyroscope)
Select your phone type, then the sensors and finally turn it On.
If all went well you should start seeing data coming into your Max Module which are from the selected sensors. If not then check the following:
– Your computer AND your phone are on the same WiFi Network.
– You entered the correct (Local) IP address of your computer into your phone.
– Your settings on your phone look like the images above.
Lets use our phones Gravity Sensor to control the playback speed and direction of our
Xplane. When you tilt your phone forward 90 degrees then backward 90 degrees (on the x-axis) you should see the numbers go from Maximum to Minimum. On my phone that Max is 1.0 and the Min is -1.0. Others might be 10.0 to -10.0.
Scale your output. The rate of playback goes from 1.0 (normal speed forward) to -1.0 (normal speed backward). So if your Sensor already goes between 1.0 and -1.0 then skip this step. Otherwise create a scale object like the following and connect it to the 4th output from the module :
scale 10. -10. 1. -1.
note: If your output already goes between 1.0 and -1.0 then skip this step!
jit.pwindowwith 1 video, start the video and keep it in a loop.
message box above the playlist and inside it type :
Connect the Gravity X-Axis to the message box, and the output of the message box to the jit.playlist
If all goes well you should be able to tilt your mobile phone forward and backward to scrub through the playing video.
Lets now use our mobile phone as a drum machine.
Lets setup an Audio Playlist with our sounds. I will use only sounds from the Resources Library on the Left-Side of the Patcher window.
playlist~ works very similar to
jit.playlist, please follow the Lesson on Audio Playlist to learn this object in depth.
If-Statementsto trigger sounds.
if $f1 < -0.5 then 1
$i1. The f stands for float and the i stands for integer.
if $f1 > 0.5 then 2. Both If-statements trigger a sound in the playlist, as you can see, the first If triggers sound 1 and the second triggers sound 2, both connected to the 4th output which is the gravity X-axis.
changeobject as discussed in Les 4.
Finally we will add a last sound using a different method to show how Max can solve the same problem in many ways. The Light sensor sends an integer between 0 and 8, 0 being darkness and 8 being bright. When I put my hand over the light sensor it should send a 0. First, connect the Light Sensor (last output) to a
change, then make a
sel 0 object, this way when it received a 0 it will send a bang. Next, make a message box with the number 5 in it. This way, when I cover my phone and a 0 is sent it bangs the number 5 into the playlist, playing sound 5 in the