Extract voice from audio file
Prerequisites
Make sure to follow Getting Started to log.
If you are using APIs, save your authorization token in a variable called AUTHORIZATION_TOKEN
before moving ahead.
Extract Voice
STEP 1 - Upload a file
To extract voice from an audio file you will have to upload your file first and get the respective file ID. Follow the steps in this page to do so.
STEP 2 - Create a voice extraction task
Call this API to start the voice extraction process
curl --location --request POST 'https://platform.neuralspace.ai/api/voice-extractor/v1/extract' \
--header 'Authorization;' \
--header 'Content-Type: application/json' \
--data-raw '{
"fileId": "<YOUR-FILE-ID>"
}'
This will return a taskId
, which you can use to check the status of this task later.
Here is a sample response:
{
"success": true,
"message": "Successfully queued Audio-Split job.",
"data": {
"taskId": "<YOUR-VOICE-EXTRACTION-TASK-ID>"
}
}
STEP 3 - Fetch voice extraction results
curl --location --request GET 'https://platform.neuralspace.ai/api/voice-extractor/v1/task?taskId=<YOUR-VOICE-EXTRACTION-TASK-ID>' \
--header 'Authorization: <ACCESS-TOKEN>'
This will return an object like this, in which you can see the current voice extraction status along with some related metadata.
{
"success": true,
"message": "Data fetched succssfully",
"data": {
"apikey": "...",
"taskId": "<YOUR-VOICE-EXTRACTION-TASK-ID>",
"jobStatus": "Completed",
"jobProgress": [
"Queued",
"Job Started",
"Loading Model",
"Model Loading Complete",
"Splitting Audio",
"Split Complete",
"Job Ended",
"Completed"
],
"results": {
"output": {
"instrument_path": "uploads/<YOUR-BACKGROUND-AUDIO-FILE-ID>",
"instrument_file_id": "<YOUR-BACKGROUND-AUDIO-FILE-ID>",
"vocal_path": "uploads/<YOUR-VOICE-AUDIO-FILE-ID>",
"vocal_file_id": "<YOUR-VOICE-AUDIO-FILE-ID>"
}
},
"message": "job completed successfully",
"fileId": "<YOUR-VOICE-EXTRACTION-FILE-ID>",
"filePath": "uploads/<YOUR-VOICE-EXTRACTION-FILE-ID>",
"createdAt": "2022-10-31T08:07:43.033Z"
}
}
Transcription Status Codes
Since files are transcribed asynchronously, every step is logged in the jobProgress
attribute.
All the status messages have been shown in the example above but in case a speaker identification job fails a Failed
status is set instead for Completed.
These are all the status messages:
- Queued
- Job Started
- Loading Model
- Model Loading Complete
- Splitting Audio
- Split Complete
- Job Ended
- Completed
What are instrument_file_id
and vocal_file_id
?
When jobStatus
becomes Completed
you will get two file ids in the results
field.
instrument_file_id
is the file id for the background audio and vocal_file_id
is the file id of the the voice audio file.
You can fetch these files by following the instructions here.