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


Platforms

  • iOS (9.0+)

Requirements

  • Xcode
  • 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. Install CocoaPods

  3. Import the Picovoice-iOS binding by adding the following line to Podfile:

pod 'Picovoice-iOS'
  1. 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

Include a Porcupine keyword file (.ppn) and a Rhino context file (.rhn) 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: "${KEYWORD_IOS}", ofType: "ppn")
let contextPath = Bundle.main.path(forResource: "${CONTEXT_IOS}", ofType: "rhn")

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

Create an instance of PicovoiceManager that detects the wake word and infers intents from spoken commands:

import Picovoice
let manager = PicovoiceManager(
accessKey: "${ACCESS_KEY}",
keywordPath: keywordPath,
onWakeWordDetection: {
// logic to execute upon deletection of wake word
},
contextPath: contextPath,
onInference: { inference in
if inference.isUnderstood {
let intent:String = inference.intent
let slots:Dictionary<String,String> = inference.slots
// take action based on inferred intent and slot values
} else {
// handle unsupported commands
}
}
)

Start audio capture:

do {
try manager.start()
} catch { }

Stop audio capture and processing with:

manager.stop()
To use your own audio processing pipeline, check out the Low-Level Picovoice API .

Custom Wake Words & Contexts

Create custom models using the Picovoice Console . Download the custom Porcupine keyword (.ppn) and Rhino context (.rhn) files and include them in the app as a bundled resource (found by selecting in Build Phases > Copy Bundle Resources).

Non-English Languages

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

Pass in the model file using the porcupineModelPath and rhinoModelPath input arguments to change the language:

let porcupineModelPath = Bundle.main.path(forResource: "${PORCUPINE_MODEL_FILE}", ofType: "pv")
let rhinoModelPath = Bundle.main.path(forResource: "${RHINO_MODEL_FILE}", ofType: "pv")
let manager = PicovoiceManager(
accessKey: "${ACCESS_KEY}",
keywordPath: keywordPath,
onWakeWordDetection: {
// logic to execute upon deletection of wake word
},
porcupineModelPath: porcupineModelPath,
contextPath: contextPath,
onInference: { inference in
// logic to execute upon completion of intent inference
}
rhinoModelPath: rhinoModelPath
)

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

Demo

For the Picovoice iOS SDK, we offer demo applications that demonstrate how to use the end-to-end speech recognition platform on real-time audio streams (i.e. microphone input).

Setup

Clone the Repository

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

Usage

  1. Install dependencies:
cd demo/ios/ForegroundApp
pod install
  1. Replace let ACCESS_KEY = "${YOUR_ACCESS_KEY_HERE}" in the file ContentView.swift with a valid AccessKey.

  2. Open the PicovoiceForegroundAppDemo.xcworkspace and run the demo.

For more information on our Picovoice demos for iOS, head over to our Github repository .

Resources

Package

  • Picovoice-iOS on Cocoapods

API

  • Picovoice-iOS API Docs

GitHub

  • Picovoice iOS SDK on GitHub
  • Picovoice iOS Demos on GitHub

Benchmarks

  • Wake Word Benchmark
  • Speech-to-Intent 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
Picovoice Platform iOS Quick Start
  • Platforms
  • Requirements
  • Picovoice Account & AccessKey
  • Quick Start
  • Setup
  • Usage
  • Custom Wake Words & Contexts
  • Non-English Languages
  • Demo
  • Setup
  • Usage
  • Resources
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.