Picovoice WordmarkPicovoice Console
Introduction
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSNodejsPythonRaspberry PiReact NativeRustWebWindows
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
AndroidC.NETFlutterlink to GoiOSJavaNodejsPythonReact NativeRustWeb
FAQ
Introduction
AndroidCiOSLinuxmacOSPythonWebWindows
AndroidCiOSPythonWeb
SummaryOctopus Speech-to-IndexGoogle Speech-to-TextMozilla DeepSpeech
FAQ
Introduction
AndroidAngularArduinoBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonLinuxmacOSMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaMicrocontrollerNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidAngularBeagleBoneCChrome.NETEdgeFirefoxFlutterlink to GoiOSJavaNvidia JetsonlinuxmacOSNodejsPythonRaspberry PiReactReact NativeRustSafariUnityVueWebWindows
AndroidAngularC.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidBeagleboneCiOSNvidia JetsonLinuxmacOSPythonRaspberry PiRustWebWindows
AndroidCiOSPythonRustWeb
SummaryPicovoice CobraWebRTC VAD
FAQ
Introduction
AndroidAngularArduinoBeagleBoneC.NETFlutterlink to GoiOSJavaNvidia JetsonMicrocontrollerNodejsPythonRaspberry PiReactReact NativeRustUnityVueWeb
AndroidAngularCMicrocontroller.NETFlutterlink to GoiOSJavaNodejsPythonReactReact NativeRustUnityVueWeb
Picovoice SDK - FAQ
IntroductionSTM32F407G-DISC1 (Arm Cortex-M4)STM32F411E-DISCO (Arm Cortex-M4)STM32F769I-DISCO (Arm Cortex-M7)IMXRT1050-EVKB (Arm Cortex-M7)
FAQGlossary

Picovoice Platform — Flutter API


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


Picovoice

class Picovoice { }

Class for the Picovoice platform. Picovoice can be initialized either using the High-level PicovoiceManager() 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 PicovoiceManager High-Level API, which contains integrated audio recording.

Picovoice.frameLength

int get frameLength

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


Picovoice.sampleRate

int get sampleRate

Getter for the audio sample rate required by Picovoice.


Picovoice.version

String get version

Getter for Picovoice version string.


Picovoice.porcupineVersion

String get porcupineVersion

Getter for the internal Porcupine version string.


Picovoice.rhinoVersion

String get rhinoVersion

Getter for the internal Rhino version string.


Picovoice.contextInfo

String? get contextInfo

Gets the source of the Rhino context in YAML format. Shows the list of intents, which expressions map to those intents, as well as slots and their possible values.


Picovoice.create()

Static creator for initializing Picovoice.

static create(
String accessKey,
String keywordPath,
WakeWordCallback wakeWordCallback,
String contextPath,
InferenceCallback inferenceCallback,
{double porcupineSensitivity = 0.5,
double rhinoSensitivity = 0.5,
String? porcupineModelPath,
String? rhinoModelPath,
double endpointDurationSec = 1.0,
bool requireEndpoint = true})

Parameters

  • accessKey String : AccessKey obtained from Picovoice Console.
  • keywordPath String : Path to keyword model file (.ppn). Can be either a path that is relative to the project's assets folder or an absolute path to the file on device.
  • wakeWordCallback WakeWordCallback : User-defined callback invoked upon detection of the wake phrase. The callback accepts no input arguments
  • contextPath String : Path to the Rhino context file (.rhn). Can be either a path that is relative to the project's assets folder or an absolute path to the file on device.
  • inferenceCallback InferenceCallback : User-defined callback invoked upon completion of intent inference. The callback accepts a single input argument of type RhinoInference.
  • porcupineSensitivity double? : (Optional) Wake word detection sensitivity. It should be a number within [0, 1]. A higher sensitivity results in fewer misses at the cost of increasing the false alarm rate.
  • rhinoSensitivity double? : (Optional) Inference sensitivity. It should be a number within [0, 1]. A higher sensitivity value results in fewer misses at the cost of(potentially) increasing the erroneous inference rate.
  • porcupineModelPath String? : (Optional) Path to the file containing Porcupine's 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.
  • rhinoModelPath String? : (Optional) Path to the file containing Rhino's 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. If not set it will be set to the default location.
  • endpointDurationSec double? : (Optional) Endpoint duration in seconds. An endpoint is a chunk of silence at the end of an utterance that marks the end of spoken command. It should be a positive number within [0.5, 5]. A lower endpoint duration reduces delay and improves responsiveness. A higher endpoint duration assures Rhino doesn't return inference pre-emptively in case the user pauses before finishing the request.
  • requireEndpoint bool? : (Optional) If set to true, Rhino requires an endpoint (a chunk of silence) after the spoken command. If set to false, Rhino tries to detect silence, but if it cannot, it still will provide inference regardless. Set to false only if operating in an environment with overlapping speech (e.g. people talking in the background).

Returns

  • [Picovoice](#picovoice) an instance of the Picovoice platform.

Throws

  • PicovoiceException : If not initialized correctly.

Picovoice.process()

Processes a frame of the incoming audio stream. Upon detection of wake word and completion of follow-on command inference invokes user-defined callbacks.

void process(List<int> frame)

Parameters

  • frame List<int> : a frame of audio samples to be assessed by Picovoice. 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.

Throws

  • PicovoiceException : If process fails.

Picovoice.delete()

Release the resources acquired by Picovoice (via Porcupine and Rhino engines).

void delete()

PicovoiceManager

Manager for creating an instance of Picovoice. A High-level Flutter binding for Picovoice platform that handles recording audio from microphone, processes it in real-time.

class PicovoiceManager { }

PicovoiceManager.create()

Static creator for initializing Picovoice.

static create(
String accessKey,
String keywordPath,
WakeWordCallback wakeWordCallback,
String contextPath,
InferenceCallback inferenceCallback,
{double porcupineSensitivity = 0.5,
double rhinoSensitivity = 0.5,
String? porcupineModelPath,
String? rhinoModelPath,
double endpointDurationSec = 1.0,
bool requireEndpoint = true,
ProcessErrorCallback? processErrorCallback})

Parameters

  • accessKey String : AccessKey obtained from Picovoice Console.
  • keywordPath String : Path to keyword model file (.ppn). Can be either a path that is relative to the project's assets folder or an absolute path to the file on device.
  • wakeWordCallback WakeWordCallback : User-defined callback invoked upon detection of the wake phrase. The callback accepts no input arguments
  • contextPath String : Path to the Rhino context file (.rhn). Can be either a path that is relative to the project's assets folder or an absolute path to the file on device.
  • inferenceCallback InferenceCallback : User-defined callback invoked upon completion of intent inference. The callback accepts a single input argument of type RhinoInference.
  • porcupineSensitivity double? : (Optional) Wake word detection sensitivity. It should be a number within [0, 1]. A higher sensitivity results in fewer misses at the cost of increasing the false alarm rate.
  • rhinoSensitivity double? : (Optional) Inference sensitivity. It should be a number within [0, 1]. A higher sensitivity value results in fewer misses at the cost of(potentially) increasing the erroneous inference rate.
  • porcupineModelPath String? : (Optional) Path to the file containing Porcupine's 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.
  • rhinoModelPath String? : (Optional) Path to the file containing Rhino's 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. If not set it will be set to the default location. set it will be set to the default location (.pv).
  • endpointDurationSec double? : (Optional) Endpoint duration in seconds. An endpoint is a chunk of silence at the end of an utterance that marks the end of spoken command. It should be a positive number within [0.5, 5]. A lower endpoint duration reduces delay and improves responsiveness. A higher endpoint duration assures Rhino doesn't return inference pre-emptively in case the user pauses before finishing the request.
  • requireEndpoint bool? : (Optional) If set to true, Rhino requires an endpoint (a chunk of silence) after the spoken command. If set to false, Rhino tries to detect silence, but if it cannot, it still will provide inference regardless. Set to false only if operating in an environment with overlapping speech (e.g. people talking in the background).
  • processErrorCallback ProcessErrorCallback : Reports errors that are encountered while the engine is processing audio.

Returns

  • PicovoiceManager an instance of PicovoiceManager.

Throws

  • PicovoiceException : If not initialized correctly.

PicovoiceManager.start()

Opens audio input stream and sends audio frames to Picovoice.

Future<void> start()

Throws

  • PicovoiceException : If an instance of Picovoice could not be created.

PicovoiceManager.stop()

Closes audio stream and stops Picovoice processing.

Future<void> stop()

ProcessErrorCallback

Type for the error callback that occurs while processing audio.

typedef ProcessErrorCallback = Function(PicovoiceException error);

Parameters

  • error PicovoiceException

PicovoiceException

class PicovoiceException implements Exception { }

Exception thrown if an error occurs within Picovoice:

class PicovoiceMemoryException extends PicovoiceException { }
class PicovoiceIOException extends PicovoiceException { }
class PicovoiceInvalidArgumentException extends PicovoiceException { }
class PicovoiceStopIterationException extends PicovoiceException { }
class PicovoiceKeyException extends PicovoiceException { }
class PicovoiceInvalidStateException extends PicovoiceException { }
class PicovoiceRuntimeException extends PicovoiceException { }
class PicovoiceActivationException extends PicovoiceException { }
class PicovoiceActivationLimitException extends PicovoiceException { }
class PicovoiceActivationThrottledException extends PicovoiceException { }
class PicovoiceActivationRefusedException extends PicovoiceException { }

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Picovoice Platform — Flutter API
  • Picovoice
  • frameLength
  • sampleRate
  • version
  • porcupineVersion
  • rhinoVersion
  • contextInfo
  • create()
  • process()
  • delete()
  • PicovoiceManager
  • create()
  • start()
  • stop()
  • ProcessErrorCallback
  • PicovoiceException
Platform
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Octopus Speech-to-Index
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Resources
  • Docs
  • Console
  • Blog
  • Demos
Sales
  • Pricing
  • Starter Tier
  • Enterprise
Company
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • Twitter
  • Medium
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2022 Picovoice Inc.