muslib
Rust library for music synthesis and processing, inspired by Essentia, with Python bindings and a command line tool.
- HPCP (harmonic pitch class profile) and Chromagram (HPCP over time)
- FFT and IFFT
- mixer: load audio files as mono tracks, write 16-bit WAV
- convert: resampling and peak normalization
- encode: Ogg Opus in pure Rust
- synth: simple waveforms
Installation
$ cargo add muslib # Rust crate
$ pip install muslib # Python package
$ cargo install muslib --features cli # command line tool
Pre-built binaries are on the releases page.
Usage
Load, resample, normalize and encode:
use muslib::convert::{normalize_peak, resample};
use muslib::encode::OggOpusWriter;
use muslib::mixer::Loader;
let loaded = Loader::<f32>::new().files(["a.wav", "b.wav"]).load()?;
let mut data = resample(loaded.data(), loaded.sample_rate(), 48000)?;
normalize_peak(&mut data, -1.0)?;
OggOpusWriter::new().file("voice.ogg").bitrate(48000).write(&data)?;
# Ok::<(), muslib::MuslibError>(())
The same from the command line:
$ muslib convert --rate 48000 --normalize -1 --bitrate 48000 --output voice.ogg a.wav b.wav
Notes:
- Loading reads WAV, FLAC, Ogg Vorbis and Matroska/WebM, and averages channels
into mono unless
.channel(index)picks one. Concatenated files must share a sample rate. - Opus input must be 8, 12, 16, 24 or 48 kHz, at 6–512 kbit/s (64 by default).
- Errors are
muslib::MuslibErrorin Rust andmuslib.MuslibError(aValueError) in Python; file errors include the path.
See the API docs for all parameters and
input requirements, and the examples directory for Rust and Python examples,
including comparisons with Essentia.
Development
Requires Rust 1.87 or newer; Python wheels target Python 3.11 and newer.
$ cargo build --release --features cli
$ cargo test --all-features
$ cargo clippy --all-targets -- -D warnings
$ cargo fmt --check
$ cargo bench --bench core # Criterion, reports in target/criterion/
$ maturin build # Python wheel
Comparisons against live Essentia are opt-in:
python3.12 -m venv .venv-essentia
.venv-essentia/bin/python -m pip install essentia==2.1b6.dev1389
ESSENTIA_PYTHON="$PWD/.venv-essentia/bin/python" \
cargo test --features essentia-oracle --test essentia_oracle
The GitLab pipeline runs these checks, builds wheels for release tags, and publishes them manually.
Alternatives
License
AGPL-3.0-or-later, in the same spirit as Essentia. Copyright (C) 2023 wykwit.
Metadata
Release files for muslib 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| muslib-0.2.0.tar.gz | 163.8 kB | Without provenance | Details for muslib-0.2.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| muslib-0.2.0-cp311-abi3-musllinux_1_2_x86_64.whl | CPython 3.11 | abi3 | Linux musl 1.2+ x86-64 | Details for muslib-0.2.0-cp311-abi3-musllinux_1_2_x86_64.whl |
| muslib-0.2.0-cp311-abi3-musllinux_1_2_aarch64.whl | CPython 3.11 | abi3 | Linux musl 1.2+ ARM64 | Details for muslib-0.2.0-cp311-abi3-musllinux_1_2_aarch64.whl |
| muslib-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ x86-64 | Details for muslib-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| muslib-0.2.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ ARM64 | Details for muslib-0.2.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
Total release size: 3.1 MB
Release files / muslib-0.2.0.tar.gz
| Download URL | muslib-0.2.0.tar.gz |
|---|---|
| Size | 163.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc41d7982bbd1dd55db83ba1732f179118cc19475267040bf1018b668209c457
|
|
BLAKE2b-256 checksum How to use checksums |
a7254c389f28671440f72f99a9ac71cb65962690c0c37a7ff18bfec1cb85998d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / muslib-0.2.0-cp311-abi3-musllinux_1_2_x86_64.whl
| Download URL | muslib-0.2.0-cp311-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 748.6 kB |
| Tags | CPython 3.11 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
722ced5e911b37d7720884268c492995fa78b5791f43dad5a33b73c0558e3b74
|
|
BLAKE2b-256 checksum How to use checksums |
3bde182dd7f620a1313e6a4ddd0d81322e28b6efbea103e6d01b3eaba5d04d2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / muslib-0.2.0-cp311-abi3-musllinux_1_2_aarch64.whl
| Download URL | muslib-0.2.0-cp311-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 724.4 kB |
| Tags | CPython 3.11 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
3baaa92d2bc19e01d84188733147585855e87fe05dc4b8c89dac8032c5749c8a
|
|
BLAKE2b-256 checksum How to use checksums |
c60197861c537099006e8052456200782d1a58e9fdfeb32bbabddf287048c928
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / muslib-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | muslib-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 750.0 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
33b9ab4736e18d4878ff34ed8895d1d1284c13b76a892be923d7adc9dd94b982
|
|
BLAKE2b-256 checksum How to use checksums |
bdc31b1918b0e7d00eeca335ceeaed27697140de8c643f355224a9038be294a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / muslib-0.2.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | muslib-0.2.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 725.6 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
2467b08831961cd233bea3dc575b838fe8adb15e505b2c250bd1d23253895dfb
|
|
BLAKE2b-256 checksum How to use checksums |
69fa5fe595ccc999a553f59898de7ab9bd155483bb780942c0c0d27dc960f772
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Security for muslib 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.