Package: pvporcupine
Porcupine Wake Word EngineMade in Vancouver, Canada byPicovoicePorcupine is a highly-accurate and lightweight wake word engine. It enables building always-listening voice-enabled
applications. It isusing 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 RTRaspberry Pi, NVIDIA Jetson Nano, and BeagleBoneAndroid and iOSChrome, Safari, Firefox, and EdgeLinux (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 usingPicovoice Console.CompatibilityPython 3.5+Runs on Linux (x86_64), macOS (x86_64 and arm64), Windows (x86_64), Raspberry Pi, NVIDIA Jetson (Nano), and BeagleBone.Installationpip3 install pvporcupineAccessKeyPorcupine requires a valid PicovoiceAccessKeyat initialization.AccessKeyacts as your credentials when using Porcupine SDKs.
You can get yourAccessKeyfor free. Make sure to keep yourAccessKeysecret.
Signup or Login toPicovoice Consoleto get yourAccessKey.UsageCreate an instance of the engineimportpvporcupineaccess_key="${ACCESS_KEY}"# AccessKey obtained from Picovoice Console (https://console.picovoice.ai/)handle=pvporcupine.create(access_key=access_key,keywords=['picovoice'])handleis an instance of Porcupine that detects utterances of "Picovoice".keywordsinput argument is a shorthand
for accessing default keyword model files shipped with the package. The list of default keywords can be retrieved byimportpvporcupineprint(pvporcupine.KEYWORDS)Porcupine can detect multiple keywords concurrentlyimportpvporcupineaccess_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 usekeyword_pathsinput argument insteadimportpvporcupineaccess_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 thesensitivitiesinput argumentimportpvporcupineaccess_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 byhandle.sample_rate. Expected frame length (number of audio samples
in an input array) ishandle.frame_length. The engine accepts 16-bit linearly-encoded PCM and operates on
single-channel audio.defget_next_audio_frame():passwhileTrue:keyword_index=handle.process(get_next_audio_frame())ifkeyword_index>=0:# detection event logic/callbackpassWhen done resources have to be released explicitlyhandle.delete()Non-English Wake WordsIn order to detect non-English wake words you need to use the corresponding model file. The model files for all supported languages are availablehere.Demospvporcupinedemoprovides command-line utilities for processing real-time
audio (i.e. microphone) and files using Porcupine.