Cobra Voice Activity Detection
Node.js API
API Reference for the Node.js Cobra SDK (npm)
Cobra
Class for the Cobra Voice Activity Detection engine.
Cobra can be initialized using the class constructor().
Resources should be cleaned when you are done using the release() method.
Cobra.constructor()
Cobra constructor.
Parameters
accessKeystring : AccessKey obtained from Picovoice Console.optionsCobraOptions: Optional configuration arguments:libraryPathstring : Path to the Cobra dynamic library (.node).
Returns
Cobra: An instance of Cobra platform.
Cobra.release()
Releases resources acquired by Cobra.
Cobra.frameLength
Getter for number of audio samples per frame.
Returns
number: Number of audio samples per frame.
Cobra.sampleRate
Getter for audio sample rate accepted by Cobra.
Returns
number: Audio sample rate accepted by Cobra.
Cobra.version
Getter for version.
Returns
string: CurrentCobraversion.
Cobra.process()
Processes a frame of the incoming audio stream with the voice activity detection engine. The number of samples per frame can be attained by calling .frameLength. The incoming audio needs to have a sample rate equal to .sampleRate and be 16-bit linearly-encoded. Cobra operates on single-channel audio.
Parameters
pcmArray<number> : A frame of audio samples.
Returns
number: Probability of voice activity. It is a floating-point number within [0, 1].
Errors
Exceptions thrown if an error occurs within Cobra Voice Activity Detection engine.
Exceptions: