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.5+
- Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64)
Installation
pip3 install pvoctopus
AccessKey
Octopus requires a valid Picovoice AccessKey at initialization. AccessKey acts as your credentials when using Octopus SDKs.
You can get your AccessKey for free. Make sure to keep your AccessKey secret.
Signup or Login to Picovoice Console to get your AccessKey.
Usage
Create an instance of the engine:
import pvoctopus
access_key = "" # AccessKey obtained from Picovoice Console (https://console.picovoice.ai/)
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.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 = octopus.search(cached_metadata, ['avocado'])
When done the handle resources have to be released explicitly:
handle.delete()
Non-English Models
In order to search non-English phrases you need to use the corresponding model file. The model files for all supported languages are available here.
Demos
pvoctopusdemo provides command-line utilities for searching audio files using Octopus.
Metadata
Release files for pvoctopus 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pvoctopus-1.2.1.tar.gz | 8.1 MB | Without provenance | Details for pvoctopus-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pvoctopus-1.2.1-py3-none-any.whl | Python 3 | none | any | Details for pvoctopus-1.2.1-py3-none-any.whl |
Total release size: 16.3 MB
Release files / pvoctopus-1.2.1.tar.gz
| Download URL | pvoctopus-1.2.1.tar.gz |
|---|---|
| Size | 8.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8788c1359e14bac49794ef8e33ab5b93a6908c58dc70b070bf5966d8227cc94
|
|
BLAKE2b-256 checksum How to use checksums |
4ed00fd0d600cc5fc90e67e4b946880a9eb48489e9fb8ceff0c3f4ffa2c948e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|
Release files / pvoctopus-1.2.1-py3-none-any.whl
| Download URL | pvoctopus-1.2.1-py3-none-any.whl |
|---|---|
| Size | 8.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2572cf15083f885827f9cba567015f27c5ff26782255078e5b7d595713d9dd9b
|
|
BLAKE2b-256 checksum How to use checksums |
41817224e9b853094d451893c641989454e395c5b1db5813f9c3863575431286
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|
Security for pvoctopus 1.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.