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, and Arduino
    • 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, arm64)
  • 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.9+
  • Runs on Linux (x86_64), macOS (x86_64 and arm64), Windows (x86_64, arm64), 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.

Non-English Contexts

In order to run inference on non-English contexts you need to use the corresponding model file. The model files for all supported languages are available here.

Train Models over API

You can train models over API without going to the console:

train_wake_word_from_phrase(
        "${ACCESS_KEY}",                             # AccessKey obtained from Picovoice Console (https://console.picovoice.ai/)
        "${OUTPUT_PATH}",                            # Path to save the newly trained model
        "${LANGUAGE}",                               # Two-character language code
        "${PHRASE}",                                 # Phrase to create a wake word from
        "${PLATFORM}")                               # Optional platform for the trained model. If None, the default(current) platform is used.

Check Porcupine Model API docs for a list of supported languages and platforms.

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

Uploaded Source

Built Distribution

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

pvporcupine-4.0.3-py3-none-any.whl (3.7 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pvporcupine-4.0.3.tar.gz
  • Upload date:
  • Size: 3.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pvporcupine-4.0.3.tar.gz
Algorithm Hash digest
SHA256 87d0e4d743a13c3a15b1fb34a9ced66e14bb1125ae079f2e2c09423364a68386
MD5 5b3a32bc0608db17f96d5d7e7e05a2a4
BLAKE2b-256 b237db209e19c4e1d931d1752bdf05c763f119271bb79661d482bdf5f564f662

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pvporcupine-4.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pvporcupine-4.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 92796dbd3cf80a56db1ce20702cbceb151aee34f19ef730591f815eb16f2ebfb
MD5 f4db66fcbc4f54ca25b0a790cd60b38a
BLAKE2b-256 2aef1c4b8e47d8248fe1b615772028265ca65d9ff3ea98022d84cd973d46db87

See more details on using hashes here.

Supported by

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