Skip to content

Repository files navigation

ofxScPhaseBridge

A minimal OSC bridge for sharing one clock between SuperCollider and openFrameworks. Built small on purpose — to avoid the induced debilitation of heavier setups.

SuperCollider owns the clock and sends a phase ramp (0..1) once per bar. openFrameworks receives it, subdivides it into a step grid at its own frame rate, and you click a step to arm it. From then on it sounds once per bar, the instant the phase sweeps across it — and the on-screen flash is driven by the beat echoed back from SC, so if the two ever drift you can watch them separate.

phaseBridge

The contract

SuperCollider ──/phase <float 0..1>──► openFrameworks   (the clock)
openFrameworks ──/beat  <int step>───► SuperCollider    (arm / disarm a step)
openFrameworks ──/tempo <float barDur>► SuperCollider   (optional)
openFrameworks ──/clear ─────────────► SuperCollider    (disarm all)

SuperCollider has no opinion about beats or meter; it only reports where it is in the bar. openFrameworks declares which step is active, never when it should sound. Timing authority stays in one place, which is what keeps the two in sync without any negotiation.

Dependencies

  • ofxOsc (ships with openFrameworks)

Usage

The addon gives you the openFrameworks side as a small class. It holds no clock of its own — getPhase() is the last value SC reported, and consumeBeat() returns a step to flash on each round-trip:

#include "ofxScPhaseBridge.h"

ofxScPhaseBridge bridge;

void ofApp::setup() {
    bridge.setup(9001);   // SC sends /phase and /beat here
}

void ofApp::update() {
    bridge.update();
    float phase = bridge.getPhase();     // 0..1 across the bar
    int   beat  = bridge.consumeBeat();  // step to flash, or -1
}

See example-phaseBridge for a full sketch: the step grid, click-to-arm, playhead, and round-trip flash.

example-twoWindow shows a performance setup — the control grid on one window and an output-only visual on a second window (a phase-driven sweep plus beat-driven pulses), both reading one shared bridge. It's a starting point for putting audience-facing graphics on their own screen.

Running the example

  1. Open supercollider/bridge.scd, select the top block, and evaluate it.
  2. Wait for READY in the post window.
  3. Build and run example-phaseBridge (regenerate project files with the openFrameworks projectGenerator if needed; ofxOsc is the only dependency).
  4. Click a step cell to arm it. Arrow keys change tempo, c clears.

License

MIT — see LICENSE.

Notes

I'd appreciate any feedback, and I'd welcome anything you'd add or approach differently — whether on the SC side or the OF side.

About

A minimal OSC bridge for sharing one clock between SuperCollider and openFrameworks. Built small on purpose — to avoid the induced debilitation of heavier setups.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages