audio_processor_analysis/
lib.rs

1// Augmented Audio: Audio libraries and applications
2// Copyright (c) 2022 Pedro Tacla Yamada
3//
4// The MIT License (MIT)
5//
6// Permission is hereby granted, free of charge, to any person obtaining a copy
7// of this software and associated documentation files (the "Software"), to deal
8// in the Software without restriction, including without limitation the rights
9// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10// copies of the Software, and to permit persons to whom the Software is
11// furnished to do so, subject to the following conditions:
12//
13// The above copyright notice and this permission notice shall be included in
14// all copies or substantial portions of the Software.
15//
16// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22// THE SOFTWARE.
23
24//! Provides implementations of some audio analysis processors.
25//!
26//! * **Peak detector** - [`peak_detector`]
27//! * **FFT (Windowed/Overlapped)** - [`fft_processor`]
28//! * **Transient detection** (not real-time) - [`transient_detection::stft`]
29//! * **Window functions** - [`window_functions`]
30//!
31//! ## RMS
32//! Real-time safe, per-sample (ticked by UI thread) RMS calculation.
33//!
34//! ## Peak detector
35//! Peak detector with adjustable attack/release times.
36//!
37//! ## FFT
38//! `rustfft` audio-processor, forwards or backwards, real-time safe, FFT.
39//!
40//! Applies a Hann window by default. Several window functions are exported by [`window_functions`].
41//!
42//! ![](https://raw.githubusercontent.com/yamadapc/augmented-audio/master/crates/augmented/audio/audio-processor-analysis/src/window_functions/windows--HannWindow.png)
43//!
44//! Then performs FFT with N bins.
45//!
46//! ![](https://raw.githubusercontent.com/yamadapc/augmented-audio/master/crates/augmented/audio/audio-processor-analysis/src/fft_processor.png--FFT_sine_440Hz.png)
47//!
48//! Overlap is configurable
49//!
50//! ![](https://raw.githubusercontent.com/yamadapc/augmented-audio/master/crates/augmented/audio/audio-processor-analysis/screen.png)
51//!
52//! ## Envelope follower
53//!
54//! Envelope follower implementation with adjustable attack/release times.
55//!
56//! ![](https://raw.githubusercontent.com/yamadapc/augmented-audio/master/crates/augmented/audio/audio-processor-analysis/audio-envelope.png)
57//!
58//! ## Transient detection
59//!
60//! Implements "[A Transient Detection Algorithm for Audio Using Iterative Analysis of STFT.](https://www.researchgate.net/profile/Balaji-Thoshkahna/publication/220723752_A_Transient_Detection_Algorithm_for_Audio_Using_Iterative_Analysis_of_STFT/links/0deec52e6331412aed000000/A-Transient-Detection-Algorithm-for-Audio-Using-Iterative-Analysis-of-STFT.pdf)".
61//!
62//! Does polyphonic transient detection, able to output signal or markers
63//!
64//! ![](https://raw.githubusercontent.com/yamadapc/augmented-audio/master/crates/augmented/audio/audio-processor-analysis/src/transient_detection/stft.png)
65//!
66//! ## Window functions
67//! Several window functions are implemented and configurable.
68
69#[warn(missing_docs)]
70pub mod envelope_follower_processor;
71
72pub mod fft_processor;
73
74/// Peak detector implementation
75pub mod peak_detector;
76
77/// RMS implementation suitable for GUI reacting to magnitude of the signal. Accumulates values on
78/// a circular buffer, the consumer calculates the RMS value based on it.
79pub mod running_rms_processor;
80
81/// Polyphonic transient detection implementation
82pub mod transient_detection;
83
84/// Many window functions
85pub mod window_functions;