Skip to main content

math_audio_dsp/
lib.rs

1//! DSP utilities for audio signal processing
2//!
3//! This crate provides:
4//! - **Signal generation**: Test signals (tones, sweeps, noise)
5//! - **Signal analysis**: FFT-based frequency analysis, microphone compensation
6//! - **Acoustic metrics**: RT60, clarity (C50/C80), THD, spectrogram
7//!
8//! # Example
9//!
10//! ```rust
11//! use math_audio_dsp::{signals, analysis};
12//!
13//! // Generate a 1 kHz tone
14//! let signal = signals::gen_tone(1000.0, 0.5, 48000, 1.0);
15//!
16//! // Analyze a WAV file
17//! let config = analysis::WavAnalysisConfig::default();
18//! // let result = analysis::analyze_wav_buffer(&signal, 48000, &config);
19//! ```
20
21pub mod analysis;
22pub mod audio_features;
23pub mod ebur128;
24pub mod esprit;
25pub mod fast_math;
26pub mod fdn;
27pub mod instantaneous_frequency;
28pub mod replaygain;
29pub mod rtpghi;
30pub mod signals;
31pub mod simd;
32pub mod stft;
33pub mod tonal_transient;
34pub mod waveform;
35
36// DSP building blocks (moved from sotf-host)
37pub mod adaa;
38pub mod auto_makeup;
39pub mod channel_linking;
40pub mod dc_blocker;
41pub mod delta_monitor;
42pub mod detector;
43pub mod dynamics_core;
44pub mod envelope;
45pub mod envelope_follower;
46pub mod lookahead;
47pub mod smoothing;
48pub mod true_peak;
49
50// Re-export commonly used types
51pub use analysis::{
52    AnalysisResult, CrossCorrelationEnvelopeResult, MicrophoneCompensation, WavAnalysisConfig,
53    WavAnalysisOutput, WindowedFrequencyResponse, analyze_recording, analyze_wav_buffer,
54    analyze_wav_file, compute_average_response, compute_clarity_broadband,
55    compute_clarity_spectrum, compute_group_delay, compute_impulse_response_from_fr,
56    compute_rt60_broadband, compute_rt60_spectrum, compute_spectrogram, compute_windowed_fr,
57    cross_correlate_envelope, find_db_point, read_analysis_csv, smooth_response_f32,
58    smooth_response_f64, write_analysis_csv, write_wav_analysis_csv,
59};
60
61pub use signals::{
62    add_silence_padding, apply_fade_in, apply_fade_out, clip, frames_for, gen_allpass_probe,
63    gen_log_sweep, gen_m_noise, gen_narrowband_probe, gen_pink_noise, gen_tone, gen_two_tone,
64    gen_white_noise, interleave_per_channel, mono_to_stereo, prepare_signal_for_playback,
65    prepare_signal_for_playback_channels, replicate_mono,
66};
67
68pub use replaygain::{ReplayGainAnalyzer, ReplayGainInfo, ReplayGainTrackData, compute_album_gain};
69pub use waveform::{WAVEFORM_SAMPLES, compute_waveform};