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
AndroidCiOSPythonWeb
AndroidCiOSPythonWeb
SummaryPicovoice KoalaMozilla RNNoise
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 — iOS API


API Reference for the iOS Picovoice SDK (Cocoapod )


Picovoice

public class Picovoice { }

Class for Picovoice. Picovoice can be initialized either using the High-level PicovoiceManager() Class or directly using the class constructor. Resources should be cleaned when you are done using the delete() function.


Picovoice.init()

init methods for Picovoice.

public init (
accessKey: String,
keywordPath: String,
onWakeWordDetection: @escaping (() -> Void),
contextPath: String,
onInference: @escaping ((Inference) -> Void),
porcupineModelPath: String? = nil,
porcupineSensitivity: Float32 = 0.5,
rhinoModelPath: String? = nil,
rhinoSensitivity: Float32 = 0.5,
endpointDurationSec: Float32 = 1.0,
requireEndpoint: Bool = true) throws

Parameters

  • accessKey String : The AccessKey obtained from Picovoice Console .
  • keywordPath String : Absolute path to keyword model file (.ppn).
  • onWakeWordDetection (() -> Void) : A callback that is invoked upon detection of the keyword.
  • contextPath String : Absolute path to file containing context parameters (.rhn). A context represents the set of expressions (spoken commands), intents, and intent arguments (slots) within a domain of interest.
  • onInference (Inference) -> Void) : A callback that is invoked upon completion of intent inference.
  • porcupineModelPath String? : Absolute path to file containing Porcupine model parameters (.pv).
  • porcupineSensitivity Float32 : Sensitivities for detecting keywords. Each value should be a number within [0, 1]. A higher sensitivity results in fewer misses at the cost of increasing the false alarm rate.
  • rhinoModelPath String? : Absolute path to file containing Rhino model parameters (.pv).
  • rhinoSensitivity Float32 : 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.
  • endpointDurationSec Float32 : 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 : 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).

Throws

  • PicovoiceError: If an error occurs while creating an instance of Picovoice.

Picovoice.delete()

Releases resources acquired by Picovoice.

public func delete()

Picovoice.process()

Process a frame of audio with the Picovoice platform.

public func process(pcm:[Int16]) throws

Parameters

  • pcm [Int16] : An array of 16-bit pcm samples.

Throws

  • PicovoiceError : If there is an error while processing the audio frame.

Picovoice.contextInfo

public var contextInfo: String

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.frameLength

public static let frameLength: UInt32

The number of audio samples per frame.


Picovoice.sampleRate

public static let sampleRate: UInt32

Audio sample rate accepted by Picovoice.


Picovoice.picovoiceVersion

public static let picovoiceVersion: String

Current Picovoice version.


Picovoice.porcupineVersion

public static let porcupineVersion: String

Current Porcupine version.


Picovoice.rhinoVersion

public static let rhinoVersion: String

Current Rhino version.


PicovoiceManager

A High-level iOS binding for Picovoice that handles recording audio from microphone, processes it in real-time, and notifies the client upon detection of the wake word or completion of in voice command inference.

public class PicovoiceManager { }

PicovoiceManager.init()

public init(
accessKey: String,
keywordPath: String,
onWakeWordDetection: @escaping (() -> Void),
contextPath: String,
onInference: @escaping ((Inference) -> Void),
porcupineModelPath: String? = nil,
porcupineSensitivity: Float32 = 0.5,
rhinoModelPath: String? = nil,
rhinoSensitivity: Float32 = 0.5,
requireEndpoint: Bool = true,
endpointDurationSec: Float32 = 1.0,
processErrorCallback: ((Error) -> Void)? = nil)

Parameters

  • accessKey String : The AccessKey obtained from Picovoice Console .
  • keywordPath String : Absolute path to keyword model file (.ppn).
  • onWakeWordDetection (() -> Void) : A callback that is invoked upon detection of the keyword.
  • contextPath String : Absolute path to file containing context parameters (.rhn). A context represents the set of expressions (spoken commands), intents, and intent arguments (slots) within a domain of interest.
  • onInference ((Inference) -> Void) : A callback that is invoked upon completion of intent inference.
  • porcupineModelPath String? : Absolute path to file containing Porcupine model parameters (.pv).
  • porcupineSensitivity Float32 : Sensitivity for detecting keywords. Each value should be a number within [0, 1]. A higher sensitivity results in fewer misses at the cost of increasing the false alarm rate.
  • rhinoModelPath String? : Absolute path to file containing Rhino model parameters (.pv).
  • rhinoSensitivity Float32 : 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.
  • endpointDurationSec Float32 : 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 : 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 ((Error) -> Void)? = nil) : A callback that is invoked if an error occurs while processing frames. If missing, error will be printed to console.

Throws

  • PicovoiceError : If an error occurs while creating an instance of Picovoice.

PicovoiceManager.start()

public func start() throws

Starts recording audio from the microphone and Picovoice processing loop.

Throws

  • PicovoiceError : If microphone permission is not granted.

PicovoiceManager.stop()

public func stop()

Stop audio recording and processing loop.


PicovoiceError

public class PicovoiceError : LocalizedError { }

Error thrown if an error occurs within Picovoice.

public class PicovoiceMemoryError : PicovoiceError {}
public class PicovoiceIOError : PicovoiceError {}
public class PicovoiceInvalidArgumentError : PicovoiceError {}
public class PicovoiceStopIterationError : PicovoiceError {}
public class PicovoiceKeyError : PicovoiceError {}
public class PicovoiceInvalidStateError : PicovoiceError {}
public class PicovoiceRuntimeError : PicovoiceError {}
public class PicovoiceActivationError : PicovoiceError {}
public class PicovoiceActivationLimitError : PicovoiceError {}
public class PicovoiceActivationThrottledError : PicovoiceError {}
public class PicovoiceActivationRefusedError : PicovoiceError {}

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Picovoice Platform — iOS API
  • Picovoice
  • init()
  • delete()
  • process()
  • contextInfo
  • frameLength
  • sampleRate
  • picovoiceVersion
  • porcupineVersion
  • rhinoVersion
  • PicovoiceManager
  • init()
  • start()
  • stop()
  • PicovoiceError
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.