Deluge Firmware 1.4.0
Build date: 2026.11.30
Loading...
Searching...
No Matches
deluge::dsp::mic_velocity Namespace Reference

Classes

struct  Biquad
 A second-order section, direct form II transposed. More...
class  Calibration
class  Decimator
class  DelayFinder
class  EchoCanceller
struct  GridPoint
struct  Thump
 A thump: where it rose out of the noise, and how loud it got in the 4 ms after. More...
class  ThumpDetector
struct  VelocityCurve
 How tap strength maps onto velocity (the settings). More...

Typedefs

using Frame = uint32_t
 Input frames (at 44.1 kHz) on the mic reader's clock.

Enumerations

enum class  TapCheck : uint8_t { OK , SOFT_UNEVEN , HARD_UNEVEN , TOO_CLOSE }
 Checking a calibration point's taps (two soft, two hard). More...

Functions

uint8_t velocityFor (Calibration const &calibration, VelocityCurve const &curve, int32_t x, int32_t y, float levelDb)
 The velocity (1-127) a thump of levelDb plays at on pad (x, y).
TapCheck checkPoint (std::array< float, 2 > const &softDb, std::array< float, 2 > const &hardDb, float *softOut, float *hardOut)
 Checks a point's taps and, if they're fine, gives its soft and hard levels (each the mean of its two, in dB).

Variables

constexpr int32_t kInputRate = 44100
constexpr int32_t kDecimation = 8
constexpr float kRate = static_cast<float>(kInputRate) / kDecimation
 5512.5 Hz
constexpr int32_t kNumCalibrationPoints = 5
 The pads calibrated, in the order they're tapped.
constexpr std::array< GridPoint, kNumCalibrationPoints > kCalibrationPoints {{{7, 4}, {0, 7}, {15, 7}, {0, 0}, {15, 0}}}
constexpr float kMaxTapSpreadDb = 6.f
 Two taps of the same strength have to come within this of each other, and hard has to beat soft by this.
constexpr float kMinRangeDb = 6.f

Detailed Description

Finds how long the speakers take to reach the internal mic, for mic velocity's speaker calibration.

While the Deluge plays a burst of noise (or anything else) through its outputs, this correlates what was sent with what the mic heard at every delay up to 64 ms (enough for monitors a few metres off, plus their own processing). Both are first-differenced first, so strong, slowly changing low frequencies don't smear the peak. The delay is the one that stands out. Run only while calibrating, so it can afford to correlate every lag on every sample.

Takes the internal speaker's sound back out of the internal mic, for mic velocity.

Measured on a Deluge (2026-11): the speaker reaches the mic 2.5 ms after the codec is given it, and above ~250 Hz what the mic hears of it is close to linear in what was sent (coherence 0.84-0.94). An NLMS filter on the decimated (5.5 kHz) signals learns that path and subtracts its estimate, which took 6-8 dB of a loud song out of the band thumps are measured in. It mustn't learn while a pad is thumping (the thump isn't in what was sent, so it would learn to cancel noise), so the caller freezes it around presses.

Finds the thump a pad makes in the internal mic, for mic velocity.

Measured on a Deluge (2026-11): a tap's thump is mostly 60-400 Hz, and the internal speaker hardly reaches the mic below ~250 Hz. So the mic is decimated to 5.5 kHz, band-limited to 60-300 Hz, and the thump's level is its peak from when it rises out of the noise until 4 ms later (which tracks the whole thump's peak with r 0.99). Soft, normal and hard taps came out 9-14 dB apart, each within about 2 dB.

From a thump's level to a velocity, for mic velocity.

Measured on a Deluge (2026-11), how loud a tap is in the mic depends a lot on the pad: soft taps on the bottom corners came out over 20 dB quieter than on the centre, hard taps only ~9 dB. So calibration takes the softest and hardest a player taps at five pads (the centre and the corners), and any pad's soft and hard levels are interpolated from those. A thump's level then maps to where it falls between its pad's soft and hard, through a curve, onto the velocity range.

Enumeration Type Documentation

◆ TapCheck

enum class deluge::dsp::mic_velocity::TapCheck : uint8_t
strong

Checking a calibration point's taps (two soft, two hard).

Enumerator
SOFT_UNEVEN 

The two soft taps are too far apart: tap soft again.

HARD_UNEVEN 

The two hard taps are too far apart: tap hard again.

TOO_CLOSE 

Soft and hard came out too alike: the whole point again.