How to Download Stems for your AudioStack Asset

Easily download separate voice, music and atmospheric effect tracks when creating audio using the API

In this example, we'll create an audio asset using the API containing text-to-speech, atmospheric sound effects and a sound template from the AudioStack library. We'll then include stem download as one of our export settings, so that the stems are saved in a Zip file in the directory where our code is saved.

First, copy and paste the following code into your development environment.

πŸ“˜

Never worked with AudioStack's python SDK before?

No problem - make sure you get started with our easy set up guide before following this tutorial.

import audiostack
import os

audiostack.api_key = "API KEY"

ScriptText = """ 
<as:section name="intro" soundSegment="intro">
Check out this new feature from AudioStack. You can now easily export your audio files' stems.
</as:section>
<as:section name="main" soundSegment="main">
This will make it easier than ever to pass on assets created to your creative team, to apply the final touches.
</as:section>
"""

print("Creating script")
script = audiostack.Content.Script.create(
    scriptText=ScriptText
)

print("Generating speech")
speech = audiostack.Speech.TTS.create(scriptItem=script, voice="clementine")

print("Mixing and mastering")
mix = audiostack.Production.Mix.create(
    speechItem=speech,
    soundTemplate="visible",
    masteringPreset="balanced",
    exportSettings={"stems": True},
    sections={
    "intro": {"atmosphere": "boxing_round_start"}
    }
)

print(mix.data)
mix.download()

As always, make sure you replace the API key text in Line 4 with your own API key.

Now, run the code. The data printed in the terminal should include the following message:

{'statusCode': 201, 'message': 'stems export'}

Open the folder that your code is running in using the Finder (or File Explorer if you're on Windows). You should now see a Zip file called "Stems", which you'll be able to unzip to access your project's stems. βœ…

πŸ‘

You've successfully exported your stems.

These are in WAV format so are easily importable into all common DAWs.