Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated Apr 29, 2024

Maintenance ModeYou are viewing Amplify Gen 1 documentation. Amplify Gen 1 has entered maintenance mode and will reach end of life on May 1, 2027. New project should use Amplify Gen 2. For existing Gen 1 projects, a migration guide and tooling are available to help you upgrade. Switch to the latest Gen 2 docs →

Transcribe audio to text

Set up the backend

If you haven't already done so, run amplify init inside your project and then amplify add auth (we recommend selecting the default configuration).

Run amplify add predictions and select Convert. Then use the following answers:

? What would you like to convert?
Translate text into a different language
Generate speech audio from text
❯ Transcribe text from audio
? Provide a friendly name for your resource
<Enter a friendly name here>
? What is the source language? (Use arrow keys)
<Select your default source language>
? Who should have access?
Auth users only
❯ Auth and Guest users

Working with the API

Here is an example of converting speech to text. In order to override any choices you made while adding this resource using the Amplify CLI, you can pass in a language in the options object as shown below.

func speechToText(url: URL) async throws {
let options = Predictions.Convert.SpeechToText.Options(
defaultNetworkPolicy: .auto,
language: .usEnglish
)
let result = try await Amplify.Predictions.convert(
.speechToText(url: url), options: options
)
let transcription = result.map(\.transcription)
for try await transcriptionPart in transcription {
print("transcription part: \(transcriptionPart)")
}
}