Skip to main content

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::MuslibError in Rust and muslib.MuslibError (a ValueError) 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.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for muslib 0.2.2
File Size Uploaded Provenance Actions
muslib-0.2.2.tar.gz 165.2 kB With provenance Details for muslib-0.2.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for muslib 0.2.2
File Actions
muslib-0.2.2-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details for muslib-0.2.2-cp311-abi3-musllinux_1_2_x86_64.whl
muslib-0.2.2-cp311-abi3-musllinux_1_2_aarch64.whl CPython 3.11 abi3 Linux musl 1.2+ ARM64 Details for muslib-0.2.2-cp311-abi3-musllinux_1_2_aarch64.whl
muslib-0.2.2-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.2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
muslib-0.2.2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for muslib-0.2.2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Total release size: 3.2 MB

Release files / muslib-0.2.2.tar.gz

Download URL muslib-0.2.2.tar.gz
Size 165.2 kB
Tags Source
SHA-256 checksum
How to use checksums
610adecccf799d4fb41b4d4ca5385f3251189e0197e3fa46efc8d552f41ed8c1
BLAKE2b-256 checksum
How to use checksums
861dad2a1317192a025f8a1b5b050f81edc0ee2073d55927d23815490e5b23e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.17

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitLab CI/CD, verified by PyPI on Oct 25, 2026.

Transparency log

Release files / muslib-0.2.2-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL muslib-0.2.2-cp311-abi3-musllinux_1_2_x86_64.whl
Size 760.1 kB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
b5271105fa84790bec6d77874b7d45debfaafc3374ed0deffcbfc8849fadced5
BLAKE2b-256 checksum
How to use checksums
d67e520b65d9b0ce3228e79d6b2751d4c9fdae0da0e7c046c66ecd8299f4e7f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.17

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitLab CI/CD, verified by PyPI on Oct 25, 2026.

Transparency log

Release files / muslib-0.2.2-cp311-abi3-musllinux_1_2_aarch64.whl

Download URL muslib-0.2.2-cp311-abi3-musllinux_1_2_aarch64.whl
Size 735.6 kB
Tags CPython 3.11 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
855d1c04f0d2484f38c65539d566c0a6ba981c50b2ff686df86f5aad2409c4c3
BLAKE2b-256 checksum
How to use checksums
47d3a108905ad363112d85aea3616b9415a025baca20129470dc4d27d78cca10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.17

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitLab CI/CD, verified by PyPI on Oct 25, 2026.

Transparency log

Release files / muslib-0.2.2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL muslib-0.2.2-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 760.9 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
1a700abe88a3629c3a09297906b381b02bdd99367190d04f38886315361da9d2
BLAKE2b-256 checksum
How to use checksums
7f86eb7c80e90f8a9b5ff1f0dbb24fc902377dcfa17b07fa7ece5f6c4f6dce75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.17

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitLab CI/CD, verified by PyPI on Oct 25, 2026.

Transparency log

Release files / muslib-0.2.2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL muslib-0.2.2-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 736.6 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
922426b68bfeea396142ebc1670ab8d85bd96d579ca021da966c7a93a6f012cd
BLAKE2b-256 checksum
How to use checksums
b9f196552423f0399203c1b124af3536c723928eecd06749995e190e6c39e465
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.17

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitLab CI/CD, verified by PyPI on Oct 25, 2026.

Transparency log

Security for muslib 0.2.2

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.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for muslib-0.2.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitLab CI/CD, verified by PyPI on Oct 25, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page