Skip to main content

Porcupine wake word engine demos

Project description

Porcupine Wake Word Engine Demos

Made in Vancouver, Canada by Picovoice

This package contains demos and commandline utilities for processing real-time audio (i.e. microphone) and audio files using Porcupine wake word engine.

Porcupine

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 making it perfect for IoT.
  • scalable. It can detect multiple always-listening voice commands with no added CPU/memory footprint.
  • self-service. Developers can train custom wake phrases using Picovoice Console.

Compatibility

  • Python 3.8+
  • Runs on Linux (x86_64), Mac (x86_64 and arm64), Windows (x86_64), and Raspberry Pi (Zero, 3, 4, 5).

Installation

sudo pip3 install pvporcupinedemo

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

Microphone Demo

It opens an audio stream from a microphone and detects utterances of a given wake word. The following opens the default microphone and detects occurrences of "Picovoice".

porcupine_demo_mic --access_key ${ACCESS_KEY} --keywords picovoice

keywords is a shorthand for using default keyword files shipped with the package. The list of default keyword files can be seen in the usage string

porcupine_demo_mic --help

To detect multiple phrases concurrently provide them as separate arguments

porcupine_demo_mic --access_key ${ACCESS_KEY} --keywords picovoice porcupine

To detect non-default keywords (e.g. models created using Picovoice Console) use keyword_paths argument

porcupine_demo_mic --access_key ${ACCESS_KEY} --keyword_paths ${KEYWORD_PATH_ONE} ${KEYWORD_PATH_TWO}

To detect non-English keywords provide the respective model path:

porcupine_demo_mic --access_key ${ACCESS_KEY} --model_path ${NON_ENGLISH_MODEL_PATH} --keyword_paths ${NON_ENGLISH_KEYWORD_PATH}

The model files for all supported languages are available here on Porcupine's GitHub repository.

It is possible that the default audio input device recognized by the demo is not the one being used. There are a couple of debugging facilities baked into the demo application to solve this. First, type the following into the console:

porcupine_demo_mic --show_audio_devices

It provides information about various audio input devices on the box. On a Linux box, this is the console output

index: 0, device name: USB Audio Device
index: 1, device name: MacBook Air Microphone

You can use the device index to specify which microphone to use for the demo. For instance, if you want to use the USB Audio Device in the above example, you can invoke the demo application as below:

porcupine_demo_mic --access_key ${ACCESS_KEY} --keywords picovoice --audio_device_index 0

If the problem persists we suggest storing the recorded audio into a file for inspection. This can be achieved by

porcupine_demo_mic --access_key ${ACCESS_KEY} --keywords picovoice --audio_device_index 0 --output_path ~/test.wav

If after listening to stored file there is no apparent problem detected please open an issue.

File Demo

It allows testing Porcupine on a corpus of audio files. The demo is mainly useful for quantitative performance benchmarking. It accepts 16kHz audio files. Porcupine processes a single-channel audio stream if a stereo file is provided it only processes the first (left) channel. The following processes a file looking for instances of the phrase "Picovoice"

porcupine_demo_file --access_key ${ACCESS_KEY} --wav_path ${AUDIO_PATH} --keywords picovoice

keywords is a shorthand for using default keyword files shipped with the package. The list of default keyword files can be seen in the usage string

porcupine_demo_file --help

To detect multiple phrases concurrently provide them as separate arguments

porcupine_demo_file --access_key ${ACCESS_KEY} --wav_path ${AUDIO_PATH} --keywords grasshopper porcupine

To detect non-default keywords (e.g. models created using Picovoice Console) use keyword_paths argument

porcupine_demo_file --access_key ${ACCESS_KEY} \
--wav_path ${AUDIO_PATH} \
--keyword_paths ${KEYWORD_PATH_ONE} ${KEYWORD_PATH_TWO}

To detect non-English keywords provide the respective model path:

porcupine_demo_mic --access_key ${ACCESS_KEY} \
--wav_path ${AUDIO_PATH} \
--model_path ${NON_ENGLISH_MODEL_PATH} \
--keyword_paths ${NON_ENGLISH_KEYWORD_PATH} 

The model files for all supported languages are available here on Porcupine's GitHub repository.

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

porcupine_demo_file --access_key ${ACCESS_KEY} \
--wav_path ${AUDIO_PATH} \
--keywords grasshopper porcupine --sensitivities 0.3 0.6

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.

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

pvporcupinedemo-3.0.3.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

pvporcupinedemo-3.0.3-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pvporcupinedemo-3.0.3.tar.gz
Algorithm Hash digest
SHA256 ab3617e1b127b430778755609b2337f415f443b660a7d6bc3d6f57829c5ae651
MD5 fff422825213ab2ed8f0d4256bc07e8e
BLAKE2b-256 e8252d2f4adccba62e9001b2cbdb3a4a0777b306e5829b384b67ee2279ab171e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pvporcupinedemo-3.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3e30931ff123dae89ae872e333541d97b238baed8eeb309245a28b8ed13fd1f6
MD5 6e1f64bb43bc924553cfff8149a1b575
BLAKE2b-256 b134fbbe29665e4914794d3b5874481c4b6b591bc619d9ecefce99a5515502f1

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