Effective OSC Communication between macOS and Mobile

Niccolò Granieri
Jan 7, 2020 · 4 min read
Photo by Marvin Meyer on Unsplash

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.

For the purpose of this article, I will be using TouchOSC to send OSC data from mobile and Pure Data to receive said data on my laptop.

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.

Mobile Hotspot

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.

“Workarounds”

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:

  1. Enable Cellular Data and the Personal Hotspot on your mobile device, turn off WI-FI and connect the USB cable to the Mac.
  2. On the Mac, go to the network settings and select Manage virtual interfaces, create a new virtual bridge using the USB connection.
  3. Note down your IP Address.
  4. In TouchOSC set the host to this IP address 172.20.10.7, incoming port 9000.
  5. 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.

Conclusion

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.

The Startup

Get smarter at building your thing. Join The Startup’s +793K followers.

Sign up for Top 10 Stories

By The Startup

Get smarter at building your thing. Subscribe to receive The Startup's top 10 most read stories — delivered straight into your inbox, once a week. Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Niccolò Granieri

Written by

Lecturer in Digital Media Technology, PhD in Music Tech and all-round tech enthusiast based in Birmingham. Currently: DMT Lab, formerly: Integra Lab

The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +793K followers.

Niccolò Granieri

Written by

Lecturer in Digital Media Technology, PhD in Music Tech and all-round tech enthusiast based in Birmingham. Currently: DMT Lab, formerly: Integra Lab

The Startup

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +793K followers.

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store