Skip to content
Bektur edited this page Jun 9, 2015 · 9 revisions

NetsendPD

A multi-channel audio streaming proof of concept for portable scenarios.

This project allows streaming any multi (2 and more) channel audio from a Mac/PC server in realtime to mobile iOS clients. At the same time, clients are able to communicate with server via OSC protocol, and automatically reconfigure themselves depending on the proximity to iBeacon indoor positioning markers.


Requirements:

  • iOS 7.0+ (it's possible to build it against 6.0, but not recommended)

  • Python 2.7 with modules: pyosc, pybonjour

  • Pd-extended v0.43.4 and up (it might be necessary to check if Pd can find all external objects used in test patch)

  • Mac or PC server connected to a wireless spot via LAN cable and, ideally, the Wi-Fi spot should work in 5Ghz frequency.

  • (Optional) Estimote (or any other) iBeacons for indoor positioning


Setup

  1. Download or clone this repository to any local folder. Open it and try building an iOS project.

  2. If an updated version of libpd is used and there is no sound, make sure to read check for this issue

  3. Go to Pd patch and scripts folder and check if Pd patch has all externals up and running, and python script runs without compatibility errors. It might be necessary to install the following modules: pyosc, pybonjour

  4. Finally, connect the Mac/PC server to wireless router via LAN cable and turn off wireless network. If possible, switch the wireless router to 5Ghz frequency. Ideally, this would mitigate most of the network issues. If this frequency is not available, try at least a wired LAN connection for server, as it would still significantly reduce network noise.

  5. For iBeacons (e.g. Estimote iBeacons), make sure that the minor value of an iBeacon corresponds to the number of channel you want to place in the same location.


Usage

  1. Go to Pd patch and scripts folder, open up multistream.pd (see further about picking sound sources)
  2. In Xcode project, build this application for every device used in the loudspeaker setup.
  3. When application starts, select a unique channel number (in current demo 1-6)
  4. In Pd patch and scripts folder, run the bonjourBrowseOSC.py script
  5. You should hear some white noise and oscillating sound coming from the device. If there is no sound, check for volume level, and make sure that silent mode is switched off

Picking a sound source

In [pd audio_source] subpatch you can find various sound sources. Simply reconnect each outlet to [s~ stream_audio_n] objects for each channel. [adc~] object is used to stream any audio received from Pd sound input device.

To route audio from elsewhere on Mac OSX you need to:

  1. Install Soundflower
  2. Open Audio MIDI setup, pick Soundflower 2ch or 64ch as both default input and output
  3. In Pd, go to Media -> Audio Settings and pick Soundflower both as input and output.
  4. Run the application, script and patch. Route everything from [adc~] object in patch to streaming outputs
  5. Play any sound file on the server. You should now hear the sound coming from iOS devices instead of speakers.

Testing

The developed prototype was tested in fifteen sessions, with two test cases in each session. In each session, the channels were at first swapped virtually through a client-side GUI, and then physically, by switching the positions of smartphones. At each step, the time between the start of session and the end of channel reconfiguration on both clients was measured.

Test results: (all measurements are in seconds)

Session # Test case 1 Test case 2
1 2.5 4.86
2 3.2 5.75
3 2.23 5.62
4 4.48 6.47
5 1.8 6.18
6 2.38 10.13
7 3.46 5.92
8 4.63 6.64
9 2.33 7.45
10 3.45 5.61
11 3.13 7.14
12 5 7.06
13 2.78 6.19
14 3.28 6.86
15 2.26 9.66
Average: 3.1273 6.7693
Clone this wiki locally