Overview - Production
AudioStack allows you to choose from a variety of sound templates, which will then be mixed and mastered along with a speech track.
![](https://files.readme.io/3491f49-Production_Frame_V2.png)
Try it Out!
import audiostack
## add your API key
audiostack.api_key = "APIKEY"
text = """
<as:section name="intro" soundsegment="intro"> Sound designs can be quite dramatic</as:section><as:section name="intro" soundsegment="intro"> In this part of the docs, you can find out more about some of the different things you can do with sound templates, such as using different sections to add variation.</as:section><as:section name="outro" soundsegment="outro"> We'll also apply auto mixing and mastering. Check it out!</as:section>
"""
VOICE = "renata"
SOUND_TEMPLATE="spooky_strings"
print("Creating your script...")
script = audiostack.Content.Script.create(scriptText=text,scriptName="testing")
scriptId = script.scriptId
print("Generating speech...")
item = audiostack.Speech.TTS.create(scriptItem=script, voice=VOICE)
print(f"Combining {VOICE}'s speech with {SOUND_TEMPLATE} and applying mixing and mastering...")
item = audiostack.Speech.TTS.get(item.speechId)
mix = audiostack.Production.Mix.create(speechItem=item,masteringPreset="balanced",soundTemplate=SOUND_TEMPLATE)
print("Downloading your MP3")
encoder = audiostack.Delivery.Encoder.encode_mix(productionItem=mix,preset="mp3")
encoder.download(fileName=f"{script.scriptName}__{VOICE}_{SOUND_TEMPLATE}",path=".")
In this example we've added a masteringPreset (which adjusts the sound of the audio), we use Production.Mix to create the mix. This is mixing together elements. You'll notice that our elements consist of speech, a masteringPreset, a soundTemplate (which is the background to your audio), and we also specify forceLength which is great for adding to video content.
Afterwards we use the encoder to make the audio work for delivery, in this example we've passed in our mix and a preset. In this case, preset is referring to the file type we want to optimise for - so you could enter wav or mp3.
What is Mastering?
Mastering allows you to create and retrieve a mastered audio file that is ready to be played or broadcasted. A mastered version contains the speech of the script, a background track, personalised tracks for your audience, and a mastering process to enhance the audio quality of the whole track.
In order to get a mastered audio file, make sure you request speech for your script resource first, then apply a masteringPreset to your mix. Find out more.
Other Production Features
- Flexible sound designs - AudioStack uses "elastic" templates, which ensure that the music layer will always fit perfectly to the speech layer of your audio, regardless of the length. We'll simply repeat sections of the audio to align as closely as possible with your speech duration, to avoid awkward silences while still sounding musical.
- Variety of sound designs available - AudioStack's sound design library offers a selection of different sounds covering a range of common themes or use cases. Filter to find the perfect template for your use case. Choose from our library of sound templates and mix and master it along with your speech track to create beautiful audio programmatically in a matter of seconds.
- Time and length alignment - Set the length of each section of your audio to end at a specific time. For example, you might want your ad to be exactly 30 seconds long or you might want your audio to fit to specific transitions in your video.
Updated 3 months ago