gramods
|
The interface for an algorithm detecting sound in an audio stream. More...
#include <SoundDetector.hh>
Classes | |
struct | Impl |
Public Member Functions | |
size_t | getSampleRate () |
Returns the sample rate. More... | |
size_t | getChannelCount () |
Sets the number of channels to attempt to open for the capture device. More... | |
void | setCapture (std::shared_ptr< Capture > c) |
Sets the capture object to read audio sample data from. More... | |
void | setWindow (float t) |
Sets the time window (in seconds) over which to search for matching events. More... | |
virtual std::vector< std::vector< float > > | detectSound ()=0 |
Calls getData and applies the implementation specific algorithm to these data to detect sound in the stream, estimating how long ago the sound appeared in each channel. More... | |
std::string | getDefaultKey () override |
Returns the default key for the Object when automatically instantiated in a Configuration, i.e. More... | |
![]() | |
Object () | |
Initializes internal data. More... | |
virtual | ~Object () |
Cleaning up internal data. More... | |
virtual void | initialize () |
Called to initialize the Object. More... | |
virtual void | accept (Visitor *visitor) |
Calls the visitors apply method with this as argument. More... | |
virtual void | traverse (Visitor *visitor) |
Calls the child Object's accept method, if such exist. More... | |
bool | isInitialized () |
Returns true if the Object is initialized. More... | |
Public Attributes | |
GM_OFI_DECLARE | |
Protected Member Functions | |
const std::vector< std::deque< float > > & | getData () |
Fetches the current data that span the specified window. More... | |
The interface for an algorithm detecting sound in an audio stream.
|
pure virtual |
Calls getData and applies the implementation specific algorithm to these data to detect sound in the stream, estimating how long ago the sound appeared in each channel.
Implemented in gramods::gmSound::SoundBurstDetector.
size_t gramods::gmSound::SoundDetector::getChannelCount | ( | ) |
Sets the number of channels to attempt to open for the capture device.
|
protected |
Fetches the current data that span the specified window.
The referenced object is valid at least until the getData method is called again.
|
inlineoverridevirtual |
Returns the default key for the Object when automatically instantiated in a Configuration, i.e.
where it ends up in a parent Object. Default is "object", but this should be overriden by sub classes and can also be overridden in XML by using the attribute KEY
, as in KEY="view"
.
The key can also be used to extract a specific object from a Configuration instance:
Reimplemented from gramods::gmCore::Object.
size_t gramods::gmSound::SoundDetector::getSampleRate | ( | ) |
Returns the sample rate.
void gramods::gmSound::SoundDetector::setCapture | ( | std::shared_ptr< Capture > | c | ) |
Sets the capture object to read audio sample data from.
The number of microphone positions should match the number of channels in the capture.
XML-attribute: capture
void gramods::gmSound::SoundDetector::setWindow | ( | float | t | ) |
Sets the time window (in seconds) over which to search for matching events.
Default is 0.029 seconds, which corresponds to approximately 10 meters with the default speed of sound.
XML-attribute: window