[package]
name         = "audiofp"
version      = "0.3.7"
edition      = "2024"
rust-version = "1.93.0"
license      = "MIT"
description  = "Pure-Rust audio fingerprinting and identification: Wang, Panako, Haitsma–Kalker, ONNX neural embedder, AudioSeal watermark, and streaming variants. no_std + alloc capable, bytemuck-friendly hash types."
repository   = "https://github.com/themankindproject/audiofp"
authors      = ["bravo1goingdark <kumarashutosh34169@gmail.com>"]
keywords     = ["audio", "fingerprint", "no-std", "shazam", "acoustid"]
categories   = ["multimedia::audio", "algorithms"]
readme       = "README.md"
exclude      = [
    # Personal prep / scratch files — useful in the repo, not on crates.io.
    "prep.md",
    "dsp.md",
    ".github/",
    ".agents/",
]

[features]
default = ["std"]

# Pulls symphonia file decoding helpers (and, in a later phase, cpal mic
# capture). Without it the crate is `no_std + alloc` in API shape for DSP
# and classical fingerprinters, but the current FFT dependency chain keeps
# the no_std path host-only today.
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"]

# Multi-threaded batch fingerprinting via rayon. Requires std.
rayon = ["std", "dep:rayon"]

# 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 }
num-complex = { version = "0.4.6", default-features = false }
realfft     = { version = "3.5.0", default-features = false }
bytemuck    = { version = "1.25.0", features = ["derive"] }
symphonia   = { version = "0.6", default-features = false, features = ["mp3", "aac", "flac", "ogg", "vorbis", "wav", "isomp4", "pcm"], optional = true }
rayon       = { version = "1.10", optional = true }
tract-onnx  = { version = "0.23", default-features = false, optional = true }

[dev-dependencies]
approx    = "0.5.1"
hound     = "3.5.1"
criterion = { version = "0.5", default-features = false, features = ["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 = "stream_buffer"

[profile.release]
lto           = "fat"
codegen-units = 1
strip         = "symbols"

[profile.bench]
lto           = "fat"
codegen-units = 1

[workspace]
members = ["fuzz"]
