Fast audio analysis library — librosa-like API, tens of times faster (C++ with Python bindings)
Project description
libsonare
Fast audio analysis library for Python -- librosa-like API, tens of times faster.
Built on a C++ core with zero Python dependencies.
Installation
pip install libsonare
Supported platforms: Linux (x86_64, aarch64), macOS (Apple Silicon).
Quick Start
import libsonare
# From raw samples
bpm = libsonare.detect_bpm(samples, sample_rate=22050)
key = libsonare.detect_key(samples, sample_rate=22050)
print(f"{key.root.name} {key.mode.name}") # e.g. "C MAJOR"
# Full analysis
result = libsonare.analyze(samples, sample_rate=22050)
print(f"BPM: {result.bpm}, Key: {result.key}")
# Audio class (load files directly)
audio = libsonare.Audio.from_file("song.mp3")
print(f"BPM: {audio.detect_bpm()}")
print(f"Key: {audio.detect_key()}")
print(f"Mel: {audio.mel_spectrogram().n_mels}x{audio.mel_spectrogram().n_frames}")
CLI
sonare analyze song.mp3
# > Estimated BPM : 161.00 BPM (conf 75.0%)
# > Estimated Key : C major (conf 100.0%)
sonare bpm song.mp3 --json # {"bpm": 161.0}
sonare key song.mp3 # Key: C major (confidence: 100.0%)
sonare spectral song.mp3 # Spectral features table
sonare pitch song.mp3 # Pitch tracking (pYIN)
sonare mel song.mp3 # Mel spectrogram shape
sonare chroma song.mp3 # Chromagram with visualization
Features
- Detection: BPM, key, beats, onsets
- Analysis: Full music analysis (BPM + key + time signature + beats)
- Effects: HPSS, pitch shift, time stretch, normalize, trim
- Features: STFT, mel spectrogram, MFCC, chroma, spectral features, pitch tracking (YIN/pYIN)
- Conversions: Hz/mel/MIDI/note, frames/time
- I/O: Load WAV/MP3 files, resample
librosa Compatibility
Default parameters match librosa:
- Sample rate: 22050 Hz
- n_fft: 2048
- hop_length: 512
- n_mels: 128
Also available
npm install @libraz/libsonare # JavaScript/TypeScript (WASM)
License
Apache-2.0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file libsonare-1.0.2-py3-none-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: libsonare-1.0.2-py3-none-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 482.7 kB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a4163c2741e6dea20f6b003866e523b9f2cc993d731d68fd5f95261da47d1c2
|
|
| MD5 |
af13460735b950ad395b61ac45151e44
|
|
| BLAKE2b-256 |
7dbbad419fef7d98852a61b0101382acef0aabdf6aa3bdd0d9c415f5ff29892d
|
Provenance
The following attestation bundles were made for libsonare-1.0.2-py3-none-manylinux_2_17_x86_64.whl:
Publisher:
publish.yml on libraz/libsonare
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libsonare-1.0.2-py3-none-manylinux_2_17_x86_64.whl -
Subject digest:
1a4163c2741e6dea20f6b003866e523b9f2cc993d731d68fd5f95261da47d1c2 - Sigstore transparency entry: 1186481931
- Sigstore integration time:
-
Permalink:
libraz/libsonare@cd4b5cddec62875a7d9dc48808d4e28519ac6ec9 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/libraz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cd4b5cddec62875a7d9dc48808d4e28519ac6ec9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file libsonare-1.0.2-py3-none-manylinux_2_17_aarch64.whl.
File metadata
- Download URL: libsonare-1.0.2-py3-none-manylinux_2_17_aarch64.whl
- Upload date:
- Size: 444.2 kB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1adcf72cca74e18efb1054b48aed543f41a3982d75b68dc8910f770e92601b8
|
|
| MD5 |
306c23a029c10e5764b95dfcae95a36e
|
|
| BLAKE2b-256 |
03ca941775173aa4709c23acd790777fb9a58ae72ec95e1426eda65160831361
|
Provenance
The following attestation bundles were made for libsonare-1.0.2-py3-none-manylinux_2_17_aarch64.whl:
Publisher:
publish.yml on libraz/libsonare
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libsonare-1.0.2-py3-none-manylinux_2_17_aarch64.whl -
Subject digest:
f1adcf72cca74e18efb1054b48aed543f41a3982d75b68dc8910f770e92601b8 - Sigstore transparency entry: 1186481926
- Sigstore integration time:
-
Permalink:
libraz/libsonare@cd4b5cddec62875a7d9dc48808d4e28519ac6ec9 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/libraz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cd4b5cddec62875a7d9dc48808d4e28519ac6ec9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file libsonare-1.0.2-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: libsonare-1.0.2-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 367.5 kB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b74bae93b0616115cd110adfda5a3cb214ae47deb3eaf9797a635519cd34463
|
|
| MD5 |
0874faeee4badc795ebbf0abf6438d19
|
|
| BLAKE2b-256 |
67c5ec4ac0f3a5ca9b08201ab5f8432c84ca4e4f63d012b9524add3bafe5a590
|
Provenance
The following attestation bundles were made for libsonare-1.0.2-py3-none-macosx_11_0_arm64.whl:
Publisher:
publish.yml on libraz/libsonare
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libsonare-1.0.2-py3-none-macosx_11_0_arm64.whl -
Subject digest:
0b74bae93b0616115cd110adfda5a3cb214ae47deb3eaf9797a635519cd34463 - Sigstore transparency entry: 1186481933
- Sigstore integration time:
-
Permalink:
libraz/libsonare@cd4b5cddec62875a7d9dc48808d4e28519ac6ec9 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/libraz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cd4b5cddec62875a7d9dc48808d4e28519ac6ec9 -
Trigger Event:
push
-
Statement type: