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
Python API


API Reference for the Python Octopus SDK (PyPI).


pvoctopus.create()

def create(
access_key: str,
model_path: Optional[str] = None,
library_path: Optional[str] = None) -> Octopus

Factory method for Octopus Speech-to-Index engine.

Parameters

  • access_key str : AccessKey obtained from Picovoice Console.
  • model_path Optional[str] : Absolute path to the file containing model parameters.
  • library_path Optional[str] : Absolute path to Octopus's dynamic library.

Returns

  • Octopus: An instance of Octopus Speech-to-Index engine.

Throws

  • OctopusError

pvoctopus.Octopus

class Octopus(object)

Class for the Octopus Speech-to-Index engine. Octopus can be initialized either using the module level create() function or directly using the class __init__() method. Resources should be cleaned when you are done using the delete() method.


pvoctopus.Octopus.Match

Match = namedtuple('Match', ['start_sec', 'end_sec', 'probability'])

The type representing a matched search result.


pvoctopus.Octopus.version

self.version: str

The version string of the Octopus library.


pvoctopus.Octopus.sample_rate

self.sample_rate: int

Audio sample rate accepted by Octopus when processing PCM audio data.


pvoctopus.Octopus.__init__()

def __init__(
self,
access_key: str,
model_path: str,
library_path: str) -> Octopus

__init__ method for Octopus Speech-to-Index engine.

Parameters

  • access_key str : AccessKey obtained from Picovoice Console.
  • model_path str : Absolute path to the file containing model parameters.
  • library_path str : Absolute path to Octopus's dynamic library.

Returns

  • Octopus: An instance of Octopus Speech-to-Index engine.

Throws

  • OctopusError

pvoctopus.Octopus.delete()

def delete(self)

Releases resources acquired by Octopus.


pvoctopus.Octopus.index_audio_data()

def index_audio_data(self, pcm: Sequence[int]) -> OctopusMetadata

Indexes audio data. The audio needs to have a sample rate equal to .sample_rate and be 16-bit linearly-encoded. This function operates on single-channel audio. If you wish to process data in a different sample rate or format consider using .index_audio_file().

Parameters

  • pcm Sequence[int] : Audio data.

Returns

  • OctopusMetadata : An immutable metadata object.

Throws

  • OctopusError

pvoctopus.Octopus.index_audio_file()

def index_audio_file(self, path: str) -> OctopusMetadata

Indexes audio file.

Parameters

  • audio_path str : Absolute path to the audio file.

Returns

  • OctopusMetadata : An immutable metadata object.

Throws

  • OctopusError

pvoctopus.Octopus.search()

def search(
self,
metadata: OctopusMetadata,
phrases: Iterable[str]) -> Dict[str, Sequence[Match]]

Searches metadata for occurrences of a given phrase.

Parameters

  • metadata OctopusMetadata : Metadata object.
  • phrases Iterable[str] : An iterable of phrases to search the index for.

Returns

  • Dict[str, Sequence[Match]] : A dictionary map of found matches.

Throws

  • OctopusError

pvoctopus.OctopusMetadata

class OctopusMetadata(object)

Python representation of the metadata object.


pvoctopus.OctopusError

class OctopusError(Exception)

Error thrown if an error occurs within Octopus Speech-to-Index engine.

Exceptions

class OctopusActivationError(OctopusError)
class OctopusActivationLimitError(OctopusError)
class OctopusActivationRefusedError(OctopusError)
class OctopusActivationThrottledError(OctopusError)
class OctopusIOError(OctopusError)
class OctopusInvalidArgumentError(OctopusError)
class OctopusInvalidStateError(OctopusError)
class OctopusKeyError(OctopusError)
class OctopusMemoryError(OctopusError)
class OctopusRuntimeError(OctopusError)
class OctopusStopIterationError(OctopusError)

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Octopus Speech-to-Index Python API
  • pvoctopus.create()
  • pvoctopus.Octopus
  • Match
  • version
  • sample_rate
  • __init__()
  • delete()
  • index_audio_data()
  • index_audio_file()
  • search()
  • pvoctopus.OctopusMetadata
  • pvoctopus.OctopusError
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.