Picovoice Wordmark
Start Building
Introduction
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryPicovoice picoLLMGPTQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-TextWhisper Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustWeb
SummaryPicovoice Cheetah
FAQ
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryAmazon PollyAzure TTSElevenLabsOpenAI TTSPicovoice Orca
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice KoalaMozilla RNNoise
Introduction
AndroidCiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidCNode.jsPythoniOSWeb
SummaryPicovoice EaglepyannoteSpeechBrainWeSpeaker
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice FalconAmazon TranscribeAzure Speech-to-TextGoogle Speech-to-Textpyannote
Introduction
AndroidArduinoCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSMicrocontrollerNode.jsPythonRaspberry PiReactReact NativeRustSafariUnityWebWindows
AndroidC.NETFlutteriOSJavaMicrocontrollerNode.jsPythonReactReact NativeRustUnityWeb
SummaryPorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustSafariUnityWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustUnityWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiRustWebWindows
AndroidC.NETiOSNode.jsPythonRustWeb
SummaryPicovoice CobraWebRTC VAD
FAQ
Introduction
AndroidC.NETFlutteriOSNode.jsPythonReact NativeRustUnityWeb
AndroidC.NETFlutteriOSNode.jsPythonReact NativeRustUnityWeb
Introduction
C.NETNode.jsPython
C.NETNode.jsPython
FAQGlossary

Porcupine Wake Word
Flutter API

API Reference for the Porcupine Flutter SDK (pub.dev) .


Porcupine

class Porcupine { }

Class for the Porcupine Wake Word engine. Porcupine can be initialized either using the High-level PorcupineManager() Class or directly using the creator. Resources should be cleaned when you are done using the delete() function.

Use this class when using a custom audio processing pipeline. Otherwise it is recommended to use the PorcupineManager High-Level API, which contains integrated audio recording.

Porcupine.version

String get version

Getter for Porcupine version string.


Porcupine.frameLength

int get frameLength

Getter for the number of audio samples per frame required by Porcupine.


Porcupine.sampleRate

int get sampleRate

Getter for the audio sample rate required by Porcupine.


Porcupine.fromBuiltInKeywords()

Static creator for initializing Porcupine from a selection of built-in keywords.

static Future<Porcupine> fromBuiltInKeywords(
String accessKey,
List<BuiltInKeyword> keywords,
{String? modelPath,
List<double>? sensitivities}
)

Parameters

  • accessKey String : AccessKey obtained from Picovoice Console.
  • keywords List<BuiltInKeyword> : A List of (phrases) for detection. The list of available keywords can be retrieved using BuiltInKeyword enum.
  • modelPath String? : Path to the file containing model parameters (.pv). Can be either a path that is relative to the project's assets folder or an absolute path to the file on device. If not set it will be set to the default location.
  • sensitivities List<double>? : sensitivity values for each keyword model. A higher sensitivity reduces miss rate at the cost of potentially higher false alarm rate. Sensitivity should be a floating-point number within 0 and 1.

Returns

  • Future<Porcupine> an instance of Porcupine Wake Word engine.

Throws

  • a PorcupineException if not initialized correctly.

Porcupine.fromKeywordPaths()

Static creator for initializing Porcupine from a list of paths to custom keyword files.

static Future<Porcupine> fromKeywordPaths(
String accessKey,
List<String> keywordPaths,
{String? modelPath,
List<double>? sensitivities}
)

Parameters

  • accessKey String : AccessKey obtained from Picovoice Console.
  • keywordPaths List<String> : A List of paths to keyword files (.ppn). Can be either paths that are relative to the project's assets folder or absolute paths to the files on device.
  • modelPath String? : Path to the file containing model parameters (.pv). Can be either a path that is relative to the project's assets folder or an absolute path to the file on device. If not set it will be set to the default location.
  • sensitivities List<double>? : sensitivity values for each keyword model. A higher sensitivity reduces miss rate at the cost of potentially higher false alarm rate. Sensitivity should be a floating-point number within 0 and 1.

Returns

  • Future<Porcupine> an instance of the Porcupine Wake Word engine.

Throws

  • PorcupineException : If not initialized correctly.

Porcupine.process()

Process a frame of audio with the Porcupine Wake Word engine.

Future<int> process(List<int>? frame)

Parameters

  • frame List<int>? : a frame of audio samples to be assessed by Porcupine. The required audio format is found by calling .sampleRate to get the required sample rate and .frameLength to get the required frame size. Audio must be single-channel and 16-bit linearly-encoded.

Returns

  • int : Index of the detected keyword, or -1 if no detection occurred.

Throws

  • PorcupineException : If process fails.

Porcupine.delete()

Frees memory that was allocated for Porcupine.

Future<void> delete()

BuiltInKeyword

enum BuiltInKeyword {
ALEXA,
AMERICANO,
BLUEBERRY,
BUMBLEBEE,
COMPUTER,
GRAPEFRUIT,
GRASSHOPPER,
HEY_GOOGLE,
HEY_SIRI,
JARVIS,
OK_GOOGLE,
PICOVOICE,
PORCUPINE,
TERMINATOR
}

Enum of available built-in keywords for Porcupine Wake Word engine.


PorcupineManager

Manager for creating an instance of Porcupine. A High-level Flutter binding for Porcupine Wake Word engine that handles recording audio from microphone, processes it in real-time using Porcupine, and notifies the client when any of the given keywords are detected.

class PorcupineManager { }

PorcupineManager.fromBuiltInKeywords

Static creator for initializing PorcupineManager from a selection of built-in keywords.

static Future<PorcupineManager> fromBuiltInKeywords(
String accessKey,
List<BuiltInKeyword> keywords,
WakeWordCallback wakeWordCallback,
{String? modelPath,
List<double>? sensitivities,
ErrorCallback? errorCallback}
)

Parameters

  • accessKey String : AccessKey obtained from Picovoice Console.
  • keywords List<BuiltInKeyword> : A List of (phrases) for detection. The list of available keywords can be retrieved using BuiltInKeyword enum.
  • wakeWordCallback WakeWordCallback : A callback that is triggered when one of the given keywords has been detected by Porcupine
  • modelPath String? : Path to the file containing model parameters (.pv). Can be either a path that is relative to the project's assets folder or an absolute path to the file on device. If not set it will be set to the default location.
  • sensitivities List<double>? : sensitivities for each keyword model. A higher sensitivity reduces miss rate at the cost of potentially higher false alarm rate. Sensitivity should be a floating-point number within 0 and 1.
  • errorCallback ErrorCallback : An optional callback that triggers if Porcupine experiences a problem while processing audio

Returns

  • Future<PorcupineManager> an instance of PorcupineManager.

Throws

  • PorcupineException if not initialized correctly.

PorcupineManager.fromKeywordPaths()

Static creator for initializing PorcupineManager from a list of paths to custom keyword files.

static Future<PorcupineManager> fromKeywordPaths(
String accessKey,
List<String> keywordPaths,
WakeWordCallback wakeWordCallback,
{String? modelPath,
List<double>? sensitivities,
ErrorCallback? errorCallback}
)

Parameters

  • accessKey String : AccessKey obtained from Picovoice Console.
  • keywordPaths List<String> : A List of paths to keyword files (.ppn). Can be either paths that are relative to the project's assets folder or absolute paths to the files on device.
  • wakeWordCallback WakeWordCallback : A callback that is triggered when one of the given keywords has been detected by Porcupine.
  • modelPath String? : Path to the file containing model parameters (.pv). Can be either a path that is relative to the project's assets folder or an absolute path to the file on device. If not set it will be set to the default location.
  • sensitivities List<double>? : sensitivities for each keyword model. A higher sensitivity reduces miss rate at the cost of potentially higher false alarm rate. Sensitivity should be a floating-point number within 0 and 1.
  • errorCallback ErrorCallback : An optional callback that triggers if Porcupine experiences a problem while processing audio.

Returns

  • Future<PorcupineManager> an instance of PorcupineManager.

Throws

  • PorcupineException if not initialized correctly.

PorcupineManager.start()

Opens audio input stream and sends audio frames to Porcupine.

Future<void> start()

Throws

  • a PvAudioException if there was a problem starting the audio engine.

PorcupineManager.stop()

Closes audio stream.

Future<void> stop()

PorcupineManager.delete()

Releases Porcupine and audio resources.

Future<void> delete()

WakeWordCallback

Type for function that that is triggered when one of the given keywords has been detected by Porcupine.

typedef WakeWordCallback = Function(int keywordIndex);

Parameters

  • keywordIndex int : Index of the detected keyword, or -1 if no detection occurred.

ErrorCallback

Type for the error callback that occurs while processing audio.

typedef ErrorCallback = Function(PorcupineException error);

Parameters

  • error PorcupineException

PorcupineException

class PorcupineException implements Exception {}

Exception thrown if an error occurs within Porcupine Wake Word engine:

class PorcupineMemoryException extends PorcupineException { }
class PorcupineIOException extends PorcupineException { }
class PorcupineInvalidArgumentException extends PorcupineException { }
class PorcupineStopIterationException extends PorcupineException { }
class PorcupineKeyException extends PorcupineException { }
class PorcupineInvalidStateException extends PorcupineException { }
class PorcupineRuntimeException extends PorcupineException { }
class PorcupineActivationException extends PorcupineException { }
class PorcupineActivationLimitException extends PorcupineException { }
class PorcupineActivationThrottledException extends PorcupineException { }
class PorcupineActivationRefusedException extends PorcupineException { }

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Porcupine Wake Word Flutter API
  • Porcupine
  • version
  • frameLength
  • sampleRate
  • fromBuiltInKeywords()
  • fromKeywordPaths()
  • process()
  • delete()
  • BuiltInKeyword
  • PorcupineManager
  • fromBuiltInKeywords
  • fromKeywordPaths()
  • start()
  • stop()
  • delete()
  • WakeWordCallback
  • ErrorCallback
  • PorcupineException
Voice AI
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Orca Text-to-Speech
  • Koala Noise Suppression
  • Eagle Speaker Recognition
  • Falcon Speaker Diarization
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Local LLM
  • picoLLM Inference
  • picoLLM Compression
  • picoLLM GYM
Resources
  • Docs
  • Console
  • Blog
  • Use Cases
  • Playground
Sales & Services
  • Consulting
  • Foundation Plan
  • Enterprise Plan
  • Enterprise Support
Company
  • About us
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • X
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2025 Picovoice Inc.