Skip to main content

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.

Release files for pvporcupine 4.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pvporcupine 4.0.3
File Size Uploaded
pvporcupine-4.0.3.tar.gz 3.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pvporcupine 4.0.3
File Interpreter ABI Platform
pvporcupine-4.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 7.3 MB

Release files / pvporcupine-4.0.3.tar.gz

Download URL pvporcupine-4.0.3.tar.gz
Size 3.6 MB
Tags Source
SHA-256 checksum
How to use checksums
87d0e4d743a13c3a15b1fb34a9ced66e14bb1125ae079f2e2c09423364a68386
BLAKE2b-256 checksum
How to use checksums
b237db209e19c4e1d931d1752bdf05c763f119271bb79661d482bdf5f564f662
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / pvporcupine-4.0.3-py3-none-any.whl

Download URL pvporcupine-4.0.3-py3-none-any.whl
Size 3.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
92796dbd3cf80a56db1ce20702cbceb151aee34f19ef730591f815eb16f2ebfb
BLAKE2b-256 checksum
How to use checksums
2aef1c4b8e47d8248fe1b615772028265ca65d9ff3ea98022d84cd973d46db87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

4.0.3 This release

2 release files

4.0.2

2 release files

4.0.1

2 release files

4.0.0

2 release files

3.0.5

2 release files

3.0.4

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.4

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.9.5

2 release files

1.9.4

2 release files

1.9.3

2 release files

1.9.2

2 release files

1.9.1

2 release files

1.9.0

2 release files

1.8.7

2 release files

1.8.6

2 release files

1.8.5

2 release files

1.8.4

2 release files

1.8.3

2 release files

1.8.2

2 release files

1.8.1

1 release file

1.8.0

1 release file

1.7.0

2 release files

1.6.3

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release 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