Mmc-august-2012/Lab4

From CCRMA Wiki
Revision as of 08:49, 16 August 2012 by Spencer (Talk | contribs)

Jump to: navigation, search

Lab4 - Networking

OSC Bootup

For this lab, we will continue developing the project started in Lab 3. If you haven't finished all of Lab 3 (i.e. don't have both multi-touch and sound working) you can use the Flarey project from lecture as a starting point, but you are highly encouraged to use your own Lab 3 project even if its not totally finished.

Its probably a good idea to make a copy of your Lab 3 project before continuing onwards, so that you can go back to a non-networked version of the app if needed. Make sure you make a copy of the entire top level project directory, including source code files, the xcodeproj file, etc.

Download Mark's VVOSC for iOS (available here). Add VVOSC to your Lab 3 project by dragging libVVOSC.a and include into your project.

In the project settings, under "Targets - (Project Name)" -> "Build Settings", type "other linker" into the search box and add the following flags to the "Other Linker Flags" option:

  • -ObjC
  • -all_load

Network Flares

Following the code demo-ed in lecture, modify your app to send flare information to one or more remote instances of your app. That is, when you touch down on your iPhone or iPad and a flare appears, this flare should also appear on the other iPad or iPhone (or iPhone/iPad Simulator). The flare should then move around on the remote device as if the touch were happening on that device.

Now extend your app so that more than 2 iOS devices interact over OSC -- its ok to hardcode each hostname. The main idea is that each iOS device will see the same set of flares and hear the same sounds, in a sort of mass group performance. You can test that it works by borrowing devices from Spencer/Mark or sharing devices with other people in the class.

Test this out with multiple people in the class, both in the same room and in different rooms. Do you think this "works"? Do you feel like you are performing in some sort of bizarro musical ensemble, or does it just feel like random sound and visuals? If the latter, how might you tweak the app to enhance the sense of musical connection?

Peer to Peer

Develop a second flare type -- this flare should be easily distinguished from the first type of flare, both visually and aurally. E.g., use WAV files instead of FM oscillators, and/or use a different texture. Change your app so that flares generated from one device use the first flare type and flares from the other device use the second flare type. In other words, on one device, all local flares will be of type 1 and all remote flares will be on type 2; on the other device, it will be vice-versa. The concept is that the two iOS devices are two different instruments. (One easy way to do this is to add a small button to set/change what flare type a given device is.)

Partner up and load the app for each device on your and your partner's device, and try jamming. Does this work any better or worse than when each device has the same sound?

Bonus Round (optional)

  • Use NSNetService to automatically discover other running instances of your app on the local network and automatically "pair" with them for group performance.