Porcupine Wake Word
iOS Quick Start
Platforms
- iOS (13.0+)
Requirements
Picovoice Account & AccessKey
Signup or Login to Picovoice Console to get your AccessKey
.
Make sure to keep your AccessKey
secret.
Quick Start
Setup
Install Xcode.
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:
To import it into your iOS project using CocoaPods, add the following line to your Podfile:
- Run the following from the project directory:
- Add the following to the app's
Info.plist
file to enable recording with an iOS device's microphone
Usage
Create an instance of PorcupineManager
that detects the included built-in wake words porcupine
and bumblebee
:
The wakeWordCallback
parameter is a function that will be invoked when Porcupine Wake Word has detected one of the keywords.
Start audio capture and wake word detection:
Stop audio capture and processing with:
Release resources explicitly when done with Porcupine:
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:
And create an instance of PorcupineManager
that detects the custom keyword:
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:
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:
Usage
- Install dependencies:
Open the
PorcupineForegroundAppDemo.xcworkspace
in XCodeReplace
let accessKey = "${YOUR_ACCESS_KEY_HERE}"
in the file ViewController.swift with a validAccessKey
Open the
PorcupineForegroundAppDemo.xcworkspace
and run the demoGo to
Product > Scheme
and select the scheme for the language you would like to demo (e.g.arDemo
-> Arabic Demo,deDemo
-> German Demo)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.