A Hopf, Skip and a Jump
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
OnsetDetector Class Reference

Onset detector. More...

#include <onsetdetector.h>

Collaboration diagram for OnsetDetector:
Collaboration graph
[legend]

Public Member Functions

 OnsetDetector (DetectorBank &db, const std::size_t offset, std::string csvfile)
 Construct an onset detector, given a DetectorBank. More...
 
void analyse (std::vector< std::size_t > &onsets, result_t threshold)
 Analyse the input and return any onsets. More...
 

Protected Member Functions

result_t getSegAvg ()
 Get average of current segment.
 
std::pair< bool, std::size_t > findExactTime (std::size_t incStart, std::size_t incStop)
 Verify or reject onsets found by analyse
 
result_t logResult (std::size_t channel, std::size_t idx)
 Get item from DetectorCache and calculate log. More...
 

Protected Attributes

DetectorBankdb
 The DetectorBank which produces the results.
 
const std::size_t offset
 Number of pad samples at beginning of input buffer.
 
const std::size_t chans
 Number of channels.
 
const parameter_t sr
 Sample rate.
 
std::unique_ptr< detectorcache::Producerp
 DetectorCache Producer.
 
const std::size_t seg_len
 OnsetDetector and DetectorCache segment length.
 
const std::size_t num_segs
 Number of segments to be stored.
 
std::unique_ptr< detectorcache::DetectorCachecache
 DetectorCache from which to get abs(z) values.
 
std::size_t n
 Current sample number.
 
std::size_t end
 Total number of samples in cache.
 
std::ofstream logfile
 
std::ofstream segfile
 

Detailed Description

Onset detector.

Definition at line 18 of file onsetdetector.h.

Constructor & Destructor Documentation

◆ OnsetDetector()

OnsetDetector::OnsetDetector ( DetectorBank db,
const std::size_t  offset,
std::string  csvfile 
)

Construct an onset detector, given a DetectorBank.

Parameters
dbDetectorBank for this critical band
offsetNumber of pad samples at beginning of the input buffer

Member Function Documentation

◆ analyse()

void OnsetDetector::analyse ( std::vector< std::size_t > &  onsets,
result_t  threshold 
)

Analyse the input and return any onsets.

Parameters
thresholdamplitude above which DetectorBank output must be in order to qualify as an onset
Returns
vector of onset sample times

◆ logResult()

result_t OnsetDetector::logResult ( std::size_t  channel,
std::size_t  idx 
)
protected

Get item from DetectorCache and calculate log.

If item is 0, 0 is returned


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