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

Namespaces

namespace  input

Classes

class  Calibration
class  Decimator
class  DelayFinder
class  EchoCanceller
struct  PressVelocity
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

Enumerations

enum class  SpeakerCalibration : uint8_t { IDLE , LISTENING , FOUND , NOT_FOUND }

Functions

bool active ()
void startSpeakerCalibration ()
void stopSpeakerCalibration ()
 Back to IDLE, after a result or to cancel.
SpeakerCalibration speakerCalibration ()
int32_t lineOutDelayMs ()
bool probing ()
 For the audio engine's output: whether the speaker calibration's noise is playing, and its next sample (q31).
int32_t probeSample ()
bool calibrated ()
 The calibration presses are measured against, once there is one.
bool micAvailable ()
 Whether the internal mic can be used: nothing in the mic or line-in jacks (either switches it off).
void setCalibrating (bool calibrating)
 The calibration screen is open: presses are measured whatever the settings, for their levels.
float lastPressLevelDb ()
 The level (dB of full scale) the last press measured was at: its thump's, or the noise's if it had none.
dsp::mic_velocity::Calibration const & calibration ()
void setCalibration (dsp::mic_velocity::Calibration const &newCalibration)
void update ()
void noteActivity ()
 Any pad or button edge: the echo canceller stops learning for a moment, as the press may be thumping.
uint32_t now ()
 The mic's frame clock now, for stamping a press as it arrives.
PressVelocity velocityForPress (int32_t x, int32_t y, uint32_t arrived)
 A pad press that arrived at frame arrived (from now()). Call it again for the same press after a wait.
bool retryDue ()
 After a wait: whether it's time to ask about the press again (0.5 ms on). Cheap enough for a scheduler condition.
void readSettings ()
void writeSettingsIfChanged ()
void settingsChanged ()
 enabled or curve was changed (setCalibration notes it itself)

Variables

bool enabled = false
 Enabled in the settings.
int32_t lineOutDelay = -1
 The delay to the speakers on the line outputs (decimated samples), -1 until they've been calibrated (a setting).
dsp::mic_velocity::VelocityCurve curve {}
 How tap strength maps onto velocity (the settings).
constexpr std::array< GridPoint, kNumCalibrationPoints > kCalibrationPoints
constexpr int32_t kNumCalibrationPoints
 The pads calibrated, in the order they're tapped.

Detailed Description

Mic velocity: a pad press's velocity from the thump it makes in the internal mic.

While active, the mic (and, with the speaker on, what's sent to the speaker) runs continuously through the echo canceller and thump detector (dsp/mic_velocity). A press that plays notes at its velocity (keyboard view's pads, audition pads) is stamped with the frame it arrived at and queued (deluge.cpp); everything else goes on as usual. When it reaches the front its thump is usually already there: it starts a couple of ms before the press arrives. It then goes to the UI with the velocity it measured, so everything downstream (sounds, MIDI and CV out, recording, the arpeggiator) gets it as if the pads were velocity sensitive. If the thump is still rising, the press (and its release, if that's arrived too) waits for it, for up to 4 ms.

Enumeration Type Documentation

◆ SpeakerCalibration

enum class deluge::mic_velocity::SpeakerCalibration : uint8_t
strong

Speaker calibration, for speakers on the line outputs: plays a 1.5 s burst of quiet noise through the outputs and finds how long it takes to come back to the mic, so the echo canceller can take those speakers out too. (The internal speaker's delay is fixed.) Moved speakers need calibrating again.

Function Documentation

◆ active()

bool deluge::mic_velocity::active ( )
nodiscard

Whether presses are being measured: enabled and calibrated (or calibrating), the internal mic live (nothing in the mic or line-in jacks), and not exporting stems

◆ readSettings()

void deluge::mic_velocity::readSettings ( )

The settings (enabled, curve, calibration), in SETTINGS/MicVelocity.XML: read at boot, and written when they've changed, from places the card can be written from (leaving the settings menu, finishing a calibration)

◆ update()

void deluge::mic_velocity::update ( )

Starts or stops measuring to match active(). Called every 100 ms with the jack detection, and when the settings change.