GithubHelp home page GithubHelp logo

thegreatwhiteshark / ladspa-plugins-in-rust Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 170 KB

Writing some example LADSPA plugins in Rust and exploring their performance

License: The Unlicense

Makefile 0.43% C 49.15% Rust 4.73% Shell 0.28% Jupyter Notebook 45.41%
rust ladspa

ladspa-plugins-in-rust's Introduction

An example stereo delay LADSPA plugin written in both Rust and C to compare their performance.

Motivation

It's been a while since I have the idea of writing some LADSPA plugins in a language other C. Why? Because there is a number of more recent languages improving both the process of writing code and making it more save and resilient per default by a margin.

Modern C++ would be a candidate but it's rather complex, grew too naturally, and it does not provide enough helpful tools, like default linter, documentation, and test utils, nor a compiler easing the development.

Since LADSPA plugins are meant to be used in realtime computation, the language of choice must not be garbage collected. Therefore Go is off the table. This pointed to Rust. For a good introduction I can recommend the book.

Result

Before jumping right into plugin development one has to access whether the LADSPA plugins written in Rust are sufficiently efficient. Of course, a little bit of performance can be sacrificed for the sake of using a more convenient and resilient language.

But it turned out - as can be seen in analysis.ipynb - that the Rust shared objects are far less efficient than their C counterparts. Despite of using the C ABI, the ability of Rust code to be called from C without any overhead, and some performance optimization settings provided to the rustc compiler the Rust version does perform a lot worse.

In the end, Rust does not seem to be a proper replacement of C in realtime digital signal processing.

... but what about modern C++? In the next steps I will translate the stereo plugin from C and compare their performance.

Usage

First of all, you have to build both LADSPA plugins. For the C part run

cd c
make

and for the Rust part run

cd rust
cargo build --release

The --release argument is quite important since it triggers the optimization of the compiled code.

Afterwards, you can run the analysis by executing the Jupyter notebook (note that an R and not a Python kernel is used).

jupyter notebook analysis.ipynb

Resources

insights into LADSPA

Rust interface for LADSPA

Optimization of Rust code

Read audio files into R

ladspa-plugins-in-rust's People

Contributors

thegreatwhiteshark avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.