Getting Started
Before we begin, make sure you have an AssemblyAI account and an API key. You can sign up for an account and get your API key from your dashboard. This guide will use AssemblyAI’s JavaScript SDK. If you haven’t already, install the SDK in your project by following these instructions.Step-by-Step Instructions
Set up your application folder structure by adding an audio folder which will house the files you would like to transcribe, a transcripts folder which will house your completed transcriptions, and a new.js file in the root of the project. Your file structure should look like this:
batch.js file import the AssemblyAI package, as well as the node fs and node path packages. Create an AssemblyAI object with your API key:
audioFolder, files, filePathArr, and transcriptsFolder.
audioFolderwill be the relative path to the folder containing your audio files.fileswill read the files in the audio folder, and return them in an array.filePathArrwill join the file names with the audio folder name to create the relative path to each individual file.transcriptsFolderwill be the relative path to the folder containing your transcription files.
getTranscript function and write the transcription text from each audio file to an individual text file in the transcripts folder.
- Create an array of unresolved promises with each promise requesting a transcript.
- Use
Promise.allto iterate over the array of unresolved promises.