libsonare turns audio into data and data back into audio. Load a song and get its BPM, key, chords, and structure; master and mix it to broadcast loudness; turn MIDI into sound with built-in instruments; or build a whole DAW on top — the same engine in C++, Python, Node.js, and the browser. The C++ core has zero runtime dependencies; the Python package depends on NumPy, and there is no GPL/AGPL code and no model weights.
📖 Documentation · 🎧 Browser-local demos · Getting started
sonare studio is a browser-based DAW whose audio runs on the libsonare WASM engine: multi-track playback, instruments, mixer, mastering, and audio export, all client-side. Its music theory and composition features come from @libraz/libcantus, and score rendering from a separate library. It is a hosted live demo that exercises the engine end to end, not a production product (source not public).
- Analysis — BPM, key, chords, beats, sections, pitch, loudness (EBU R128), and room acoustics; defaults match librosa where they overlap, and CI checks them against librosa reference values. Analysis
- Stems and transcription — split a mix into stems with
decomposeStems, and transcribe audio to MIDI withtranscribe. Source separation · CLItranscribe - Mastering — 92 named DSP processors (EQ, dynamics, multiband, stereo, saturation, repair, maximizer, reference matching), or 73 with
BUILD_FX=OFF, plus five restoration presets (vinyl, tape hiss, field recording, voice memo, shellac 78). Mastering processors · Mastering assistant - Mixing and routing — channel strips, buses, sends, bus-to-bus routing, track- or bus-keyed sidechains, scene presets, and an optional assistant that suggests a mixer scene. Mixing · Realtime engine · Mixing assistant
- Editing and creative FX — time stretch, pitch shift, pitch correction, voice change, reverbs, modulation, delay, and amp sim. Editing DSP · Spectral editing
- Note editing and takes — edit notes of monophonic and polyphonic takes, align a take to a reference (
alignTakeToReference), and tune it to a MIDI melody (tune-to-midi). MIDI editing · Takes - Room acoustics — synthesize, estimate, and morph room impulse responses. Acoustic analysis
- Built-in instruments — a NativeSynth with 17 synthesis engines and a GM/GS fallback covering all 128 programs, so MIDI never renders silent. The acoustic piano is calibrated; the other physical-model voices are still being tuned and will change in 1.8.x patch releases. NativeSynth · Physical models
- GS and SoundFont — GS SysEx reception, two realisations of the GS insertion effects (modern and classic), and a GS-compatible 16-part SF2 player for host-supplied SoundFonts. The
effects.gsEfxinsert applies either realisation to audio tracks and buses. GM/GS · SoundFont player - Headless DAW runtime — projects with audio and MIDI tracks, takes, warp, MIDI 1.0/2.0 sequencing, SMF I/O, and offline bounce. Project editing
- Realtime engine — allocation-free playback, streaming, live MIDI 1.0/2.0 input, lock-free automation, and recording, in the browser through an AudioWorklet too. Realtime engine · MIDI input
- Playback renderer — channel conversion, loudness matching, bass management, and HRTF binaural rendering for headphones and speakers. Playback
- C++ package — the C++ library installs as a CMake package (
find_package(sonare)). C++ API
npm install @libraz/libsonare # JavaScript / TypeScript (WASM, takes Float32Array)
pip install libsonare # Python (WAV/MP3; other formats need an FFmpeg build)@libraz/libsonare-native is not published to npm; clone this repository and use it as a local dependency. See Installation for formats, FFmpeg, and the runtime choice.
import { Audio, init } from '@libraz/libsonare';
await init();
const bytes = new Uint8Array(await file.arrayBuffer());
const audio = await Audio.fromMemoryWithBrowserFallback(bytes);
const result = audio.analyze(); // BPM, key, chords, sections, ...
console.log(result.key.name);→ JavaScript API · Browser / WASM
import libsonare
audio = libsonare.Audio.from_file("song.mp3")
print(f"BPM: {audio.detect_bpm()}, Key: {audio.detect_key()}")
result = audio.mastering(target_lufs=-14.0, ceiling_db=-1.0)
print(f"{result.input_lufs:.1f} LUFS → {result.output_lufs:.1f} LUFS")The sonare command-line tool ships with the Python package; the native CLI is sonare-cli. → Python API · CLI
find_package(sonare REQUIRED)
target_link_libraries(app PRIVATE sonare::sonare)#include "sonare.h"
auto audio = sonare::Audio::from_file("music.mp3");
auto result = sonare::MusicAnalyzer(audio).analyze();
std::cout << "BPM: " << result.bpm
<< ", Key: " << result.key.to_string() << std::endl;→ C++ API
make build && make test # native
make wasm # WebAssembly
make release # optimized native buildBuild options (BUILD_MASTERING, BUILD_MIXING, BUILD_MIXING_ASSISTANT, FFmpeg) are covered in Architecture.
Full docs and browser-local demos live at libsonare.libraz.net.
- Learn — Introduction · Getting started · Installation · Examples
- API by runtime — Browser / WASM · JavaScript · Python · Node.js native · C++ · CLI
- Details — Architecture · librosa compatibility · Benchmarks · Glossary
Every runtime calls the same C++17 DSP core, but each API surface is hand-written and not identical; see Binding parity and the generated runtime capability matrix.
libsonare is the headless engine, not an application. It does not include a UI or DAW workflow, VST/CLAP plugin hosting, a cross-platform real-time I/O abstraction, bundled sample data, or deep-learning models. Windows is not supported; use Linux, macOS, WebAssembly, or WSL2. Note-level composition belongs to the separate @libraz/libcantus. See Architecture for the rationale.