GitHub - willvincent/osc-os2l-bridge: Bridge djay Pro 6 OSC output to OS2L so SoundSwitch lighting follows your music · GitHub
Skip to content

About

Bridge djay Pro 6 OSC output to OS2L so SoundSwitch lighting follows your music

Resources

Stars

3 stars

Watchers

2 watching

Forks

Repository files navigation

OSC to OS2L Bridge

A small macOS and Windows app that lets djay Pro 6 drive SoundSwitch. djay Pro 6 sends its playback state as OSC over UDP. SoundSwitch only listens to a few DJ programs over OS2L, a JSON-over-TCP protocol. The bridge translates between the two, so SoundSwitch treats djay as if it were VirtualDJ.

djay Pro 6 --OSC/UDP--> OSC to OS2L Bridge --OS2L/TCP--> SoundSwitch
                                                        (sees "VirtualDJ")

What you get

  • Beat-synced lighting from djay's bar, beat and phase.
  • Scripted songs: the bridge tells SoundSwitch the file path of the loaded track, so SoundSwitch can match its script.
  • The deck driving the beat clock and MIDI lighting is marked "Driving lights" on its card.
  • 2 or 4 decks.
  • Automatic reconnect if SoundSwitch is restarted.
  • Automatic discovery of SoundSwitch on the network, so there is no port to type.

Requirements

  • macOS, Intel or Apple silicon (releases are a universal build), or Windows 10/11 x64 (installers are built by CI, unsigned: SmartScreen shows "Windows protected your PC"; choose More info > Run anyway). There is no Linux app.
  • djay Pro 6 with the pro features that unlock OSC.
  • SoundSwitch.

Setup

Install

Download the latest .dmg from the Releases page, open it, and drag the app to Applications. Releases are unsigned pre-releases for now, so macOS will block the first launch: see Opening an unsigned build.

Steps

  1. Open the app from Applications.
  2. Set up OSC in djay Pro. Open Settings > Advanced > OSC.
    • Turn on Enable OSC.
    • Set IP address to 127.0.0.1 if djay and the bridge run on the same Mac. Otherwise use the IP address of the Mac running the bridge (the bridge listens on all interfaces).
    • Set Port to match the bridge's OSC port (default 8000; see Settings below). The two must be the same.
    • Make sure the Status row shows that djay is sending. Use the button in that row if it is not.
  3. Set up SoundSwitch. Choose VirtualDJ as the DJ software. The bridge finds SoundSwitch automatically through Bonjour. SoundSwitch's port changes every time it launches, and the bridge follows it.
  4. Press Start in the bridge.

States

State Meaning
Stopped Not running.
Searching for SoundSwitch Looking for SoundSwitch on the network (auto-discover). Make sure SoundSwitch is running and set to VirtualDJ.
Connecting to HOST:PORT Manual mode only: opening the connection to the address you entered. (In auto-discover mode the app shows "Searching for SoundSwitch" until it is connected.)
Connected Talking to SoundSwitch.
Reconnecting The connection dropped; the bridge is trying again and will pick up SoundSwitch's new port if it restarted.

Local Network permission

The first time the app browses for SoundSwitch, that is, when you press Start in Auto-discover mode, macOS asks whether the app may find devices on your local network. Allow it. Without it, discovery finds nothing. Manual mode never browses, so it does not prompt. You can change this later in System Settings > Privacy & Security > Local Network.

Opening an unsigned build

Until a notarized build exists, macOS Gatekeeper will refuse the first launch.

  1. Try to open the app once, then dismiss the warning.
  2. Open System Settings > Privacy & Security, scroll to the message about the app, and click Open Anyway.
  3. Older route: right-click the app in Finder and choose Open.

If macOS says the app is "damaged" or "can't be opened" after download, remove the download quarantine flag in Terminal:

xattr -dr com.apple.quarantine "/Applications/OSC to OS2L Bridge.app"

This only clears the flag macOS adds to downloaded files, so Gatekeeper stops checking the app. Only do it for software you trust.

Scripted songs

SoundSwitch matches scripts by file path. The bridge matches the title, artist and duration that djay sends over OSC, looks that track up in djay's library database, and sends SoundSwitch the file path it finds. This works for local files. Tracks from streaming services have no local file, so they have no path and no script.

Settings

Setting Default Notes
OSC listen port 8000 UDP port the bridge listens on. Must match the port in djay.
Decks 4 2 or 4.
SoundSwitch connection Auto-discover Auto-discover finds SoundSwitch via Bonjour (_os2l._tcp). Manual takes HOST:PORT, for example 192.168.1.20:5000. IPv6 goes in brackets, and a zone must be the numeric interface index, for example [fe80::1%4]:5000.
SoundSwitch service name filter empty Auto-discover only. Use only a service whose name contains this text (case-insensitive). If several services are found and no filter is set, one whose name starts with "SoundSwitch" is preferred.
djay library database Automatic Path to djay's MediaLibrary.db. Empty uses ~/Music/djay/djay Media Library.djayMediaLibrary/MediaLibrary.db on macOS and %USERPROFILE%\Music\djay\djay Media Library\MediaLibrary.db on Windows.
Start the bridge when the app opens off Auto-start.

Settings has four tabs: Connection, MIDI, Sections and Advanced. Connection and Advanced are locked while the bridge is running; their changes apply the next time you press Start. MIDI and Sections stay editable and apply immediately. They are stored in settings.json in the app's config folder, which macOS derives from the bundle identifier com.willvincent.osc-os2l-bridge.

Section lighting (MIDI)

Opt-in (Settings > MIDI > "Send MIDI on section change"). When djay enters a TrackSense section on the deck that drives the beat clock, the bridge sends MIDI on a virtual port named "OSC to OS2L Bridge". Each section can set the four Group intensity faders (percent, 0-100) and/or pick one of SoundSwitch's four autoloop banks (1 Dynamic, 2 Upbeat, 3 Smooth, 4 Random), which plays a random autoloop from that bank. Blank cells send nothing; groups are sent first, then the bank. Sections on other decks are ignored. Edit the table in Settings > Sections. By default every section sets all four groups to 100% and presses no bank; "Reset to defaults" on that tab restores this.

Under each section that has a bank, "Choose loops" opens a grid of that bank's 32 autoloops (4 columns of 8, like SoundSwitch's layout), all ticked by default. Untick loops to restrict the section to the rest; the bridge still picks one at random and never repeats back to back. Leave a single box ticked and that same loop is pressed every time. At least one box must stay ticked. "Reset to defaults" ticks them all again.

BPM ranges: "Add BPM range" on the Sections tab adds a copy of the default table that applies while the driving deck's tempo is in a range (From inclusive, To exclusive, either may be blank; ranges may not overlap). The tempo is the deck's current BPM, or the track's BPM when that is not reported. The table is chosen when a section message is sent (a section change, a deck handover, resuming from pause or a scripted track, or editing the current section), never by tempo changes inside a section. Any BPM outside every range uses the default table. Ranges are full copies, not merged with the default, so a section left blank in a range sends nothing while that range is in force. "Reset to defaults" on a range copies the current default table.

Windows (experimental): programs can't create MIDI ports without a driver, so install loopMIDI, add a port named exactly OSC to OS2L Bridge and keep loopMIDI running; the bridge sends to that port. Full steps are in INSTALL-WINDOWS.md (shipped in the Windows release zip, source in windows/). Windows Firewall may ask to allow the app on first start: allow it on private networks so djay's OSC and SoundSwitch discovery get through.

On macOS the virtual port exists whenever the setting is on, whether or not the bridge is running: it is created when you turn the setting on (or when the app opens with it on) and removed when you turn it off or quit. If the port can't be created, a warning is shown and the next save or Start tries again. When the port opens and when the bridge starts, it briefly nudges each Group fader (one step off, then back) so SoundSwitch registers the controls immediately.

MIDI lighting would override SoundSwitch scripted tracks, even with SoundSwitch's "override scripted tracks" setting off. So by default ("Leave scripted tracks to their script" in Settings > MIDI, on) the bridge sends no MIDI while the deck driving the lights is playing a scripted track, and relights the current section when that changes. A track counts as scripted if its file has the SOUNDSWITCH_ID tag SoundSwitch writes; only tracks the bridge can resolve to a local file are checked (streaming tracks count as unscripted). This is a heuristic based on SoundSwitch's tag, not a documented API. Turn the option off to light over scripted tracks. You can also pause by hand with the "MIDI lighting" button on the main window (or Settings > MIDI): nothing automatic is sent while paused (the port stays open, so MIDI learn still works), and resuming re-sends the current section's levels and bank.

Pressing an autoloop makes SoundSwitch turn on its "Override Scripted Tracks" state by itself, so pausing alone would let the autoloop keep running over a scripted track. When lighting goes quiet (paused by hand or skipped for a scripted track), the bridge therefore presses SoundSwitch's Override Scripted Tracks control (mapped to note 0 on MIDI channel 2, so it can't collide with the autoloop notes on channel 1) once, but only if it had engaged override with a bank press; nothing is pressed on resume, because the next bank press engages override again. The bridge cannot read SoundSwitch's override state, so toggling that control by hand in SoundSwitch can put the two out of sync (the next bank press re-engages and resyncs). This relies on the control being a toggle and the release has not yet been verified against a real SoundSwitch. Map it with the "Send Override toggle" button in Settings > MIDI (right-click SoundSwitch's Override Scripted Tracks button, choose Map, then click it), or use the export; the export's encoding of channel 2 is unverified, so if the button isn't mapped after importing, map it with that button.

Control MIDI
Group 1-4 intensity CC 102, 103, 104, 105 (channel 1)
Override Scripted Tracks (toggle) note 0 on channel 2 (press = note on 127, then note off)
Bank 1 Dynamic notes 0-31 (autoloops 1-32), channel 1
Bank 2 Upbeat notes 32-63 (autoloops 33-64)
Bank 3 Smooth notes 64-95 (autoloops 65-96)
Bank 4 Random notes 96-127 (autoloops 97-128)

Notes 0-127 on channel 1 map to SoundSwitch's 128 individual autoloop buttons (AutoLoops 1-128, four banks of 32). When a section selects a bank, the bridge presses one note chosen at random from that bank's range, never the same note twice in a row for that bank. Each press is momentary: note on (velocity 127) immediately followed by note off. You may need to pick the matching mapping type for those buttons in SoundSwitch.

For the bank feature to work, all 128 notes must be mapped to the matching Autoloop buttons in SoundSwitch (note N to autoloop N+1). Settings > MIDI can export a ready-made mapping (below).

Example: Chorus = Bank 2, Group 1 at 100%, Groups 3 and 4 at 0%. Whenever the driving deck enters a Chorus, the bridge sets those three groups and plays a random autoloop from Bank 2.

Mapping: Settings > MIDI > "Export SoundSwitch mapping" writes a ready-made mapping file (notes 0-127 for autoloops 1-128, CC 102-105 for Group Intensity 1-4, all channel 1, and note 0 on channel 2 for Override Scripted Tracks) to a folder on your Desktop, with an INSTRUCTIONS.txt. To use it: quit SoundSwitch, open your project's .ssproj package (Show Package Contents) > recordable, back up any existing 7ce5eb8b689a957b8032d703a1ace534.dat, copy the exported file over it, and start SoundSwitch. If it doesn't load, re-run the export with SoundSwitch closed. The file replaces the project's whole MIDI mapping store, so mappings for other MIDI controllers are lost unless you back them up (the bridge does not merge). This is experimental: it relies on SoundSwitch's undocumented file format. If SoundSwitch doesn't pick it up, restore your backup.

Warning: this overrides manual changes in SoundSwitch. Changes to the table apply live: the next section change uses them, and if you edit the section that is playing now, it is sent again once. If SoundSwitch doesn't see the port, try restarting it.

Light timing

Settings > Advanced > Light timing shifts the lights against the music, in milliseconds (-200 to +500, default 0). Negative sends beats earlier (for lights that lag the music); positive delays them (for lights that run ahead, such as with slow speakers). It is one global setting for OS2L beats and MIDI section lighting, and it applies immediately, even while the bridge runs.

Section changes can only be delayed: djay announces them on the boundary, so they cannot be sent early. Negative values leave section MIDI as it is.

Tune by eye and ear: start at 0 and adjust in 20-50 ms steps. SoundSwitch scripted tracks follow the time and beat position the bridge reports, and those shift too; this has not been checked against real scripted shows.

Command line

osc-os2l-bridge-cli is the same bridge without the window.

osc-os2l-bridge-cli [--os2l HOST:PORT | [--service NAME]] [--osc-port 8000] [--decks 4] [--db PATH]
                    [--no-placeholder-paths] [--no-title-length-match] [--replay FILE.jsonl [--realtime]]
  • --os2l HOST:PORT connects to a fixed address. Without it, SoundSwitch is discovered through Bonjour and followed across restarts.
  • --service NAME (discovery only) uses only a service whose name contains NAME.
  • --osc-port is the UDP port to listen on, on all interfaces (default 8000).
  • --decks is the number of decks (default 4).
  • --db PATH overrides the library database path.
  • --no-placeholder-paths turns off the placeholder file path sent for tracks with no local file (on by default, see Troubleshooting). The old --placeholder-paths is still accepted and does nothing.
  • --replay FILE.jsonl feeds a recorded OSC capture (one JSON object per line with t, address, types, args) to SoundSwitch instead of listening on UDP. It waits up to 10 seconds for SoundSwitch to subscribe. By default it runs as fast as possible; add --realtime to keep the original timing.

Run it from a source checkout with cargo run -p bridge --bin osc-os2l-bridge-cli -- --help.

Building from source

You need stable Rust and Node.

npm install
npx tauri dev       # run the app in development
npx tauri build     # release build for this Mac: .app and .dmg under src-tauri/target/release/bundle
npx tauri build --target universal-apple-darwin   # universal (Intel + Apple silicon) build, as released
cargo test --workspace    # at the repo root: os2l, translator and bridge crates
cd src-tauri && cargo test
npm test            # frontend validators

The universal build needs rustup target add x86_64-apple-darwin aarch64-apple-darwin once. Its .dmg is named ..._universal.dmg and lands under src-tauri/target/universal-apple-darwin/release/bundle/dmg/. See RELEASING.md for maintainers.

The app icon is generated from assets/app-icon.png: npx tauri icon assets/app-icon.png.

Troubleshooting

Connected in the bridge, but SoundSwitch's DJ indicator is red. This is SoundSwitch behavior that was observed, not something the bridge controls. In one setup the DJ-software indicator stayed red while SoundSwitch's Art-Net output was enabled and no receiver was running. It went green once a receiver (a visualizer) was running, or once Art-Net was disabled. SoundSwitch also has a separate hardware status indicator. If you see this, check your SoundSwitch output settings.

Discovery finds nothing. Check that the Local Network permission is allowed for the app, that both computers are on the same network, and that SoundSwitch is running with VirtualDJ selected. If it still finds nothing, switch to Manual and enter SoundSwitch's address and port.

"Another app is using OSC port 8000." The app shows "Another app is using OSC port 8000. Close it or pick a different port in Settings." The CLI prints error: cannot bind UDP port 8000: .... Another program (or a second copy of the bridge, or the CLI) is already listening on that UDP port. Close it, or change the port here and in djay.

No file path found for a track. The bridge could not match the track to exactly one local file. Typical reasons: the track is not in djay's library database, it comes from a streaming service (no local file), or title, artist and duration match several different files. The app warns "djay's library database wasn't found" if the database file is missing; set its path in Settings. The CLI does not check for the database, so there a missing file just means no paths are found.

The deck card says "No library match" (hover for the reason: no match, several files share the tags, or streaming only). If a track you expect to be found is not, run python3 tools/djay_library_dump.py --grep "part of the title" and send the output. It lists the matching library rows with their exact title and artist text, duration and file name (never the folder), and opens the database read-only, so it is safe while djay runs. The output contains titles, artists and file names, so read it and remove anything you do not want to share before sending.

Streaming tracks don't light, or get no lights after a scripted track. SoundSwitch may treat a deck with no file path as empty (or keep treating it as playing the previous scripted track) and not play autoloops. By default the bridge sends a made-up file path for tracks with no local file so SoundSwitch registers them; SoundSwitch will log that the file isn't found. If that causes problems, turn it off in Settings > Advanced ("Send a placeholder file path for tracks without a local file") or with --no-placeholder-paths for the CLI. Applies the next time the bridge starts.

Large libraries. Lookups are indexed: when the bridge starts it reads djay's library once into a compact in-memory index (about 0.3 s for 200,000 tracks and 0.8 s for 500,000 tracks on a 4-thread build, index size about 17 MB per 200,000 tracks, about 25% more while it is being built; synthetic benchmark). While it does, the window shows "Preparing song library index..." and nothing is sent to SoundSwitch or MIDI; djay's OSC is still followed, and the current section is lit once when the index is ready. If the library database isn't found there is nothing to wait for. The index is built at start: restart the bridge or press Rebuild library index (Settings > Advanced) after adding local tracks. The rebuild runs in the background and the old index keeps answering until it is done. A track that finds no unique local file only matters for scripted tracks; streaming tracks don't need a rebuild. Maintainers: cargo test -p bridge --release bench_large_libraries -- --ignored --nocapture times the build on synthetic data. A persisted index (re-decoding only changed rows) is a documented option in crates/bridge/src/djaylib.rs, worth building only if the 1M-track build time becomes too slow.

Tracks not found even though the files exist. Run python3 tools/djay_library_survey.py (Python 3, nothing to install). It reads a temporary copy of djay's library database, so it is safe while djay is open, and prints anonymous counts only: how djay stores file locations, how many resolve to files that exist. It prints no titles, artists, paths or volume names, so you can paste the output into a bug report. --json prints JSON and --db PATH points it at another database.

Does the bridge need access to my music? It only opens djay's MediaLibrary.db read-only to look up file paths, and never writes to it. One side effect: a read-only open of a database in WAL mode can create -wal and -shm files next to it in djay's folder when djay is not running. The bridge does not touch your audio files.

How it works

  • OS2L is JSON messages over TCP. SoundSwitch is the server; the bridge connects to it as a client. SoundSwitch subscribes to the values it wants, and the bridge answers those subscriptions and sends beat messages derived from djay's bar, beat and phase OSC.
  • The bridge reads SoundSwitch's SOUNDSWITCH_ID tag from the playing file (the CLI too) and answers SoundSwitch's %SOUNDSWITCH_ID request with it, so scripts match even when the file path doesn't. A loaded track without the tag gets the all-zero id, as in VirtualDJ.
  • SoundSwitch ignores a deck level or the crossfader until it has seen it change, and djay only sends them when they move. So on each connect the bridge nudges every deck level and the crossfader slightly and then sends the current value (all decks at 100% and the crossfader centred until djay reports real values).
  • Known limits:
    • djay's section and TrackSense events are not forwarded, because SoundSwitch does not subscribe to them. The window shows each deck's current section.
    • The section pill colors follow the section colors you set in djay. The bridge reads them (read-only) from djay's preferences file and falls back to djay's default colors. macOS may ask whether the bridge may access data from another app. On Windows the colors are not read and djay's defaults are used.
    • Scripted-track detection relies on SoundSwitch's SOUNDSWITCH_ID file tag (not a documented API) and only covers tracks that resolve to a local file.
    • djay's library database format is undocumented and could change with a djay update.
    • Track lookup tries stricter comparisons first and moves on only if nothing matched: exact (case, whitespace), then accent/quote/dash-insensitive, then percent-encoded (%C3%A9) or HTML-escaped (&) text, then ignoring "feat." credits, Original Mix / Radio Edit style suffixes and punctuation (and a track credited to only one of several artists), then plain-letter spelling (o-slash = o, sharp s = ss, ligatures and fullwidth letters; other scripts are compared as written). Remix, Extended, Dub and Edit versions are never treated as the original, and a result must be exactly one local file.
    • As a last resort, when nothing matches title and artist, the one file with the same title and a length within half a second is used and the deck card says "Approximate match" (never when several files fit, and never for short titles under 6 letters and digits, such as "Intro"). Turn it off in Settings > Advanced ("Match by title and length when the artist differs", applies on the next start) or with --no-title-length-match for the CLI.
    • djay OSC has no state dump on connect, so deck values appear only after the first updates arrive.

License

MIT, see LICENSE.

Not affiliated

This project is independent. djay, Algoriddim, SoundSwitch, Onesixone, VirtualDJ and Atomix are trademarks of their respective owners.

About

Bridge djay Pro 6 OSC output to OS2L so SoundSwitch lighting follows your music

Resources

Stars

3 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages