Picovoice WordmarkPicovoice Console
Introduction
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSNodejsPythonRaspberry PiReact NativeRustWebWindows
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
FAQ
Introduction
AndroidCiOSLinuxmacOSPythonWebWindows
AndroidCiOSPythonWeb
SummaryOctopus Speech-to-IndexGoogle Speech-to-TextMozilla DeepSpeech
FAQ
Introduction
AndroidAngularArduinoBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaMicrocontrollerNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidAngularBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonlinuxmacOSNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidBeagleboneCiOSNvidia JetsonLinuxmacOSPythonRaspberry PiRustWebWindows
AndroidCiOSPythonRustWeb
SummaryPicovoice CobraWebRTC VAD
FAQ
Introduction
AndroidAngularArduinoBeagleBoneC.NETFlutterlink to GoiOSJavaNvidia JetsonMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustUnityVueWeb
AndroidAngularCMicrocontroller.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
Picovoice SDK - FAQ
IntroductionSTM32F407G-DISC1 (Arm Cortex-M4)STM32F411E-DISCO (Arm Cortex-M4)STM32F769I-DISCO (Arm Cortex-M7)IMXRT1050-EVKB (Arm Cortex-M7)
FAQGlossary

Octopus Speech-to-Index
Web API


API Reference for the Octopus Web SDK(octopus-web)


Octopus

class Octopus {}

Class for the Octopus Speech-to-Index engine.


Octopus.create()

static async function create(
accessKey: string,
model: OctopusModel,
options: OctopusOptions = {}
): Promise<Octopus>

Creates an instance of Octopus Speech-to-Index engine using .pv file in public directory. The model size is large, hence it will try to use the existing one if it exists, otherwise saves the model in storage.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • model OctopusModel : Octopus Model Options.
  • options OctopusOptions : Optional configuration arguments.

Returns

  • Octopus : An instance of the Octopus engine.

Octopus.index()

async function index(pcm: Int16Array): Promise<OctopusMetadata>

Processes multiple frames of audio samples. The required sample rate can be retrieved from .sampleRate. The audio needs to bit 16-bit linearly-encoded. Furthermore, the engine operates on single-channel audio.

Parameters

  • pcm Int16Array : Audio data.

Returns

  • OctopusMetadata : Octopus metadata object.

Octopus.search()

async function search(
octopusMetadata: OctopusMetadata,
searchPhrase: string
): Promise<OctopusMatch[]>

Searches metadata for a given search phrase.

Parameters

  • octopusMetadata OctopusMetadata : An octopus metadata object.
  • searchPhrase string : The text phrase to search the metadata (indexed audio) for.

Returns

  • OctopusMatch[] : An array of OctopusMatch objects.

Octopus.release()

async function release(): Promise<void>

Releases resources acquired by the Octopus Web SDK.


Octopus.sampleRate

get sampleRate(): number

Audio sample rate accepted by Octopus.


Octopus.version

get version(): string

Octopus version string.


OctopusModel

type OctopusModel = {
customWritePath?: string;
forceWrite?: boolean;
version?: number;
}

Octopus model type.

  • base64 string: The model file (.pv) in base64 string to initialize Octopus.
  • publicPath string: The model file (.pv) path relative to the public directory.
  • customWritePath string : Custom path to save the model in storage. Set to a different name to use multiple models across octopus instances.
  • forceWrite boolean : Flag to overwrite the model in storage even if it exists.
  • version number : Version of the model file. Increment to update the model file in storage.

OctopusMetadata

type OctopusMetadata = {
buffer: Uint8Array;
}

OctopusMetadata type.

  • buffer Uint8Array : Buffer containing OctopusMetadata information.

OctopusMatch

type OctopusWord = {
startSec: number;
endSec: number;
probability: number;
}

OctopusMatch type.

  • startSec number : Start of the matched audio in seconds.
  • endSec number : End of the matched audio in seconds.
  • probability number : Probability (confidence) that this matches the search phrase (between 0 and 1).

OctopusWorker

class OctopusWorker {}

A class for creating new instances of the OctopusWorker.


OctopusWorker.fromBase64()

static async fromBase64(
accessKey: string,
modelBase64: string,
options: OctopusOptions = {},
): Promise<OctopusWorker>

Creates a worker instance of the OctopusWorker using a base64 string of the model file. The model size is large, hence it will try to use the existing one if it exists, otherwise saves the model in storage.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • modelBase64 string : The model in base64 string to initialize Octopus.
  • options OctopusOptions : Optional configuration arguments.

Returns

  • OctopusWorker : An instance of OctopusWorker.

OctopusWorker.fromPublicDirectory()

static async fromPublicDirectory(
accessKey: string,
modelBase64: string,
options: OctopusOptions = {},
): Promise<OctopusWorker>

Creates an instance of OctopusWorker using '.pv' file in public directory. The model size is large, hence it will try to use the existing one if it exists, otherwise saves the model in storage.

Parameters

  • accessKey string : AccessKey obtained from Picovoice Console.
  • publicPath string : The model path relative to the public directory.
  • options OctopusOptions : Optional configuration arguments.

Returns

  • OctopusWorker : An instance of OctopusWorker.

OctopusWorker.index()

async function index(
pcm: Int16Array,
options: { transfer?: boolean, transferCallback?: (data: Int16Array) => void }
): Promise<OctopusMetadata>

Processes multiple frames of audio samples. The required sample rate can be retrieved from .sampleRate. The audio needs to bit 16-bit linearly-encoded. Furthermore, the engine operates on single-channel audio.

Parameters

  • pcm Int16Array : Audio data.
  • options Object : Optional index arguments.
  • options.transfer boolean : Optional flag to indicate if the buffer should be transferred or not. If set to true, input buffer array will be transferred to the worker.
  • options.transferCallback (pcm: Int16Array) => void : Optional callback containing a new Int16Array with contents from pcm. Use this callback to get the input pcm when using transfer.

Returns

  • OctopusMetadata : Octopus metadata object.

OctopusWorker.search()

async function search(
octopusMetadata: OctopusMetadata,
searchPhrase: string
): Promise<OctopusMatch[]>

Searches metadata for a given search phrase.

Parameters

  • octopusMetadata OctopusMetadata : An octopus metadata object.
  • searchPhrase string : The text phrase to search the metadata (indexed audio) for.

Returns

  • OctopusMatch[] : An array of OctopusMatch objects.

OctopusWorker.release()

async function release(): Promise<void>

Releases resources acquired by the Octopus Web SDK.


OctopusWorker.terminate()

async function terminate(): Promise<void>

Force terminates the instance of OctopusWorker.


OctopusWorker.sampleRate

get sampleRate(): number

Audio sample rate accepted by Octopus.


OctopusWorker.version

get version(): string

Octopus version string.


OctopusOptions

type OctopusOptions = Record<string, never>;

Octopus optional configuration arguments.

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Octopus Speech-to-Index Web API
  • Octopus
  • create()
  • index()
  • search()
  • release()
  • sampleRate
  • version
  • OctopusModel
  • OctopusMetadata
  • OctopusMatch
  • OctopusWorker
  • fromBase64()
  • fromPublicDirectory()
  • index()
  • search()
  • release()
  • terminate()
  • sampleRate
  • version
  • OctopusOptions
Platform
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Octopus Speech-to-Index
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Resources
  • Docs
  • Console
  • Blog
  • Demos
Sales
  • Pricing
  • Starter Tier
  • Enterprise
Company
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • Twitter
  • Medium
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2022 Picovoice Inc.