Use this file to discover all available pages before exploring further.
In this guide, we’ll show you how to use the AssemblyAI API to transcribe multiple audio files at once. This guide focuses on demonstrating how to use the AssemblyAI Python SDK to achieve this.
Import the assemblyai package and set the API key. Import threading and OS Python libraries that enable concurrent task processing and file path interactions respectively.
import assemblyai as aaiimport threadingimport osaai.settings.api_key = "YOUR_API_KEY"
Set the folders. The batch folder contains the audio files that you want to process and transcribe. The transcription_result_folder stores the .txt transcript files.
Function to transcribe an audio file. Once the transcript is complete, a .txt file is generated to the transcription_result_folder. If there is an error with the transcription, it will not be processed to the results folder.
Open threads to transcribe each file concurrently. Once all the threads are complete you will receive the “All transcriptions are complete” message in your terminal.
threads = []for filename in os.listdir(batch_folder): thread = threading.Thread(target=transcribe_audio, args=(filename,)) threads.append(thread) thread.start()for thread in threads: thread.join()print("All transcriptions are complete.")
This guide aims to demonstrate how to use AssemblyAI Python SDK to concurrently process multiple audio files at once. The output is transcript text files for each audio file in the specified folder.Other integrations and features can be built on top of this main function. These include and are not limited to: exporting the file in different formats, adding Core Transcription or Speech Understanding features.If you have any questions, please feel free to reach out to our Support team at support@assemblyai.com.