Synchronize tempo and beat phase between multiple web browser clients using Ableton Link and a Node.js bridge.
Open multiple browser windows and have them play clicks in sync, with tempo changes instantly applied across all instances.
- Synchronize tempo (BPM) and phasor/beat phase across browsers.
- Real-time distributed clock using Node.js + WebSockets.
- Clients schedule audio clicks with the Web Audio API.
- Downbeat is highlighted with a higher tone (880 Hz), other beats use a lower tone (440 Hz).
- Any client can change the global tempo, and all stay aligned.
npm init -y
npm install express ws abletonlink
node server.js
Open http://localhost:3000/client.html
Press Start Audio to enable sound. Open the same page in multiple browsers or devices on local network to test synchronization.
- The Node.js server uses the
abletonlinklibrary to maintain a Link session at a given BPM. - A simple global beat clock (
beatPosition) runs continuously on the server. - Every 50 ms, the server broadcasts the current BPM, beat index, and phase to all connected clients.
- Browser clients schedule audio clicks aligned to the next beat based on the server’s timing data.
- Changing the tempo in one client sends an update to the server, which propagates to all peers.
-
server.js
Node.js application that hosts the WebSocket server, Ableton Link session, and serves static files. -
client.html
Browser client that connects to the server, schedules audio clicks in sync, and provides a simple BPM control.
- Make sure to allow audio playback in your browser (browsers require user interaction before sound can start).
- On other devices in the same network, replace
localhostinclient.htmlwith your server’s LAN IP. - The project currently provides basic synchronization. Advanced Link features (e.g., drift correction, start/stop transport) would require deeper integration with the Ableton Link SDK.
MIT License