Transcribe long files
In this example, we will transcribe a long audio file (> 60 seconds) using the asynchronous API.
For shorter audio files (<60 seconds), please refer to the Transcribe Short Audio guide which uses the synchronous API for simplicity.
Upload file
First we upload the file with the transcribe_file_async() function.
Once the request succeeds, the auto-assigned file_id is returned.
You can use the reference_name to associate your internal file id with the uploaded file.
It can be any string not longer than 256 characters, including the empty string, and duplicates are allowed.
The service does not use this field, it is only for your reference.
Get status
After the file has been uploaded, it will be in one of 4 states: QUEUED, TRANSCRIBING, COMPLETED or FAILED.
We call the GetTranscribeAsyncStatus() function to check the status of the file.
If the file status is FAILED, the error message can be obtained from error_message field.
Get result
Once the file status is COMPLETED, we call the GetTranscribeAsyncResult() function to retrieve transcription result.
Note, when transcribing with separate recognition per channel, the GetTranscribeAsyncResult() function
returns a list of results, one for each channel.
Delete file
Once the transcription result has been obtained, the file should be deleted using DeleteTranscribeAsyncFile function.
Run
Run the complete example transcribe_file_async.py.
Output
Upload file
First we upload the file with the transcribeFileAsync() function.
Once the request succeeds, the auto-assigned file_id is returned.
You can use the reference_name to associate your internal file id with the uploaded file.
It can be any string not longer than 256 characters, including the empty string, and duplicates are allowed.
The service does not use this field, it is only for your reference.
Get status
After the file has been uploaded, it will be in one of 4 states: QUEUED, TRANSCRIBING,
COMPLETED or FAILED. We call the getTranscribeAsyncStatus() function to check the status of the file.
If the file status is FAILED, the error message can be obtained from error_message field.
Get result
Once the file status is COMPLETED, we call the GetTranscribeAsyncResult() function to retrieve transcription result.
Note, when transcribing with separate recognition per channel, the GetTranscribeAsyncResult() function
returns a list of results, one for each channel.
Delete file
Once the transcription result has been obtained, the file should be deleted using DeleteTranscribeAsyncFile function.
Run
Run the complete example transcribe_file_async.js.
Output
Upload file
First we upload the file with the transcribeFileAsync() function.
Once the request succeeds, the auto-assigned file_id is returned.
You can use the TranscriptionConfig.ClientRequestReference to associate your internal file id with the uploaded file.
It can be any string not longer than 32 characters, including the empty string, and duplicates are allowed.
The service does not use this field, it is only for your reference.
Get status
After the file has been uploaded, it will be in one of 4 states: QUEUED, TRANSCRIBING, :code:COMPLETED or :code:FAILED.
We call the GetTranscribeAsyncFileStatus() function to check the status of the file.
If the file status is FAILED, the error message can be obtained from status.ErrorMessage field.
Get result
Once the file status is COMPLETED, we call the GetTranscribeAsyncResult() function to retrieve transcription result.
When transcribing without separate recognition per channel, the GetTranscribeAsyncResult() function
returns a SingleResult object, which has a single Result in the Result field. When
transcribing with separate recognition per channel, it returns a SeparateRecognitionResult object,
which has a list of Result objects in the ChannelResults field, one for each channel.
Delete file
Once the transcription result has been obtained, the file should be deleted using DeleteTranscribeAsyncFile function.
Run
Run the complete example TranscribeFileAsync.cs.
Output