nodejsPicovoice - Node.js API

API Reference for the Picovoice Node.js SDK (npmjs).


Picovoice

class Picovoice

Class for Picovoice. Picovoice can be initialized using the class constructor(). Resources should be cleaned when you are done using the release() method.


Picovoice.constructor()

Picovoice.constructor(
accessKey,
keywordPath,
wakeWordCallback,
contextPath,
inferenceCallback,
porcupineSensitivity = 0.5,
rhinoSensitivity = 0.5,
requireEndpoint = true,
porcupineModelPath,
rhinoModelPath,
porcupineLibraryPath,
rhinoLibraryPath
)

constructor method for Picovoice.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • keywordPath string : Absolute paths to keyword model files.
  • wakeWordCallback (index) => {} : User-defined callback invoked upon detection of the wake phrase. Receives an index number.
  • contextPath string : The path to the Rhino context file (.rhn extension).
  • inferenceCallback (inference) => {} : User-defined callback invoked upon completion of intent inference. Receives an inference object.
  • porcupineSensitivity number : Wake word detection sensitivity. It should be a number within [0, 1]. A higher sensitivity results in fewer misses at the cost of increasing the false alarm rate.
  • rhinoSensitivity number : Inference sensitivity. It should be a number within [0, 1]. A higher sensitivity results in fewer misses at the cost of increasing the false alarm rate.
  • requireEndpoint boolean : If set to true, Rhino requires an endpoint (chunk of silence) before finishing inference.
  • porcupineModelPath string : Absolute path to the file containing Porcupine's model parameters.
  • rhinoModelPath string : Absolute path to the file containing Rhino's model parameters.
  • porcupineLibraryPath string : The path to the Porcupine dynamic library (platform-dependent extension).
  • rhinoLibraryPath string : The path to the Rhino dynamic library (platform-dependent extension).

Returns


Picovoice.frameLength

Picovoice.frameLength

The number of audio samples per frame.


Picovoice.sampleRate

Picovoice.sampleRate

The audio sample rate accepted by Picovoice.


Picovoice.version

Picovoice.version

The version of the Picovoice SDK.


Picovoice.porcupineVersion

Picovoice.porcupineVersion

The version of the Porcupine SDK.


Picovoice.rhinoVersion

Picovoice.rhinoVersion

The version of the Rhino SDK.


Picovoice.contextInfo

Picovoice.contextInfo

The context information.


Picovoice.process()

Picovoice.process(frame)

Processes a frame of the incoming audio stream. Upon detection of wake word and completion of follow-on command inference invokes user-defined callbacks. 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. Picovoice operates on single-channel audio.

Parameters

  • frame Array<number> : A frame of audio samples.

Picovoice.release()

Picovoice.release()

Releases resources acquired by Picovoice.


Issue with this doc? Please let us know.