Skip to main content

Porcupine wake word engine.

Project description

Porcupine Wake Word Engine

Made in Vancouver, Canada by Picovoice

Porcupine is a highly-accurate and lightweight wake word engine. It enables building always-listening voice-enabled applications. It is

  • using deep neural networks trained in real-world environments.
  • compact and computationally-efficient. It is perfect for IoT.
  • cross-platform. Raspberry Pi, BeagleBone, Android, iOS, Linux (x86_64), macOS (x86_64 and arm64), Windows (x86_64), and web browsers are supported. Additionally, enterprise customers have access to ARM Cortex-M SDK.
  • scalable. It can detect multiple always-listening voice commands with no added runtime footprint.
  • self-service. Developers can train custom wake word models using Picovoice Console.

Compatibility

  • Python 3
  • Runs on Linux (x86_64), macOS (x86_64 and arm64), Windows (x86_64), Raspberry Pi, NVIDIA Jetson (Nano), and BeagleBone.

Installation

pip3 install pvporcupine

AccessKey

The Porcupine SDK requires a valid AccessKey at initialization. AccessKeys act as your credentials when using Porcupine SDKs. You can create your AccessKey for free. Make sure to keep your AccessKey secret.

To obtain your AccessKey:

  1. Login or Signup for a free account on the Picovoice Console.
  2. Once logged in, go to the AccessKey tab to create one or use an existing AccessKey.

Usage

Create an instance of the engine

import pvporcupine

access_key = "${ACCESS_KEY}" # AccessKey obtained from Picovoice Console (https://picovoice.ai/console/)

handle = pvporcupine.create(access_key=access_key, keywords=['picovoice'])

handle is an instance of Porcupine that detects utterances of "Picovoice". keywords input argument is a shorthand for accessing default keyword model files shipped with the package. The list of default keywords can be retrieved by

import pvporcupine

print(pvporcupine.KEYWORDS)

Porcupine can detect multiple keywords concurrently

import pvporcupine

access_key = "${ACCESS_KEY}" # AccessKey obtained from Picovoice Console (https://picovoice.ai/console/)

handle = pvporcupine.create(access_key=access_key, keywords=['bumblebee', 'picovoice'])

To detect non-default keywords use keyword_paths input argument instead

import pvporcupine

access_key = "${ACCESS_KEY}" # AccessKey obtained from Picovoice Console (https://picovoice.ai/console/)
keyword_paths = ['/absolute/path/to/keyword/one', '/absolute/path/to/keyword/two', ...]

handle = pvporcupine.create(access_key=access_key, keyword_paths=keyword_paths)

The sensitivity of the engine can be tuned per keyword using the sensitivities input argument

import pvporcupine

access_key = "${ACCESS_KEY}" # AccessKey obtained from Picovoice Console (https://picovoice.ai/console/)

handle = pvporcupine.create(
        access_key=access_key,
        keywords=['grapefruit', 'porcupine'],
        sensitivities=[0.6, 0.35])

Sensitivity is the parameter that enables trading miss rate for the false alarm rate. It is a floating point number within [0, 1]. A higher sensitivity reduces the miss rate at the cost of increased false alarm rate.

When initialized, the valid sample rate is given by handle.sample_rate. Expected frame length (number of audio samples in an input array) is handle.frame_length. The engine accepts 16-bit linearly-encoded PCM and operates on single-channel audio.

def get_next_audio_frame():
    pass

while True:
    keyword_index = handle.process(get_next_audio_frame())
    if keyword_index >= 0:
        # detection event logic/callback
        pass

When done resources have to be released explicitly

handle.delete()

Non-English Wake Words

In order to detect non-English wake words you need to use the corresponding model file. The model files for all supported languages are available here.

Demos

pvporcupinedemo provides command-line utilities for processing real-time audio (i.e. microphone) and files using Porcupine.

Project details


Download files

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

Source Distribution

pvporcupine-2.0.0.tar.gz (3.4 MB view details)

Uploaded Source

Built Distribution

pvporcupine-2.0.0-py3-none-any.whl (3.4 MB view details)

Uploaded Python 3

File details

Details for the file pvporcupine-2.0.0.tar.gz.

File metadata

  • Download URL: pvporcupine-2.0.0.tar.gz
  • Upload date:
  • Size: 3.4 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 pvporcupine-2.0.0.tar.gz
Algorithm Hash digest
SHA256 69df0a5ec93e330f2958d2216c1dce0384d9bb1ee0b819d1a11ea4b04cef962a
MD5 5267a43a924ec0a2ffee8244229ef10b
BLAKE2b-256 f8627225c5d90eeafba6d7a22df9c275df2178f26f75a0e32e9af9d9261c4bf6

See more details on using hashes here.

File details

Details for the file pvporcupine-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: pvporcupine-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 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 pvporcupine-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 410b2fd56b7778b3139a1a4b7a09e0428c0558a06d2555069d938aff4ea4d154
MD5 f1e0e3edcb190a2d180127bf3a57e212
BLAKE2b-256 23b57e006f8c3a7e07036e480388d2e8db2ac82c46412bf1f0cb149b90c60e53

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page