TouchOSC to macOS Mojave
Since the day apple removed the ability to create secure ad-hoc networks on macOS, it has become increasingly hard to work with OSC incoming from a mobile device (whether running iOS or Android).
Typically, the scenario would be something similar to this:
with the phone or tablet unable to latch to the network due to missing internet connection or lack of security.
Because public and university networks rarely allow data throughput of this kind, the possible solutions are not many.
Methods that still work
Don’t panic! It’s not all bad… there are still a few scenarios where you will be able to easily communicate from your mobile device to your macOS laptop via OSC.
In case that 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 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 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 make the connection happen.
Using a Modem to create a secure network
While it might not be the best solution for some, using a modem to create a stable, trusty and secure network remains one of the best solutions to date. In an indoor environment, using an old modem would 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 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:
- On the Phone or Tablet enable Cellular Data and the Personal Hotspot, turn off WI-FI and connect 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 the best solutions, unfortunately with Apple’s latest removal of secure ad-hoc networks they are the only way to go.
Download the example patch to communicate with, and receive data from TouchOSC using Pure Data Vanilla (0.49.1) from here.