Voss Connection Detection  1
Detect a connector click using realtime code on Bela hardware
Features Class Reference

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Features()

Features::Features ( const float  fs)

Create features instance.

Parameters
fsSampling frequency in [Hz]

Definition at line 31 of file conndetect_features.cpp.

Member Function Documentation

◆ inverse_variance()

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])}\)

Returns
\( IVCF \)

Definition at line 179 of file conndetect_features.cpp.

◆ kurtosis()

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} \)

Returns
\( K \)

Definition at line 70 of file conndetect_features.cpp.

◆ peak_dB()

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])} \)

Returns
\( L_{pk} \mathrm{\ in\ dB} \)

Definition at line 55 of file conndetect_features.cpp.

◆ peak_freq()

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] \).

Returns
\( f_{pk} \)

Definition at line 129 of file conndetect_features.cpp.

◆ rms_dB()

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) \)

Returns
\( L_{rms} \mathrm{\ in\ dB} \)

Definition at line 65 of file conndetect_features.cpp.

◆ setChannel()

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!

Parameters
channelthe channel to operate on.

Definition at line 43 of file conndetect_features.cpp.

◆ TM3()

float Features::TM3 ( )

Temporal moment 3, defined as.

\( TM3 = \left| 1/N \sum_{i=0}^{N-1} s[i]^3 \right| \)

Returns
\( TM3 \)

Definition at line 164 of file conndetect_features.cpp.

◆ TM5()

float Features::TM5 ( )

Temporal moment 5, defined as.

\( TM5 = \left| 1/N \sum_{i=0}^{N-1} s[i]^5 \right| \)

Returns
\( TM5 \)

Definition at line 172 of file conndetect_features.cpp.

◆ wamp()

float Features::wamp ( float  wampl)

Willson amplitude. Counts the number of difss in amplitude that have an absolute change in value larger than wampl;.

Parameters
wamplthe threshold difference
Returns
The number obtained.

Definition at line 143 of file conndetect_features.cpp.

◆ zc()

float Features::zc ( float  zc_l)

Compute zero-crossings with a difference larger than zcl.

Parameters
zclthe threshold change that is counted
Returns
The number of zero-crossings

Definition at line 153 of file conndetect_features.cpp.


The documentation for this class was generated from the following files: