How to use Recommendation to Find a Perfect Sound Design

AudioStack can provide a list of the top three recommended sound templates to use with a given script. Using /sound/select, you can provide your ScriptID or content along with (optionally) the mood you want to go for, and AudioStack will return a list of sound templates for you to try.

Code Example

import audiostack
import os

# Set your API key
audiostack.api_key = os.environ['AUDIOSTACK_API_KEY']

advert = """
<as:section soundSegment="main">
   ("AudioStack's enterprise-grade audio AI technology seamlessly integrates into your product "
          "or workflow and cuts your production cycles to seconds while making your budgets go further. "
          "To find out more about all the cool things you can create using AudioStack, check out our workflow guides "
          "which you can find in the documentation at docs dot audiostack dot com")
advertMood = "nostalgic"  # Choose from inspirational, nostalgic, playful, energetic, soothing, mysterious, dramatic, romantic, uplifting, humorous
voice = "sara"

print("Creating your script from text...")
script = audiostack.Content.Script.create(scriptText=advert)

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

print("Finding relevant sound templates...")
soundTemplates = audiostack.Production.Sound.Template.select_for_script(["scriptId"], mood=advertMood)

for template in['templates']:
    print("Creating your advert...")
    mix = audiostack.Production.Mix.create(speechItem=speech, soundTemplate=template['alias'], masteringPreset="balanced")

    print("Downloading your MP3")
    encoder = audiostack.Delivery.Encoder.encode_mix(productionItem=mix, preset="mp3")"{['scriptName']}__{template['alias']}", path=".")

print("Advert creation completed!")