|
arduino-audio-tools
|
Classes | |
| struct | EchoState_ |
| Internal echo canceller state structure. More... | |
| struct | fft_state< Allocator > |
| FFT state management structure with custom allocator support. More... | |
| class | MDFEchoCancellation< Allocator > |
| Acoustic echo canceller using MDF algorithm. More... | |
Typedefs | |
| typedef struct EchoState_ | EchoState |
| using | FloatAllocator = typename std::allocator_traits< Allocator >::template rebind_alloc< float > |
Friends | |
| echo_word32_t | operator* (int32_t scalar, const echo_float_t &f) |
This is the acoustic echo canceller module.
| using FloatAllocator = typename std::allocator_traits<Allocator>::template rebind_alloc<float> |
Rebound allocator for float vectors
|
inlineconstexpr |
Construct FFT state with specified size and driver.
| size | FFT size (number of points) |
| drv | Pointer to FFT driver implementation |
| alloc | Allocator instance for memory management |
|
inline |
Initialize echo canceller with single channel (mono)
| filterLength | Length of echo cancellation filter in samples |
| fftDriver | FFT driver instance from AudioFFT |
| alloc | Allocator instance (optional) |
|
inline |
Initialize echo canceller with multiple channels
| filterLength | Length of echo cancellation filter in samples |
| nbMic | Number of microphone channels |
| nbSpeakers | Number of speaker channels |
| fftDriver | FFT driver instance from AudioFFT |
| alloc | Allocator instance (optional) |
|
inline |
Destructor
|
inline |
Perform echo cancellation
| rec | Recorded signal (with echo) |
| play | Playback signal (reference) |
| out | Output signal (echo removed) |
|
inline |
Process captured audio with buffered playback
| rec | Recorded signal |
| out | Output signal (echo removed) |
Control/query echo canceller parameters
| request | Request type (ECHO_GET_FRAME_SIZE, etc.) |
| ptr | Pointer to parameter value |
|
inline |
Perform forward FFT.
| Allocator | Custom allocator type (must match the one used in echo_fft_init) |
| table | Opaque pointer to FFT state |
| in | Input time-domain signal (size N) |
| out | Output frequency-domain signal in packed format (size N) Format: [DC, real1, imag1, real2, imag2, ..., Nyquist] |
Destroy FFT state and release resources.
| Allocator | Custom allocator type (must match the one used in echo_fft_init) |
| table | Opaque pointer to FFT state returned by echo_fft_init |
|
inline |
Initialize FFT state.
| Allocator | Custom allocator type for memory management |
| size | FFT size (number of points) |
| driver | Pointer to FFT driver implementing AudioFFTBase interface |
| alloc | Allocator instance for memory management |
|
inline |
Perform inverse FFT.
| Allocator | Custom allocator type (must match the one used in echo_fft_init) |
| table | Opaque pointer to FFT state |
| in | Input frequency-domain signal in packed format (size N) Format: [DC, real1, imag1, real2, imag2, ..., Nyquist] |
| out | Output time-domain signal (size N) |
Allocate memory for array of type T using custom allocator.
| T | Type of objects to allocate |
| count | Number of objects to allocate |
|
inlineprotected |
Core echo cancellation implementation.
Implements the complete MDF echo cancellation algorithm including:
| st | Echo state structure containing all internal state |
| in | Input signal from microphones (interleaved if multi-channel) |
| far_end | Reference signal from speakers (interleaved if multi-channel) |
| out | Output signal with echo removed (interleaved if multi-channel) |
Deallocate memory using custom allocator.
| T | Type of objects to deallocate |
| ptr | Pointer to memory to deallocate |
| count | Number of objects (currently unused but kept for API compatibility) |
|
inlineprotected |
Initialize multi-channel echo canceller state.
| frame_size | Number of samples per frame |
| filter_length | Total filter length in samples |
| nb_mic | Number of microphone channels |
| nb_speakers | Number of speaker channels |
Ensure echo canceller is initialized (lazy initialization)
|
inlineprotected |
Get filter length
|
inline |
Get impulse response
| response | Buffer to store impulse response (must be pre-allocated) |
Get impulse response size
Get number of microphone channels
Get sampling rate
Get number of speaker channels
Get underlying state (for advanced usage)
|
inlineprotected |
Adjust proportional adaptation weights.
| W | Filter weights in frequency domain |
| N | FFT size |
| M | Number of filter blocks |
| P | Number of channels |
| prop | Output proportional weights (normalized) |
|
inlineprotected |
Compute inner product of two vectors.
| x | First input vector |
| y | Second input vector |
| len | Length of vectors |
|
inline |
|
inline |
|
inline |
|
inline |
Buffer playback signal for later processing
| play | Playback signal to buffer |
|
inlineprotected |
Compute power spectrum from FFT output.
| X | FFT output in packed format |
| ps | Output power spectrum |
| N | FFT size |
|
inlineprotected |
Accumulate power spectrum from FFT output.
| X | FFT output in packed format |
| ps | Accumulated power spectrum (updated in place) |
| N | FFT size |
Reset echo canceller state
|
inline |
Set FFT driver (must be called before first use)
| fftDriver | Reference to FFT driver instance |
Set filter length (must be called before first use)
| len | Length of echo cancellation filter in samples |
Set number of microphone channels (must be called before first use)
| num | Number of microphone channels |
Set sampling rate
| rate | Sampling rate in Hz |
Set number of speaker channels (must be called before first use)
| num | Number of speaker channels |
|
inlineprotected |
Accumulate spectral multiplication across multiple frames.
| X | Input spectrum (M frames) |
| Y | Filter weights in frequency domain |
| acc | Output accumulated result |
| N | FFT size |
| M | Number of frames to accumulate |
Compute cosine function.
| x | Input angle in radians |
Compute exponential function.
| x | Input value |
|
inlineprotected |
|
inlineprotected |
Compute weighted spectral multiplication with conjugate.
| w | Weight array for each frequency bin |
| p | Global scaling factor |
| X | First input spectrum |
| Y | Second input spectrum (conjugated) |
| prod | Output product |
| N | FFT size |
| int adapted |
Allocator instance for memory management
| echo_word16_t beta0 |
| echo_word16_t beta_max |
| int C |
| int cancel_count |
| echo_word32_t Davg1 |
| echo_word32_t Davg2 |
| AudioFFTBase* driver |
Pointer to FFT driver implementation
| echo_float_t Dvar1 |
| echo_float_t Dvar2 |
| int16_t e |
| echo_word32_t* Eh |
|
protected |
Pointer to FFT driver instance
| void* fft_table |
Length of echo cancellation filter
| echo_word16_t* foreground |
| int frame_size |
Number of samples processed each time
Lazy initialization flag
| echo_word16_t* input |
| int K |
Number of input channels (microphones)
| echo_word16_t* last_y |
| echo_word16_t leak_estimate |
| int16_t m |
| int M |
| echo_word16_t * memD |
| echo_word16_t * memE |
| echo_word16_t* memX |
Number of microphone channels
Number of speaker channels
| echo_mem_t* notch_mem |
| echo_word16_t notch_radius |
| echo_float_t Pey |
| echo_word32_t* PHI |
| echo_int16_t* play_buf |
| int play_buf_pos |
| int play_buf_started |
| echo_word32_t* power |
| echo_float_t* power_1 |
| echo_word16_t preemph |
| echo_word16_t* prop |
| echo_float_t Pyy |
| echo_word32_t* Rf |
| echo_int32_t sampling_rate |
Number of output channels (loudspeakers)
| int saturated |
| int screwed_up |
| echo_word16_t spec_average |
Pointer to internal echo canceller state
| echo_word32_t sum_adapt |
| std::vector<float, FloatAllocator> temp_img |
Temporary buffer for imaginary components
| std::vector<float, FloatAllocator> temp_real |
Temporary buffer for real components
| echo_word16_t* window |
| int window_size |
| echo_word16_t* wtmp |
| echo_word32_t* Xf |
| echo_word32_t* Yf |
| echo_word32_t* Yh |
|
friend |