Convert audio to text with Apple’s Speech library in Swift

Tram Ho

Since 2016, the official Speech library was introduced by Apple to the developer community. Before that, a number of voice recognition functions were available. Users are usually assisted with dictation using the keyboard or Siri. But thanks to this new API, the ability to creatively integrate speech recognition in your apps has greatly increased. Today I will guide you to implement this tool in your project.

First, import Speech to use this library. Second, ask for audio reproduction permissions:

Third, add a key to your Info.plist named NSSpeechRecognitionUsageDescription, then give it a description of what you intend to do with the records. Finally, write the function to perform transcription on an audio URL. This URL should be a record you created, stored locally on your device:

Wish you implement successfully in your project!

Share the news now

Source : Viblo