Voss Connection Detection
1
Detect a connector click using realtime code on Bela hardware
|
This class provides the calculations of single-signal features, computed from a single channel with length BLOCKSIZE. More...
#include <conndetect_features.h>
Public Member Functions | |
Features (const float fs) | |
Create features instance. More... | |
void | setChannel (const Channel &channel) |
Set channel data to operate on. BORROWS the data on which it operates, be carefull not to delete the underlying Channel! More... | |
float | peak_dB () |
Compute the peak level in dB (full scale, normalized to 1). The equation is: More... | |
float | rms_dB () |
Compute the rms level in dB (full scale, normalized to 1). The equation is: More... | |
float | kurtosis () |
Compute the kurtosis \( K \), scaled. It is defined as: More... | |
float | peak_freq () |
Compute the frequency at which the spectrum has the most power. It is defined as: More... | |
float | wamp (float wampl) |
Willson amplitude. Counts the number of difss in amplitude that have an absolute change in value larger than wampl;. More... | |
float | zc (float zc_l) |
Compute zero-crossings with a difference larger than zcl. More... | |
float | TM3 () |
Temporal moment 3, defined as. More... | |
float | TM5 () |
Temporal moment 5, defined as. More... | |
float | inverse_variance () |
Inverse of the variance in the center frequency, defined as: More... | |
This class provides the calculations of single-signal features, computed from a single channel with length BLOCKSIZE.
Definition at line 18 of file conndetect_features.h.
Features::Features | ( | const float | fs | ) |
Create features instance.
fs | Sampling frequency in [Hz] |
Definition at line 31 of file conndetect_features.cpp.
float Features::inverse_variance | ( | ) |
Inverse of the variance in the center frequency, defined as:
\( IVCF = \frac{f_c^2 \sum \mathrm{abs}(\hat{S}[i])}{\sum \mathrm{abs}(\hat{S}[i]) (f_i - f_c)^2} \)
where
\( f_i = \frac{\sum f_i \mathrm{abs}(\hat{S}[i])}{\sum \mathrm{abs}(\hat{S}[i])}\)
Definition at line 179 of file conndetect_features.cpp.
float Features::kurtosis | ( | ) |
Compute the kurtosis \( K \), scaled. It is defined as:
\( K = \frac{1/N\sum_{i=0}^{N-1}(s[i])^4}{\left(1/N\sum_{i=0}^{N-1} (s[i])^2\right)^2} \)
Definition at line 70 of file conndetect_features.cpp.
float Features::peak_dB | ( | ) |
Compute the peak level in dB (full scale, normalized to 1). The equation is:
\( L_{pk} = 20\log_{10}{\max \mathrm{abs}(s[i])} \)
Definition at line 55 of file conndetect_features.cpp.
float Features::peak_freq | ( | ) |
Compute the frequency at which the spectrum has the most power. It is defined as:
\( f_{pk} = \mathrm{arg\ max} \mathrm{abs}(\hat{S}[i]) \)
where
\( \hat{S}[i] \) denotes the short-time Fourier transform of \( s[i] \).
Definition at line 129 of file conndetect_features.cpp.
float Features::rms_dB | ( | ) |
Compute the rms level in dB (full scale, normalized to 1). The equation is:
\( L_{rms} = 20\log_{10}\left(\sqrt{\frac{1}{N} \sum^{N-1}_{i=0} s[i]^2)}\right) \)
Definition at line 65 of file conndetect_features.cpp.
void Features::setChannel | ( | const Channel & | channel | ) |
Set channel data to operate on. BORROWS the data on which it operates, be carefull not to delete the underlying Channel!
channel | the channel to operate on. |
Definition at line 43 of file conndetect_features.cpp.
float Features::TM3 | ( | ) |
Temporal moment 3, defined as.
\( TM3 = \left| 1/N \sum_{i=0}^{N-1} s[i]^3 \right| \)
Definition at line 164 of file conndetect_features.cpp.
float Features::TM5 | ( | ) |
Temporal moment 5, defined as.
\( TM5 = \left| 1/N \sum_{i=0}^{N-1} s[i]^5 \right| \)
Definition at line 172 of file conndetect_features.cpp.
float Features::wamp | ( | float | wampl | ) |
Willson amplitude. Counts the number of difss in amplitude that have an absolute change in value larger than wampl;.
wampl | the threshold difference |
Definition at line 143 of file conndetect_features.cpp.
float Features::zc | ( | float | zc_l | ) |
Compute zero-crossings with a difference larger than zcl.
zcl | the threshold change that is counted |
Definition at line 153 of file conndetect_features.cpp.