In the early days of my Music Technology degree, when I first came to discover Open Sound Control (OSC) and the power of network communication, the workflow used to be easy and painless. I would create a secure ad hoc network from my mac, connect to the network with my phone and the job was done. I was then able to control anything I wanted using my phone.
Those days are long gone…
Since the day apple removed the ability to create secure ad hoc networks on macOS and removed the possibility to use unsecured WiFi networks without internet access on iOS devices, it has become increasingly hard to work with OSC incoming from a mobile device. This problem appears also on Android devices running stock Android because of the OS not supporting ad hoc networks.
Typically, the scenario would be something similar to this:
The mobile device would be unable to latch to the network due to missing internet connection or lack of security.
Being an academic and researcher, most of the time I have to deal with university networks. These secure networks rarely allow data throughput of this kind and unfortunately there are not many possible solutions. For this reason, I decided to write this short guide exploring a few workarounds I have found.
Methods that still work
Don’t panic! Not all hope is lost… there are still a few scenarios where you will be able to easily communicate from your mobile device to your macOS laptop via OSC.
If you are in an area where mobile service is present and strong, you can share your phone’s connectivity to make your other two devices talk to each other.
Unfortunately, this method requires us to have both the mobile service and an extra device to share said signal. Creating a hotspot from a mobile device and trying to send and receive data from the same device won’t work on the Pure Data side of things.
Using a home/open wifi connection
Usually home internet connections are not as strict as public or academic ones. In a home scenario, all you need to do is to make sure that both your devices are connected to the same wireless network, note down the IP address in your macOS network preferences and in your TouchOS app, and make sure that all the instances of the IP addresses and ports used are coherent between your Pure Data patch and your TouchOSC app.
Because of the removed secure ad hoc network feature in the latest versions of macOS, in absence of mobile signal and/or an open wifi network, there are a few things that we can do to create a connection.
Using a Wireless Access Point to create a secure network
While it might not be the best solution for some, using a Wireless Access Point to create a stable, trusty and secure network remains one of the best solutions to date. In an indoor environment, using an old Wireless Access Point will do the trick, while outdoors a cheap USB modem is the way to go.
Using a USB-wired connection to transfer data
This quick and dirty solution instead might be ideal to prototype and work on a project on the go, but it might not be the most optimal solution in a performative environment–unless you’re willing to work with 20m long USB cables.
To achieve this:
- Enable Cellular Data and the Personal Hotspot on your mobile device, turn off WI-FI and connect the USB cable to the Mac.
- On the Mac, go to the network settings and select Manage virtual interfaces, create a new virtual bridge using the USB connection.
- Note down your IP Address.
- In TouchOSC set the host to this IP address 172.20.10.7, incoming port 9000.
- In Pure Data set the IP address to the [netsend -u -b] address 172.20.10.1, using the port 9000.
Thanks to zombie314 for the idea.
While these might not be ideal solutions, unfortunately, with Apple’s latest removal of secure ad hoc networks, these are the only available methods to date.
Download the example patch to communicate with, and receive data from TouchOSC using Pure Data Vanilla (0.49.1) from here.