Networked/Clustered SuperCollider

I asked this question in the Tidal forums as well, but after more tinkering I am pretty certain this should be doable with raw OSC/Supercollider.

The basic idea is I have a performer, an audience, and a projector. The:

  • Performer has a DI into a machine either running SC (local) or reading from and writing to a stream with SC (remote)
  • Projector displays a QR code that leads audience members to a link. The display for the QR code knows A. how many current connections (people have opened the link) and B. when there are no current connections.
  • Audience (maybe 20-30 people) open the link and it brings them to a web server that plays some randomly generated oscillator. The oscillator that plays is different for each audience member, however each oscillator gets sent to the performer’s SC instance and uses it as either FM, AM, PM or LFO mod on the input signal from the performer. That is, the more people that have the link open, the more modulation is occurring on the performer’s raw signal (and if no one has it open, the signal is basically bypass).

tl;dr, audience opens link, single oscillator plays on their phone and is sent to modulate performer’s sound, more links open = louder individual amplitude for each oscillator/connected device. When no more active connections, no more oscillators and no more sound.

My technical implementation idea would be that the web server would maybe be a GCP or AWS instance running all of the software. When an incoming connection happens, spin up a Docker container (or k8s pod) and run SC inside, open two ports (say 1234 and 5678), play audio on the audience’s phone from port 1234 and send same audio on 5678 to another running SC instance that is waiting for incoming oscillators. Each pod/container talks to a master controller that keeps track of how many active connections are on the server; the amplitude increases with increasing number of connections.

My question is:

  • How would I implement this? My guess is I need to open some random number of UDP ports in OSC, assign them to certain connections, and then use NetAddr() to send data and some other stuff… I don’t know what I don’t know, if I had a list of pieces I’m pretty sure I could put them all together

Has anyone done anything similar and have some advice?