audiofp 0.3.0

Audio fingerprinting SDK: Wang, Panako, Haitsma–Kalker, neural (ONNX), watermark, streaming.
Documentation
[package]
name         = "audiofp"
version      = "0.3.0"
edition      = "2024"
rust-version = "1.85.0"
license      = "MIT"
description  = "Audio fingerprinting SDK: Wang, Panako, Haitsma–Kalker, neural (ONNX), watermark, streaming."
repository   = "https://github.com/themankindproject/audiofp"
authors      = ["bravo1goingdark <kumarashutosh34169@gmail.com>"]
keywords     = ["audio", "fingerprint", "dsp", "shazam", "panako"]
categories   = ["multimedia::audio", "algorithms", "no-std"]
readme       = "README.md"

[features]
default = ["std"]

# Pulls symphonia file decoding helpers (and, in a later phase, cpal mic
# capture). Without it the crate compiles `no_std + alloc` — DSP and
# classical fingerprinters only.
std = ["dep:symphonia"]

# ONNX-based neural fingerprinter. The user supplies an ONNX model whose
# input is a `[1, n_mels, n_frames]` log-mel spectrogram and whose first
# output is a `[1, embedding_dim]` (or `[1, 1, embedding_dim]`) embedding.
# Requires std (we read the model file and feed PCM at runtime).
neural = ["std", "dep:tract-onnx"]

# AudioSeal-compatible watermark detector. Requires std.
watermark = ["std", "dep:tract-onnx"]

# Install mimalloc as the process-wide #[global_allocator]. Requires std.
# Off by default because libraries should not pick the allocator on behalf of
# downstream binaries; flip this into `default` if you want it always-on.
mimalloc = ["std", "dep:mimalloc"]

[dependencies]
thiserror   = { version = "2.0.18", default-features = false }
mimalloc    = { version = "0.1.50", default-features = false, optional = true }
libm        = "0.2.16"
num-traits  = { version = "0.2.19", default-features = false, features = ["libm"] }
num-complex = { version = "0.4.6", default-features = false, features = ["libm"] }
realfft     = { version = "3.5.0", default-features = false }
bytemuck    = { version = "1.25.0", features = ["derive"] }
symphonia   = { version = "0.5.5", default-features = false, features = ["mp3", "aac", "flac", "ogg", "vorbis", "wav", "isomp4", "pcm"], optional = true }
tract-onnx  = { version = "0.22.1", optional = true }

[dev-dependencies]
approx    = "0.5.1"
hound     = "3.5.1"
criterion = { version = "0.5", default-features = false, features = ["plotters", "cargo_bench_support"] }
proptest  = { version = "1.5", default-features = false, features = ["std"] }

[[bench]]
name    = "extract"
harness = false

[[bench]]
name              = "neural_frontend"
harness           = false
required-features = ["neural"]

[[bench]]
name    = "streaming"
harness = false

[lib]
name = "audiofp"
path = "src/lib.rs"

# Examples that use the symphonia-backed `audiofp::io` decoder require the
# `std` feature. Cargo silently skips them when their required features
# aren't enabled, so `cargo clippy --no-default-features --all-targets`
# stays clean.
[[example]]
name = "enroll_file"
required-features = ["std"]

[[example]]
name = "match_two_files"
required-features = ["std"]

[[example]]
name = "compare_algorithms"
required-features = ["std"]

[[example]]
name = "hash_matcher"
required-features = ["std"]