Skip to content

Benceking24/LinkBridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LinkBridge — ALSA MIDI Clock from Ableton Link

LinkBridge bridges an Ableton Link session to software/hardware that supports MIDI clock using ALSA. It converts Link tempo and transport data into MIDI Clock and makes it available through a virtual ALSA MIDI port that can be routed to virtual or physical (USB, DIN, Network...) MIDI ports.

Table of Contents

About

Ableton Link provides robust networked tempo synchronization, but many software and hardware products still rely on MIDI Clock and do not support Ableton Link yet.

LinkBridge fills that gap by receiving Ableton Link tempo and transport data, then outputting a low-jitter MIDI Clock stream through ALSA.

Features

  • Automatically joins available Ableton Link sessions on the network
  • Converts Link BPM into MIDI Clock tempo
  • Updates MIDI Clock immediately when the Link tempo changes
  • Creates a virtual ALSA MIDI output port for external devices
  • Automatically routes the virtual output to new and existing ALSA MIDI inputs

Tech stack

  • Python for application logic
  • C for ALSA/MIDI integration
  • ctypes for Python/C interop
  • ALSA sequencer for low-jitter MIDI output
  • Bash utility scripts for setup and cleanup
  • BlueZ for Bluetooth support

Requirements

  • Linux with ALSA support
  • Python 3
  • GCC
  • libasound2-dev
  • alsa-utils for debugging (mostly aconnect)

Usage

  1. Build the shared library:

    gcc -O3 -fPIC -shared -o liblinkbridge.so src/midi/midi_clock_lib.c -lasound
  2. Run the LinkBridge clock application:

    python3 src/midi/clock.py
  3. Connect the generated virtual MIDI output to a MIDI input using aconnect:

    aconnect -l
    aconnect <source> <destination>

    Example:

    aconnect 128 130

Testing

For best results, test on real Linux hardware such as a Laptop/PC or a low-cost SoC like Raspberry Pi Zero 2W.

You can also use a Linux VM for validating the ALSA integration, though expect some MIDI jitter. (around +/- 5 BPM)

Debug utilities are available in src/debug:

  • test_midi_sender.c — creates a virtual MIDI output endpoint and sends a MIDI CC value. Useful for verifying the C/Python integration.
  • test_monitor.c — creates a virtual MIDI input and calculates BPM from incoming MIDI Clock messages. Useful for validating receiver-side tempo tracking.

Contributing

Contributions are welcome.

For major changes, please open an issue before submitting a pull request.

License

MIT License

Acknowledgements

Future Ideas

  • Testing
    • Add debug scripts to create Ableton Link session locally
    • Add E2E test using the local Ableton Link session and check if midi clock is in an acceptable threshold and changes Clock within a timeframe
  • Deployment
    • Add a single installation script (unifying modification of logic, systemd, dbus files and libraries)
    • Add a single update script (unifying modification of logic, systemd, dbus files and libraries)
    • Add a single uninstall script (unifying modification of logic, systemd, dbus files and libraries)
    • Create CI to generate C libraries (for x86, ARM64) after main branch push/merge
    • Create CD to push python script, C library and install/uninstall script to GitHub
    • Integrate scripts and files into a Debian package
    • Create a Raspbian Cloudinit installer
    • Create a Raspberry Pi Connect deployment to push updates OTA
    • Add a optimization script for post installation to make Raspbian boot faster, lower power consumption and more stable for long term (minimize risk of corrupted partition with regular power loss)
  • Clarify setup for a clean Raspbian installation
  • Feature
    • Core
      • Add fade/ramp option when BPM changes
      • Add MIDI start/stop events synced to Ableton Link
    • Network
      • Enable hotspot after 30 sec with no available configured WIFI networks
    • USB OTG
      • Set USB device port as a network interface for direct connection to the Ableton Link device
      • Set USB device port as a MIDI interface to output MIDI clock
      • Set USB device port as a HID device for sending keyboard events for page turning in a music score app
      • Set USB device port as composite device with combination of these use cases (network, midi, hid)
    • Website
      • Host a website
      • Add Ableton Link session details to website
      • Add current BPM and change history to website
      • List current configured WIFI connection
      • Change WIFI connection by typing the configuration
      • List available WIFI connection
      • Change WIFI connection from list
      • Add multiple WIFI connection with priority
      • List IP setting per WIFI connection
      • Change Static IP/DHCP and DNS setting per WIFI connection
      • Change hostname
      • Toggle between USB Host mode or OTG mode and select OTG preset

About

A precision timing engine that bridges Ableton Link to USB and MIDI DIN, translating network tempo into rock-solid clock for synths, drum machines, sequencers, lighting, and video systems. Join any Link session and keep your entire hardware rig locked in tight sync, on stage or in the studio.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors