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
iOS API

API Reference for the iOS Porcupine SDK (Cocoapod)


Porcupine

public class Porcupine { }

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


Porcupine.init()

init methods for Porcupine Wake Word engine with a mixture of arguments.

public init(accessKey: String, keywordPaths: [String], modelPath:String? = nil, sensitivities: [Float32]? = nil)

Parameters

  • accessKey String : The AccessKey obtained from Picovoice Console.
  • keywordPaths [String] : Absolute paths to keyword model files (.ppn).
  • modelPath String? : Absolute path to file containing model parameters (.pv).
  • sensitivities [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.

Throws

  • PorcupineError: If an error occurs while creating an instance of Porcupine Wake Word engine.
public convenience init(accessKey: String, keywordPath: String, modelPath:String? = nil, sensitivity: Float32 = 0.5)

Parameters

  • accessKey String : The AccessKey obtained from Picovoice Console.
  • keywordPath String : Absolute path to a keyword model file (.ppn).
  • modelPath String? : Absolute path to file containing model parameters (.pv).
  • sensitivity Float32? : Sensitivity for detecting keyword, which should be a number within [0, 1]. A higher sensitivity results in fewer misses at the cost of increasing the false alarm rate.

Throws

  • PorcupineError: If an error occurs while creating an instance of Porcupine Wake Word engine.
public convenience init(accessKey: String, keywords:[Porcupine.BuiltInKeyword], modelPath:String? = nil, sensitivities: [Float32]? = nil)

Parameters

  • accessKey String : The AccessKey obtained from Picovoice Console.
  • keywords [Porcupine.BuiltInKeyword] : An array of built-in keywords from the Porcupine.BuiltInKeyword enum.
  • modelPath String? : Absolute path to file containing model parameters (.pv).
  • sensitivities [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.

Throws

  • PorcupineError: If an error occurs while creating an instance of Porcupine Wake Word engine.
public convenience init(accessKey: String, keyword: Porcupine.BuiltInKeyword, modelPath:String? = nil, sensitivity: Float32 = 0.5)

Parameters

  • accessKey String : The AccessKey obtained from Picovoice Console.
  • keyword Porcupine.BuiltInKeyword : A built-in keyword from the Porcupine.BuiltInKeyword enum.
  • modelPath String? : Absolute path to file containing model parameters (.pv).
  • sensitivity Float32? : Sensitivity for detecting keyword, which should be a number within [0, 1]. A higher sensitivity results in fewer misses at the cost of increasing the false alarm rate.

Throws

  • PorcupineError: If an error occurs while creating an instance of Porcupine Wake Word engine.

Porcupine.delete()

Releases resources acquired by the Porcupine engine.

public func delete()

Porcupine.process()

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

public func process(pcm:[Int16]) throws -> Int32

Parameters

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

Returns

  • Int32 : Index of keyword detected or -1 if no keyword was detected.

Throws

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

Porcupine.frameLength

public static let frameLength: UInt32

The number of audio samples per frame.


Porcupine.sampleRate

public static let sampleRate: UInt32

Audio sample rate accepted by Porcupine.


Porcupine.version

public static let version: String

Current Porcupine version.


Porcupine.BuiltInKeyword

public enum BuiltInKeyword: String, CaseIterable {
case alexa = "Alexa"
case americano = "Americano"
case blueberry = "Blueberry"
case bumblebee = "Bumblebee"
case computer = "Computer"
case grapefruit = "Grapefruit"
case grasshopper = "Grasshopper"
case heyGoogle = "Hey Google"
case heySiri = "Hey Siri"
case jarvis = "Jarvis"
case okGoogle = "Ok Google"
case picovoice = "Picovoice"
case porcupine = "Porcupine"
case terminator = "Terminator"
}

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


PorcupineManager

A High-level iOS binding for Porcupine 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.

public class PorcupineManager { }

PorcupineManager.init()

public convenience init(
accessKey: String,
keywordPaths: [String],
modelPath:String? = nil,
sensitivities: [Float32]? = nil,
onDetection: ((Int32) -> Void)?,
errorCallback: ((Error) -> Void)? = nil) throws

Parameters

  • accessKey String : The AccessKey obtained from Picovoice Console.
  • keywordPaths [String] : Absolute paths to keyword model files (.ppn).
  • modelPath String? : Absolute path to file containing model parameters (.pv).
  • sensitivities [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.
  • onDetection ((Int32) -> Void)? : A callback that is invoked upon detection of the keyword.
  • errorCallback ((Error) -> Void)? = nil) : A callback that is invoked if an error occurs while processing frames. If missing, error will be printed to console.

Throws

  • PorcupineManagerError : If an error occurs while creating an instance of Porcupine Wake Word engine.
public convenience init(
accessKey: String,
keywordPath: String,
modelPath:String? = nil,
sensitivity: Float32 = 0.5,
onDetection: ((Int32) -> Void)?,
errorCallback: ((Error) -> Void)? = nil) throws

Parameters

  • accessKey String : The AccessKey obtained from Picovoice Console.
  • keywordPath String : Absolute path to a keyword model file (.ppn).
  • modelPath String? : Absolute path to file containing model parameters (.pv).
  • sensitivity Float32? : Sensitivity for detecting keyword, which should be a number within [0, 1]. A higher sensitivity results in fewer misses at the cost of increasing the false alarm rate.
  • onDetection ((Int32) -> Void)? : A callback that is invoked upon detection of the keyword.
  • errorCallback ((Error) -> Void)? = nil) : A callback that is invoked if an error occurs while processing frames. If missing, error will be printed to console.

Throws

  • PorcupineManagerError : If an error occurs while creating an instance of Porcupine Wake Word engine.
public convenience init(
accessKey: String,
keywords:[Porcupine.BuiltInKeyword],
modelPath:String? = nil,
sensitivities: [Float32]? = nil,
onDetection: ((Int32) -> Void)?,
errorCallback: ((Error) -> Void)? = nil) throws

Parameters

  • accessKey String : The AccessKey obtained from Picovoice Console.
  • keywords [Porcupine.BuiltInKeyword] : An array of built-in keywords from the Porcupine.BuiltInKeyword enum.
  • modelPath String? : Absolute path to file containing model parameters (.pv).
  • sensitivities [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.
  • onDetection ((Int32) -> Void)? : A callback that is invoked upon detection of the keyword.
  • errorCallback ((Error) -> Void)? = nil) : A callback that is invoked if an error occurs while processing frames. If missing, error will be printed to console.

Throws

  • PorcupineManagerError: If an error occurs while creating an instance of Porcupine Wake Word engine.
public convenience init(
accessKey: String,
keyword: Porcupine.BuiltInKeyword,
modelPath: String? = nil,
sensitivity: Float32 = 0.5,
onDetection: ((Int32) -> Void)?,
errorCallback: ((Error) -> Void)? = nil) throws

Parameters

  • accessKey String : The AccessKey obtained from Picovoice Console.
  • keyword Porcupine.BuiltInKeyword : A built-in keyword from the Porcupine.BuiltInKeyword enum.
  • modelPath String? : Absolute path to file containing model parameters (.pv).
  • sensitivity Float32? : Sensitivity for detecting keyword, which should be a number within [0, 1]. A higher sensitivity results in fewer misses at the cost of increasing the false alarm rate.
  • onDetection ((Int32) -> Void)? : A callback that is invoked upon detection of the keyword.
  • errorCallback ((Error) -> Void)? = nil) : A callback that is invoked if an error occurs while processing frames. If missing, error will be printed to console.

Throws

  • PorcupineManagerError : If an error occurs while creating an instance of Porcupine Wake Word engine.

PorcupineManager.delete()

public func delete()

Stops recording and releases Porcupine resources.


PorcupineManager.start()

public func start() throws

Starts recording audio from the microphone and monitors it for the utterances of the given set of keywords.

Throws

  • PorcupineError : If microphone permission is not granted or Porcupine has been disposed.

PorcupineManager.stop()

public func stop()

Stop listening for wake words.


PorcupineManagerError

public enum PorcupineManagerError: Error { }

Enums for PorcupineManager error values:

  • case recordingDenied
  • case objectDisposed

PorcupineError

public class PorcupineError : LocalizedError { }

Error thrown if an error occurs within Porcupine Wake Word engine.

public class PorcupineMemoryError : PorcupineError {}
public class PorcupineIOError : PorcupineError {}
public class PorcupineInvalidArgumentError : PorcupineError {}
public class PorcupineStopIterationError : PorcupineError {}
public class PorcupineKeyError : PorcupineError {}
public class PorcupineInvalidStateError : PorcupineError {}
public class PorcupineRuntimeError : PorcupineError {}
public class PorcupineActivationError : PorcupineError {}
public class PorcupineActivationLimitError : PorcupineError {}
public class PorcupineActivationThrottledError : PorcupineError {}
public class PorcupineActivationRefusedError : PorcupineError {}

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Porcupine Wake Word iOS API
  • Porcupine
  • init()
  • delete()
  • process()
  • frameLength
  • sampleRate
  • version
  • BuiltInKeyword
  • PorcupineManager
  • init()
  • delete()
  • start()
  • stop()
  • PorcupineManagerError
  • PorcupineError
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.