iosCheetah - iOS Quick Start

Platforms

  • iOS (9.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

  1. Install Xcode.

  2. Install CocoaPods

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

pod 'Cheetah-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>

Adding Cheetah models

Add the Cheetah model file in Xcode by:

  1. Either creating a model in Picovoice Console or get the default model in /lib/common/cheetah_params.pv.
  2. Add the model as a bundled resource by selecting Build Phases and adding it to Copy Bundle Resources step.

Usage

Create an instance of Cheetah:

import Cheetah
let accessKey = "${ACCESS_KEY}"
let modelPath = Bundle(for: type(of: self)).path(
forResource: "${CHEETAH_MODEL_FILE}",
ofType: "pv")!
do {
let cheetah = Cheetah(accessKey: accessKey, modelPath: modelPath, endpointDuration: 1.0)
} catch { }

Transcribe audio:

func getNextAudioFrame() -> [Int16] {
// ...
return audioFrame;
}
while true {
do {
let partialTranscript, isEndpoint = try cheetah.process(getNextAudioFrame())
if isEndpoint {
let finalTranscript = try cheetah.flush()
}
} catch let error as CheetahError {
// handle error
} catch { }
}

Release resources explicitly when done with Cheetah:

cheetah.delete()

Demo

For the Cheetah iOS SDK, we offer demo applications that demonstrate how to use the Speech-to-Text engine on real-time audio streams (i.e. microphone input).

Setup

Clone the Repository:

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

Usage

  1. Install dependencies:
cd cheetah/demo/ios/CheetahDemo
pod install
  1. Replace let accessKey = "${YOUR_ACCESS_KEY_HERE}" in the file ViewController.swift with a valid AccessKey.

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

Resources

Packages

API

GitHub

Benchmark


Issue with this doc? Please let us know.