Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

Octopus

Made in Vancouver, Canada by Picovoice

Octopus is Picovoice's Speech-to-Index engine. It directly indexes speech without relying on a text representation. This acoustic-only approach boosts accuracy by removing out-of-vocabulary limitation and eliminating the problem of competing hypothesis (e.g. homophones)

Compatibility

  • Python 3
  • Runs on Linux (x86_64), macOS (x86_64), Windows (x86_64)

Installation

pip3 install pvoctopus

Usage

Create an instance of the engine:

import pvoctopus

access_key = ""  # AccessKey provided by Picovoice Console (https://picovoice.ai/console/)
handle = pvoctopus.create(access_key=access_key)

Octopus consists of two steps: Indexing and Searching. Indexing transforms audio data into a Metadata object that searches can be run against.

Octopus indexing has two modes of operation: indexing PCM audio data, or indexing an audio file.

When indexing PCM audio data, the valid audio sample rate is given by handle.pcm_sample_rate. The engine accepts 16-bit linearly-encoded PCM and operates on single-channel audio:

audio_data = [..]
metadata = handle.index(audio_data)

Similarly, files can be indexed by passing in the absolute file path to the audio object. Supported file formats are mp3, flac, wav and opus:

audio_file_path = "/path/to/my/audiofile.wav"
metadata = handle.index_file(audio_file_path)

Once the Metadata object has been created, it can be used for searching:

search_term = 'picovoice'
matches = octopus.search(metadata, [search_term])

Multiple search terms can be given:

matches = octopus.search(metadata, ['picovoice', 'Octopus', 'rhino'])

The matches object is a dictionary where the key is the phrase, and the value is a list of Match objects. The Match object contains the start_sec, end_sec and probablity of each match:

matches = octopus.search(metadata, ['avocado'])

avocado_matches = matches['avocado']
for match in avocado_matches:
    print(f"Match for `avocado`: {match.start_sec} -> {match.end_sec} ({match.probablity})")

The Metadata object can be cached or stored to skip the indexing step on subsequent searches. This can be done with the to_bytes() and from_bytes() methods:

metadata_bytes = metadata.to_bytes()

# ... Write & load `metadata_bytes` from cache/filesystem/etc.

cached_metadata = pvoctopus.OctopusMetadata.from_bytes(metadata_bytes)
matches = self.octopus.search(cached_metadata, ['avocado'])

When done the handle resources have to be released explicitly:

handle.delete()

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pvoctopus-1.1.1.tar.gz (6.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pvoctopus-1.1.1-py3-none-any.whl (6.6 MB view details)

Uploaded Python 3

File details

Details for the file pvoctopus-1.1.1.tar.gz.

File metadata

  • Download URL: pvoctopus-1.1.1.tar.gz
  • Upload date:
  • Size: 6.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for pvoctopus-1.1.1.tar.gz
Algorithm Hash digest
SHA256 2d1c8c443ac5a07b95881c09adb109f01ed4279c3d9ee56e7032eb38875d66de
MD5 ee5011cdc3103d35d890fdf3f7e3986b
BLAKE2b-256 a5c6dca1a10e4b3b0731dbca6432bcf72546e37dd9af5c4f9d886470ede46373

See more details on using hashes here.

File details

Details for the file pvoctopus-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: pvoctopus-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for pvoctopus-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 124263df694d2ae48f7627ae33612e806278601ed229d51f6f23fa06924e1286
MD5 7f45248853d05ba9bc4bfc8c0f7e6e4c
BLAKE2b-256 3fe77742e07cc1cb33090db1daac789575470c28b53a56204c8a11bc526ab243

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.2

2 files

2.0.0

2 files

1.1.6

2 files

1.1.5

2 files

1.1.4

2 files

1.1.3

2 files

1.1.2

2 files

This release

1.1.1 This release

2 files

1.1.0

2 files

1.0.3

2 files

1.0.2

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page