How to Denoise Audio

In this example we'll work through an example of denoising audio

Denoising audio

In this tutorial we'll work through a constructed example.

You will learn

  1. How to upload a noisy audio file
  2. How to use the denoiser functionality
  3. How to download that file from the API

1. Uploading a file

The first part is to upload a noisy audio file. Select a noisy audio file and add it to the folder.

  • For my example I recorded using Quicktime on my mac, and had a noisy office/ background noise (I tapped the table and shook my keys)
file = audiostack.Content.File.create(
    FILE_TO_DENOISE,
    uploadPath="how-to-guides/sep_audio_example.mp3",
    fileType="audio",
)

πŸ“˜

Uploading files

This is the same as uploading ANY file to our api, we create an object in our file system.

2. Denoising a file

Secondly we will use the Denoiser pipeline

response = audiostack.production.suite.Suite.denoise(fileId=fileId, wait=True)

The key thing is that you get a pipelineId back. And this is the object you want back from the API. By setting wait=True our SDK will poll the Audiostack API to check if your file is ready.

Alternatively, you can set wait=False and poll the API yourself with:

response = audiostack.production.suite.Suite.get(pipelineId=pipelineId)

Then we proceed to step 3

🚧

Denoiser pipeline isn't async

Pay attention to understand that the Denoiser pipeline isn't async. If you're using the API without the SDK this is a source of errors.

Step 3: Downloading the file

file = audiostack.Content.File.get(fileId=response.newFileIds[0]["fileId"])
file.download(fileName="denoised.wav", path="./")

4. Running an end-to-end example

Get your API key from platform.audiostack.ai and then run:

export AUDIOSTACK_API_KEY=<your API key> && python sep_audio.py

Note:

πŸ“˜

Find the code

You can find all the code in the following gist