Pre-recorded audio

Our Speech-to-Text model enables you to transcribe pre-recorded audio into written text.

On top of the transcription, you can enable other features and models, such as Speaker Diarization, by adding additional parameters to the same transcription request.

Choose model class

Choose between Best and Nano based on the cost and performance tradeoffs best suited for your application.

Quickstart

The following example transcribes an audio file from a local file.

1import assemblyai as aai
2
3aai.settings.api_key = "<YOUR_API_KEY>"
4
5audio_file = "./local_file.mp3"
6# audio_file = "https://assembly.ai/wildfires.mp3"
7
8config = aai.TranscriptionConfig()
9
10transcript = aai.Transcriber(config=config).transcribe(audio_file)
11
12if transcript.status == "error":
13 raise RuntimeError(f"Transcription failed: {transcript.error}")
14
15print(transcript.text)

Example output

1Smoke from hundreds of wildfires in Canada is triggering air quality alerts
2throughout the US. Skylines from Maine to Maryland to Minnesota are gray and
3smoggy. And...

API reference

You can find the API reference here.