Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Vox)
Option is the type for a function option
func Enabled ¶
Enabled is a functional option to initialize the Vox object with an enabled or disabled vox.
func StateChanged ¶
StateChanged is a functional option to provide a callback which be executed whenever the Vox is triggered or cut off.
type Vox ¶
Vox is an Audio Node which detects if the audio level raises above or falls below a defined threshold level.
func New ¶
New is the constructor method for a Vox Object. Vox implements an audio.Node and emits a StateChanged callback when the RMS (root mean square) has fallen above or below the set threshold. By default the threshold is set to 0.1 and the hold time to 500ms.
func (*Vox) Enable ¶
Enable or disable the vox. If the vox is disabled, the audio data will be passed on to the next audio node in the chain.
func (*Vox) Enabled ¶
Enabled returns a boolean value indicating if the vox is enabled. If not, the audio data is directly passed on to the next audio node in the chain.
func (*Vox) SetCb ¶
SetCb sets the callback which will be called when the data has been processed and is ready to be sent to the next audio.Node or audio.Sink.
func (*Vox) SetHoldTime ¶
SetHoldTime sets the vox hold time. The hold time is the duration which will be waited until a statechange event is emitted.
func (*Vox) SetThreshold ¶
SetThreshold sets the value for the vox threshold. Only values between 0...1 are allowed. Values below or above will be clipped to the minimum or maximum.