Short Denoiser API
This documentation is for the DeepHearing Short Denoiser API.
Request
The Denoiser API allows users to perform file-based denoising.
Method | URL |
---|---|
POST | https://apigw.prod.deephearing.com/denoise |
Only one file can be processed per request. Also, file processing is done synchronously and you receive the results after the audio is processed.
Header
First, you must add the pre-supplied API key to the header before sending the API request.
var header = {
'X-API-KEY': "<API_KEY>"
}
Body
When POST an audio file to the API with a filename, you get a denoised audio file back.
formdata.append("audio", fileInput.files[0]);
When adding an audio file to the form-data, the key should be set to "audio"
.
Supports
The following file extensions are supported
Type | Description | |
---|---|---|
.wav | this is the default setting of API. | recommend |
.mp3 | When processing MP3 files, you need to specify the encoding type as a query. |
Here's how it works for MP3 files.
var audioFile = fileInput.files[0];
fetch("https://apigw.staging.deephearing.com/denoise?encoding=mp3",
{
// options...
})
.then(response => {
// other actions...
})
.then(result => console.log(result))
.catch(error => console.error(error));
For wav, API works without adding encoding to the query as this is the default setting, but for mp3, you need to add encoding to the query to use the API.
For wav, you can also use the API by adding ?encoding=wav
.
Request Sample
curl --location 'https://apigw.staging.deephearing.com/denoise' \
--form 'audio=@"/path/to/file"'
- Sample Code
var fileInput = document.querySelector("input[name=audio]")
var headers = new Headers();
headers.append("X-API-KEY", "<API_KEY>");
var formdata = new FormData();
formdata.append("audio", fileInput.files[0]); //formdata key should be set to audio.
var options = {
method: 'POST',
headers,
body: formdata,
};
//In this case, it only works for wav files
fetch("https://apigw.staging.deephearing.com/denoise", options)
.then(response => {
// other actions...
})
.then(result => console.log(result))
.catch(error => console.error(error));
Responses
Success Response
{
"result": "<Base64-encoded audio files>",
"totalBilledTime": "<Total length of the audio file>",
"usageRemain": "<Remaining usage>"
}
Error Response
{
message: "Forbidden"
}
{
message: "Request Too Long"
}
{
message: "Internal server error"
}