Voss Connection Detection
1
Detect a connector click using realtime code on Bela hardware
|
Go to the documentation of this file.
4 #include <libraries/Fft/Fft.h>
34 std::vector<float> _wbd;
38 std::array<float,
BLOCKSIZE / 2 + 1> _freq;
44 std::array<float,
BLOCKSIZE / 2 + 1> _Ssq;
139 float wamp(
float wampl);
147 float zc(
float zc_l);
182 bool _ms_computed =
false;
183 bool _fft_computed =
false;
184 bool _delta_computed =
false;
191 void compute_delta();
210 return std::accumulate(i.begin(), i.end(), 0.0)/
BLOCKSIZE;
220 auto nonzero = [](
us i) {
return i>1e-6; };
221 return (
float) (std::any_of(i.begin(), i.end(), nonzero));
232 return *std::max_element(i.begin(), i.end());
float TM3()
Temporal moment 3, defined as.
Some very simple features that are more easily kept in a different class.
std::array< float, BLOCKSIZE > Channel
A Channel contains data for the length of BLOCKSIZE.
float wamp(float wampl)
Willson amplitude. Counts the number of difss in amplitude that have an absolute change in value larg...
static float maximum(const Channel &i)
Find the maximum value in a strictly positive array. No checks on positiveness are done!
float inverse_variance()
Inverse of the variance in the center frequency, defined as:
float rms_dB()
Compute the rms level in dB (full scale, normalized to 1). The equation is:
Features(const float fs)
Create features instance.
float peak_freq()
Compute the frequency at which the spectrum has the most power. It is defined as:
const us BLOCKSIZE
The size of a buffer in a block. Should be an integer number of samples, and preferrably a integer po...
unsigned int us
Used to much to not abbreviate.
void setChannel(const Channel &channel)
Set channel data to operate on. BORROWS the data on which it operates, be carefull not to delete the ...
This class provides the calculations of single-signal features, computed from a single channel with l...
Configuration parameters for connection detection.
float kurtosis()
Compute the kurtosis , scaled. It is defined as:
float zc(float zc_l)
Compute zero-crossings with a difference larger than zcl.
static float hasNonZero(const Channel &i)
Find a nonzero in the array.
float peak_dB()
Compute the peak level in dB (full scale, normalized to 1). The equation is:
float TM5()
Temporal moment 5, defined as.
static float average(const Channel &i)
Compute the average of a channel value.