Skip to content

PavelGnatyuk/SpeechDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

SpeechDemo

The app is a simplem demo for the speech recognition:

  1. Add descriptions to the info.plist
  2. Check permissions on the app start
  3. Create audio engine and the speech recognition instances.
  4. Each time on the start initialize the recognition request and the task.
  5. Destroy the recognition request and the task in the end (or before the new start).

Reference

  1. WWDC 2016 - Session 509 - iOS
  2. Working Apple sample
  3. Using the Speech Recognition API in iOS 10

Notes

The app works much better with:

SFSpeechRecognizer? = SFSpeechRecognizer(locale: Locale(identifier: "en-US"))

and

try audioSession.setCategory(.playAndRecord, mode: .spokenAudio, options: [.interruptSpokenAudioAndMixWithOthers])

The last lien fixes the strange error:

2018-12-31 07:13:50.498942+0200 SpeechDemo[6772:2783016] [avas] AVAudioSessionPortImpl.mm:56:ValidateRequiredFields: Unknown selected data source for Port Receiver (type: Receiver)