iPhone and Max/msp

theshuffler's icon

Hi,

i am really new to max/msp so excuse me if this does not make sense.

I am trying to make a small windows app in Max/msp that connects to my iphone. I want to then be able to control the pitch of a piece of music using the OSCemote i have on my iphone.

How difficult is this todo?

Thanks guys

Jonas Barsten's icon

Hi!

That's quite simple.

You'll need an [udpreceive XXXX], where the XXXX is the port the iPhone is sending to, ex: [udpreceive 8000].

From there, you'll receive OSC-messages formatted as this: http://code.google.com/p/oscemote/wiki/ListOfOSCMessages

ex: /slider/1 X, where X is a value between 0. and 1.

[unpack] the value, and scale it to something you'll use for playback speed, and that's about it ...

This patch is for Pure Data (looks like Max), but it might inspire you: http://code.google.com/p/oscemote/wiki/OSCemotePureDataTutorial

Give it a shoot and please tell how it goes!

Be sure that your iPhone and Computer is on the same network of course :)

Good luck pal!

-jbj

theshuffler's icon

hi,

thank for your reply :)

I understand what you was saying but i have no clue how todo most of them things. Pardon my n00byness.

I have created a new patcher and inserted an object and declared [udprecieve].

i hope i am going right so far :s what i need to know now is how to find out which port my iphone is sending to :S

How do i find this out?

theshuffler's icon

ok ive fixed that now.

Now i am up to the part where you was talking about unpacking?

Could you expand on that?

Thanks again

theshuffler's icon

ok, so far i have [udpreceive 8000]. Connected to that I have [unpack/Button/A1 1]. I then attached a button to this(testing it out using a button before i start controlling the flow of music).

I tested it by pressing button A1 on my iphone and nothing happened :( But before i wrote the Unpack ogbject i just attached a button to the [udpreceive 8000] and tested it on my iphone. Everytime i pressed a button on my iphone the button would go yellow :) so i know my iphone is connected correctly.

now to figure out why it doesnt like that unpack object :S

Does anybody know why?

MIB's icon

I believe you need [route /Button/A1]. I would connect a print object to your udprceive and see what you get. Then put the name of the button into the route object and you should be good to go...

theshuffler's icon

still not working :(

i have added a print object and it is coming up with the message:

/button/A1 1

Which is exactly what I am typing.

So i have [udpreceive 8000] and connected I have [route/button/A1 1]. Then i have the button object connected to that.

I dont know whats going wrong here :(

theshuffler's icon

i have now fixed my error. I was not connecting it to the correct side of the object if that makes any sense.

Really pleased i have fixed this :)

theshuffler's icon

So now I have to assign a music file to play when this button is pressed.

Do i use sfplay~ ?

how exactly do i use this?

Thanks again

shalom2you's icon

The easiest thing to do, shuffler, is to put a sfplay~ object in an editable patcher and then hold alt and click on it.

Yes, the reference & help files are there for a reason.