How to Separate a Single Audio File into Stems with the API
import audiostack
import os
# First, paste your API key inside the quotation marks below:
audiostack.api_key = os.environ['AUDIOSTACK_API_KEY']
# This code example demonstrates functionality from the Content, Speech, Production and Delivery parts of the AudioStack API.
# Using the API, you can create production-ready audio assets in minutes.
# In Content, you can create scripts and manage your production assets.
# Upload a file. It's important that uploadPath contains the file extension. Upload file will be available to your organisation.
# Used - https://pixabay.com/sound-effects/summer-atmosphere-young-people-talk-and-have-fun-atmo-6197/
file = audiostack.Content.File.create(
localPath="noisy.mp3", uploadPath="mydir/noisy.mp3", fileType="audio"
)
print("The file ID is:", file.fileId)
response = audiostack.production.suite.Suite.separate(fileId=file.fileId, wait=True)
file = audiostack.Content.File.get(fileId=response.newFileIds[0]["fileId"])
file.download(fileName="separated_file.wav", path="./")
This operation takes some time
Lots of users are sometimes surprised by how long this takes. However it takes it's time prepare to wait a few minutes.
Updated 4 months ago