An audio engine implemented in Rust, designed for use in professional audio applications such as DAWs. (WIP)
- audio_engine_cdylib: Defines the C API for using
audio_engine_servicefrom other languages. Required for runningexample_app_flutter. - audio_engine_core: Implements core logic and models such as the Audio Graph.
- audio_engine_plugin: Integrates
audio_engine_corewithnih_plug, allowing CLAP plugins to be built. - audio_engine_service: Connects
audio_engine_corewith audio devices, making sound output possible. Can be run as a standalone service. - example_app_flutter: An example of integrating
audio_engine_cdylibwith Flutter. - example_app_tauri: An example of integrating
audio_engine_servicewith Tauri.
This project depends on the portaudio library via the audio_engine_service crate.
(However, audio_engine_plugin does not depend on it, so if you only need that, you can skip this section.)
The rust-portaudio crate should automatically build and install portaudio, so no manual steps should be necessary.
However, as of March 2025, this automatic build seems to fail on macOS. There are two possible workarounds:
-
Install
portaudiovia Homebrew.This is the easier method, but it does not produce a universal binary.
brew install portaudio
-
Build
portaudiofrom source.The issue appears to be fixed in the
masterbranch on GitHub, so you can clone and build it manually. This allows you to build a universal binary. After building, place the library in/usr/local/lib, whererust-portaudioshould be able to find it.
cargo test --workspaceRun the following command to build audio_engine_plugin and copy it to the user's CLAP installation directory.
./build_and_install_plugin.shThis will produce sound output.
cargo run --package audio_engine_serviceBefore running, audio_engine_cdylib must be built.
If it is not built yet, run the following command:
cargo build --package audio_engine_cdylibAfter building, edit main.dart to set the correct library path.
// Set the library path according to the platform.
const libPath =
'../target/debug/libaudio_engine_cdylib.dylib'; // Library file for macOSThen, run example_app_flutter.
cd example_app_flutter
flutter runFor example, to run it on a macOS device, use:
flutter run -d macoscd example_app_tauri
bun tauri devBelow is a list of major unimplemented features. Other functionalities necessary for building a professional audio application may also be needed.
Support for hosting CLAP plugins. This repository might be useful as a reference: https://github.com/prokopyl/clack/tree/main/host/examples/cpal
Currently, audio_engine_service::init is called from Dart's UI thread, but to support CLAP GUI display, it may need to be called from the platform's main thread.
Allow adding and removing nodes and edges in the AudioGraph even while accessing it from the real-time thread.
For a lock-free implementation, it may be necessary to use something like ArcSwap to swap the graph.
Functionality to place audio regions and MIDI clips on a timeline for playback.
This library might be a good option: https://github.com/Boddlnagg/midir
Porting portaudio to iOS may be challenging (not yet confirmed).
In that case, it may be better to use AudioToolbox or similar to connect AudioIO with audio_engine_core.
Support for sidechain inputs and multi-output instruments.
This is an auto-generated document. README_JA.md is the original version.