Deluge Firmware
1.4.0
Build date: 2026.11.30
Toggle main menu visibility
Loading...
Searching...
No Matches
echo_canceller.h
1
/*
2
* Copyright © 2026 Synthstrom Audible Limited
3
*
4
* This file is part of The Synthstrom Audible Deluge Firmware.
5
*
6
* The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the
7
* terms of the GNU General Public License as published by the Free Software Foundation,
8
* either version 3 of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
* See the GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License along with this program.
15
* If not, see <https://www.gnu.org/licenses/>.
16
*/
17
18
#pragma once
19
20
#include <array>
21
#include <cstdint>
22
30
namespace
deluge::dsp::mic_velocity
{
31
32
class
EchoCanceller
{
33
public
:
36
static
constexpr
int32_t
kTaps
= 64;
37
static
constexpr
int32_t kDelay = 4;
38
39
void
reset();
40
43
float
process
(
float
mic,
float
sent,
bool
adapt);
44
46
[[nodiscard]]
float
weightEnergy
()
const
;
47
48
private
:
49
static
constexpr
int32_t kHistory =
kTaps
+ kDelay;
50
// Sent samples, twice over so the newest kHistory are always contiguous for the filter
51
std::array<float, kHistory * 2> sent_{};
52
int32_t pos_ = 0;
53
std::array<float, kTaps> weights_{};
54
float
power_ = 0;
// Sum of the squares of the sent samples under the filter
55
int32_t sinceRecompute_ = 0;
56
};
57
58
}
// namespace deluge::dsp::mic_velocity
deluge::dsp::mic_velocity::EchoCanceller
Definition
echo_canceller.h:32
deluge::dsp::mic_velocity::EchoCanceller::kTaps
static constexpr int32_t kTaps
Definition
echo_canceller.h:36
deluge::dsp::mic_velocity::EchoCanceller::weightEnergy
float weightEnergy() const
How much the filter has learnt: the sum of its squared weights (0 when reset).
Definition
echo_canceller.cpp:42
deluge::dsp::mic_velocity::EchoCanceller::process
float process(float mic, float sent, bool adapt)
Definition
echo_canceller.cpp:50
deluge::dsp::mic_velocity
Definition
delay_finder.cpp:21