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 Quick Start

Platforms

  • iOS (13.0+)

Requirements

  • Xcode
  • Swift Package Manager or CocoaPods

Picovoice Account & AccessKey

Signup or Login to Picovoice Console to get your AccessKey. Make sure to keep your AccessKey secret.

Quick Start

Setup

  1. Install Xcode.

  2. Import the Porcupine-iOS package into your project.

To import the package using SPM, open up your project's Package Dependencies in XCode and add:

https://github.com/Picovoice/porcupine.git

To import it into your iOS project using CocoaPods, add the following line to your Podfile:

pod 'Porcupine-iOS'

Then, run the following from the project directory:

pod install
  1. Add the following to the app's Info.plist file to enable recording with an iOS device's microphone
<key>NSMicrophoneUsageDescription</key>
<string>[Permission explanation]</string>

Usage

Create an instance of PorcupineManager that detects the included built-in wake words porcupine and bumblebee:

import Porcupine
do {
let porcupineManager = try PorcupineManager(
accessKey: "${ACCESS_KEY}",
keywords: [Porcupine.BuiltInKeyword.porcupine, Porcupine.BuiltInKeyword.bumblebee],
onDetection: wakeWordCallback)
} catch { }

The wakeWordCallback parameter is a function that will be invoked when Porcupine Wake Word has detected one of the keywords.

let wakeWordCallback: ((Int32) -> Void) = { keywordIndex in
if keywordIndex == 0 {
// porcupine detected
} else if keywordIndex == 1 {
// bumblebee detected
}
}
}

Start audio capture and wake word detection:

do {
porcupineManager.start()
} catch { }

Stop audio capture and processing with:

porcupineManager.stop()

Release resources explicitly when done with Porcupine:

porcupineManager.delete()
To use your own audio processing pipeline, check out the Low-Level Porcupine API.

Custom Keywords

Create custom keywords using the Picovoice Console. Download the custom wake word file (.ppn) and include it in the app as a bundled resource (found by selecting in Build Phases > Copy Bundle Resources). Then, get its path from the app bundle:

let keywordPath = Bundle.main.path(forResource: "${CUSTOM_KEYWORD}", ofType: "ppn")

And create an instance of PorcupineManager that detects the custom keyword:

do {
let porcupineManager = try PorcupineManager(
accessKey: "${ACCESS_KEY}",
keywordPath: keywordPath,
onDetection: wakeWordCallback)
} catch { }

Alternatively, if the keyword files are deployed to the device with a different method, the absolute paths to the files on device can be used.

Non-English Languages

Use the corresponding model file (.pv) to detect non-English wake words. The model files for all supported languages are available on the Porcupine Wake Word GitHub repository.

Pass in the model file using the modelPath input argument to change the detection language:

let modelPath = Bundle.main.path(forResource: "${MODEL_FILE}", ofType: "pv")
do {
let porcupineManager = try PorcupineManager(
accessKey: "${ACCESS_KEY}",
keywordPath: keywordPath,
modelPath: modelPath,
onDetection: wakeWordCallback)
} catch { }

Alternatively, if the model file is deployed to the device with a different method, the absolute path to the file on device can be used.

Demo

For the Porcupine Wake Word iOS SDK, we offer demo applications that demonstrate how to use the wake word engine on real-time audio streams (i.e. microphone input).

Setup

Clone the Repository:

git clone --recurse-submodules https://github.com/Picovoice/porcupine.git

Usage

  1. Install dependencies:
cd porcupine/demo/ios/ForegroundApp
pod install
  1. Open the PorcupineForegroundAppDemo.xcworkspace in XCode

  2. Replace "${YOUR_ACCESS_KEY_HERE}" in the file ViewModel.swift with a valid AccessKey

  3. Open the PorcupineForegroundAppDemo.xcworkspace and run the demo

  4. Go to Product > Scheme and select the scheme for the language you would like to demo (e.g. esDemo -> Spanish Demo, deDemo -> German Demo)

  5. Run the demo with a simulator or connected iOS device

The demo detects the chosen keyword only when the application is in focus. To see an example of Porcupine Wake Word in a background service, head over to our GitHub repository.

Resources

Package

  • Porcupine-iOS on Cocoapods

API

  • Porcupine-iOS API Docs

GitHub

  • Porcupine Wake Word iOS SDK on GitHub
  • Porcupine Wake Word iOS Demos on GitHub

Benchmark

  • Wake Word Benchmark

Further Reading

  • Siri Gets a Barista Job: Adding Offline Voice AI to a SwiftUI App

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Porcupine Wake Word iOS Quick Start
  • Platforms
  • Requirements
  • Picovoice Account & AccessKey
  • Quick Start
  • Setup
  • Usage
  • Custom Keywords
  • Non-English Languages
  • Demo
  • Setup
  • Usage
  • Resources
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.