Switchboard SDK
Loading...
Searching...
No Matches
switchboard::VoiceActivityDetectorNode Class Reference

Analyzes the incoming audio and checks whether there was any voice activity. More...

#include <VoiceActivityDetectorNode.hpp>

Inheritance diagram for switchboard::VoiceActivityDetectorNode:
switchboard::SingleBusAudioSinkNode switchboard::AudioSinkNode switchboard::AudioNode

Public Member Functions

WASM VoiceActivityDetectorNode ()
 Creates a VoiceActivityDetectorNode instance.
 
WASM VoiceActivityDetector::Status getStatus ()
 Returns the last buffers VAD status.
 
WASM void setHangoverDuration (float duration)
 Sets the duration of the VAD hangover.
 
WASM float getHangoverDuration () const
 Returns the current hangover duration.
 
WASM void setGainTriggerThreshold (float threshold)
 Sets the audio level trigger amount for the VAD.
 
WASM float getGainTriggerThreshold () const
 Returns the current audio level trigger threshold.
 
WASM void setTriggerDuration (float duration)
 Sets the amount of seconds the audio signal must be higher than the trigger threshold for the VAD to be activated.
 
WASM float getTriggerDuration () const
 Returns the current trigger duration.
 
WASM bool setBusFormat (AudioBusFormat &busFormat) override
 Sets bus format.
 
WASM bool consume (AudioBus &bus) override
 Consumes audio data from the given bus.
 
- Public Member Functions inherited from switchboard::SingleBusAudioSinkNode
bool setNumberOfBuses (const uint numberOfBuses) override
 Sets number of buses.
 
bool setBusFormats (AudioBusFormatList &busFormats) override
 Sets bus formats.
 
bool consume (AudioBusList &buses) override
 Consumes audio data from the given buses.
 
- Public Member Functions inherited from switchboard::AudioNode
 AudioNode ()
 AudioNode constructor.
 
virtual ~AudioNode ()=default
 AudioNode virtual destructor.
 
const std::string & getType () const
 Gets the type of the audio node.
 
virtual const std::string getDisplayName () const
 Gets the display name of the audio node.
 
virtual std::vector< std::unique_ptr< Parameter > > & getParameters ()
 Gets the parameters of the audio node.
 
virtual ParametergetParameter (const std::string &name)
 Gets the parameter with the given name.
 

Additional Inherited Members

- Public Attributes inherited from switchboard::AudioNode
std::string name
 The name of the audio node.
 
- Protected Attributes inherited from switchboard::AudioNode
std::string type
 
std::vector< std::unique_ptr< Parameter > > parameters
 

Detailed Description

Analyzes the incoming audio and checks whether there was any voice activity.

VoiceActivityDetectorNode class

Member Function Documentation

◆ consume()

bool switchboard::VoiceActivityDetectorNode::consume ( AudioBus & bus)
overridevirtual

Consumes audio data from the given bus.

Should be overridden by subclasses.

Parameters
busThe bus that contain the audio data.
Returns
True if audio was consumed successfully, false otherwise.

Implements switchboard::SingleBusAudioSinkNode.

◆ getGainTriggerThreshold()

float switchboard::VoiceActivityDetectorNode::getGainTriggerThreshold ( ) const

Returns the current audio level trigger threshold.

Returns
Trigger threshold.

◆ getHangoverDuration()

float switchboard::VoiceActivityDetectorNode::getHangoverDuration ( ) const

Returns the current hangover duration.

Returns
Hangover duration.

◆ getStatus()

VoiceActivityDetector::Status switchboard::VoiceActivityDetectorNode::getStatus ( )

Returns the last buffers VAD status.

Returns
The last VAD status.

◆ getTriggerDuration()

float switchboard::VoiceActivityDetectorNode::getTriggerDuration ( ) const

Returns the current trigger duration.

Returns
Trigger duration.

◆ setBusFormat()

bool switchboard::VoiceActivityDetectorNode::setBusFormat ( AudioBusFormat & busFormat)
overridevirtual

Sets bus format.

Should be overridden by subclasses.

Parameters
busFormatThe bus format to set.
Returns
True if the bus format was set successfully, false otherwise.

Implements switchboard::SingleBusAudioSinkNode.

◆ setGainTriggerThreshold()

void switchboard::VoiceActivityDetectorNode::setGainTriggerThreshold ( float threshold)

Sets the audio level trigger amount for the VAD.

Parameters
thresholdThe new threshold.

◆ setHangoverDuration()

void switchboard::VoiceActivityDetectorNode::setHangoverDuration ( float duration)

Sets the duration of the VAD hangover.

Parameters
durationThe new duration.

◆ setTriggerDuration()

void switchboard::VoiceActivityDetectorNode::setTriggerDuration ( float duration)

Sets the amount of seconds the audio signal must be higher than the trigger threshold for the VAD to be activated.

Parameters
durationThe new duration.