Plain Rust wrapper of Ableton Link's C 11 extension

Overview

Crate API

rusty_link

rusty_link is a Rust wrapper of abl_link, which is a C 11 extension for Ableton Link, provided by Ableton. This library attempts to be mostly unopinionated and plain in copying the functionality of abl_link, while providing some of Rust's safety guarantees.

Ableton Link is a technology that synchronizes musical beat, tempo, phase, and start/stop commands across multiple applications running on one or more devices. Applications on devices connected to a local network discover each other automatically and form a musical session in which each participant can perform independently: anyone can start or stop while still staying in time. Anyone can change the tempo, the others will follow. Anyone can join or leave without disrupting the session.

Examples

To run the examples, clone this repository and change into its directory. Then fetch the Ableton Link source by initializing the git submodules with:

git submodule update --init --recursive

link_hut_silent: A Rust port from C of the simple 'LinkHut' example without sound by Ableton. To run it:

cargo run --release --example link_hut_silent

link_hut: A Rust port from C++ of the more complex 'LinkHut' example with sound by Ableton. Run it like this:

cargo run --release --example link_hut

See the cpal documentation for ASIO and Jack support, if required.

Requirements

Requires a recent version of CMake (3.14 or newer) to be installed and available in your terminal. Test with cmake --version.

Linux may require a few more system libraries to be installed for C compilation, depending on your distro, like build-essential, libclang-dev or libasound2-dev and pkg-config for examples, etc...

Thread and Realtime Safety

'abl_link.h' has doc comments about thread and realtime safety on some of its functions. Those comments have been copied to the functions of this library. A short explainer on what they mean:

  • Thread Safety: Thread-safe code only manipulates shared data structures in a manner that ensures that all threads behave properly and fulfil their design specifications without unintended interaction.

  • Realtime Safety: These functions can be called in a Realtime environment without blocking the thread. For example, the audio thread/callback.

Implementation

  • rusty_link currently wraps around all functions available in 'abl_link.h' and makes them publicly available as methods on either the AblLink or the SessionState struct, except for the destructors, which are implemented on the Drop trait.
  • An instance of AblLink can be thought of as an Object with internal mutability. Thread safety is guaranteed in all functions, except for the capture/commit of Session States, with internal Mutexes on the C++ side. Check the function doc comments and official Link documentation for more.
  • Includes a Rust port of the C++ HostTimeFilter, which can be used in the audio callback to align the host clock with the sample clock.
  • Delete functions have been added to delete previously set num_peers, start_stop and tempo callbacks.

Testing

Ableton designed a Test Plan to test if your implementation of Ableton Link in your project meets all the expected requirements.

Tested Platforms

rusty_link itself works on all major platforms. I only had trouble with the example with sound on Linux. Could be my fault for not using cpal properly?! Any help with that is highly appreciated. 😘 Anyway, this shouldn't stop anyone from using this library in their project. Have fun!

MacOS M1 Win 11 WASAPI Ubuntu 22 on Pi4
Building rusty_link βœ“ βœ“ βœ“
Example: link_hut_silent βœ“ βœ“ βœ“
Example: link_hut βœ“ βœ“ cpal/ALSA issues?!

Feedback

I am not a professional Developer, just doing this as a hobby, so any help with updates and corrections of my work are welcome.

License

Ableton Link is dual licensed under GPLv2+ and a proprietary license.

This means that rusty_link has to be under the GPLv2+ as well.

If you would like to incorporate Link into a proprietary software application, please contact Ableton at [email protected].

Credits

Thanks to Magnus Herold for his implementation. I made this library to learn about FFI in Rust and I started it as a fork of his.

Some code for splitting closures has been borrowed from ffi_helpers with altered functionality. Thanks to Michael F Bryan for his work. Pull request to ffi_helpers pending...

Links

For anyone interested, I also started making a multi-platform Ableton Link wrapper for Flutter, called f_link.

You might also like...
FileSorterX is an automatic file sorting application that sorts your files into folders based on their file extension
FileSorterX is an automatic file sorting application that sorts your files into folders based on their file extension

FileSorterX is an automatic file sorting application that sorts your files into folders based on their file extension. With FileSorterX, you can easily keep your files organized and find what you need quickly.

Experimental extension that brings OpenAI API to your PostgreSQL to run queries in human language.

Postgres ChatGPT Experimental PostgreSQL extension that enables the use of OpenAI GPT API inside PostgreSQL, allowing for queries to be written usi

Extension trait to chunk iterators into const-length arrays.

const-chunks This crate provides an extension trait that lets you chunk iterators into constant-length arrays using const generics. See the docs for m

GitHub CLI extension to search some repos interactively.
GitHub CLI extension to search some repos interactively.

gh activity GitHub CLI extension to search some repos interactively. It's wrapper to build gh command provided by GitHub CLI, it could search more eas

Cross-platform GameMaker extension for getting system information and resource usage
Cross-platform GameMaker extension for getting system information and resource usage

GM Sysinfo Cross-platform GameMaker extension for getting system information and resource usage Table of Contents Table of Contents Examples Display m

A PostgreSQL extension for rendering the Tera HTML templating language.

PGTera PGTera is a PostgreSQL extension that provides functions for using Tera to render HTML templates. When used with a tool like Postgrest, you can

A low-level ncurses wrapper for Rust

ncurses-rs This is a very thin wrapper around the ncurses TUI lib. NOTE: The ncurses lib is terribly unsafe and ncurses-rs is only the lightest wrappe

argmax is a library that allows Rust applications to avoid Argument list too long errors (E2BIG) by providing a std::process::Command wrapper with a

argmax argmax is a library that allows Rust applications to avoid Argument list too long errors (E2BIG) by providing a std::process::Command wrapper w

Wrapper around atspi-code to provide higher-level at-spi Rust bindings

atspi Wrapper around atspi-codegen to provide higher-level at-spi Rust bindings. Contributions Take a look at our atspi-codegen crate, and try inpleme

Comments
  • Thanks!

    Thanks!

    Hey, I just found this libary while looking at the ableton_link library, thanks for making it! I'm building it on a Mac M1, works great! Also thanks for porting the example, very nice!

    opened by fhennig 4
Owner
anzbert
anzbert
A plain-text Issue and PR tracking system

Markrequests A plain-text Issue and PR tracking system. An example of a file to track these is in prs/example.md Rationale I am unsatisfied with the c

Tristram Oaten 11 Dec 11, 2023
Store your transfer.sh links, so you can remember them later and know when they will expire, but now written in Rust.

Transfer.sh helper Rusted The idea of the script is to store your transfer.sh links and simplify its usage, so you can remember them later and know wh

Reinaldo Rozato Junior 10 Nov 30, 2022
A rust-cli to track and practise all your DSA links :)

Abhyas Abhyas is a Rust command-line application for managing and interacting with a database of links. Features Check Status: Get the total, complete

Harshal Jadhav 3 Nov 25, 2023
fixred is a command line utility to fix outdated links in files with redirect URLs.

fixred fixred is a command line utility to fix outdated links in files with redirect URLs. Installation fixred is installed via cargo package manager.

Linda_pp 35 Aug 6, 2022
Multi-threaded CLI torrent scraper for displaying searched for magnet links; tailored for use with plex & ssh.

magnetfinder Multi-threaded CLI torrent aggregator; scrapes torrent results from multiple websites and delivers them into a table in your terminal! Su

Ryan 59 Dec 10, 2022
Multi-threaded CLI torrent scraper for displaying searched for magnet links; tailored for use with plex & ssh.

magnetfinder Multi-threaded CLI torrent aggregator; scrapes torrent results from multiple websites and delivers them into a table in your terminal! Su

null 59 Dec 10, 2022
🌊 ~ seaward is a crawler which searches for links or a specified word in a website.

?? seaward Installation cargo install seaward On NetBSD a pre-compiled binary is available from the official repositories. To install it, simply run:

null 3 Jul 16, 2023
Jupyter extension for Rust.

rustdef Jupyter extension for jupyter notebook and rust user. You can define functions in rust and run them as python functions. This extension is bui

Ryosuke Kamesawa 20 Dec 14, 2022
This automatically patches the RoPro extension for you, allowing you to have pro_tier for free.

RoPro Patcher This automatically patches the RoPro extension for you, allowing you to have pro_tier for free. NOTE Chrome, Brave (and possibly other b

Stefan 10 Jan 1, 2023
Extension to `thiserror` that helps reduce the amount of handwriting

justerror This macro piggybacks on thiserror crate and is supposed to reduce the amount of handwriting when you want errors in your app to be describe

ShakaCode 2 Nov 16, 2022