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:
    • Arm Cortex-M, STM32, Arduino, and i.MX RT
    • Raspberry Pi (Zero, 3, 4, 5)
    • Android and iOS
    • Chrome, Safari, Firefox, and Edge
    • Linux (x86_64), macOS (x86_64, arm64), and Windows (x86_64)
  • 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.8+
  • Runs on Linux (x86_64), macOS (x86_64 and arm64), Windows (x86_64), and Raspberry Pi (Zero, 3, 4, 5).

Installation

pip3 install pvporcupine

AccessKey

Porcupine requires a valid Picovoice AccessKey at initialization. AccessKey acts as your credentials when using Porcupine 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 pvporcupine

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

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://console.picovoice.ai/)

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://console.picovoice.ai/)
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://console.picovoice.ai/)

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-3.0.3.tar.gz (2.4 MB view details)

Uploaded Source

Built Distribution

pvporcupine-3.0.3-py3-none-any.whl (2.4 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pvporcupine-3.0.3.tar.gz
  • Upload date:
  • Size: 2.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.5

File hashes

Hashes for pvporcupine-3.0.3.tar.gz
Algorithm Hash digest
SHA256 28e647b02b7472e72702f0664c024808c5cb98f22ea7c557882b01e8966e9d42
MD5 6a9a18a20e3414d6262ba2f0fdf0d833
BLAKE2b-256 7d42ae475e99c0d8d4730cd56c1a4a06b8fb05eb2df4c427838cf39c338ea9b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pvporcupine-3.0.3-py3-none-any.whl
  • Upload date:
  • Size: 2.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.5

File hashes

Hashes for pvporcupine-3.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b5150aa0ec2d2fc5a6a9f1b16e6b7c81ebad933c76fecaede9cd7e3d54ed7b63
MD5 856a9ede09700f16f8c4caec46b56838
BLAKE2b-256 03c3e80f3e0cc081287daa439d2d2200d500a44f7a2bfd0efe1c55ecafa2121d

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