How to AI Generate Dynamic Creative Optimizations of Adverts

Get started generating multiple customised versions of audio content in minutes with AudioStack API.

AudioStack API enables users to leverage dynamic creative optimisation for advertising and other commercial applications. Seamlessly customise and fine-tune audio content for targeted and engaging advertising campaigns, by generating multiple, tailored versions of audio advertising content rapidly. Check out this example to get started in minutes.

πŸ“˜

Pre-Requisites for this API Recipe

You will need to have set up your development environment and installed AudioStack to complete this tutorial. Follow the steps here to get set up.

Now you're ready to get going, copy and paste the code below into a new python file and run it. Don't forget to add your API key into line 5.

import audiostack
import os

audiostack.api_key = "APIKEY"


text = """<as:section name="main"> 
  Hey <as:placeholder id="username"> </as:placeholder>. At your local gym in <as:placeholder id="location">location</as:placeholder>, we have a huge range of classes including <as:placeholder id="classes">classes</as:placeholder> for you to enjoy. We're offering 50% off if you reactivate your subscription by the end of the month, just for you. Check out our website now!
</as:section>
"""

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

print(f"Generating speech...")
speech = audiostack.Speech.TTS.create(scriptItem=script, audience={"username" : "Peyton", "location" : "Brooklyn", "classes" : "pilates and yoga"}, voice="myra", voiceIntelligence= True)
print(speech)

print(f"Creating your mix...")
mix = audiostack.Production.Mix.create(
        speechItem=speech,
        masteringPreset="podcast",
    )
print(mix)

print(f"Downloading your customised ad...")
mix.download(fileName=f"example_")
print(mix)

πŸ‘

Congratulations!

You just created your first piece of dynamically optimised creative content.

If you look at the code we just ran, in line 9 you'll see there are placeholder fields. These placeholders allow you to generate multiple different versions of the content very quickly, by adding custom content to line 18 - a bit like how a "mail merge" would work in word processing software.

The final result should sound like this:


What’s Next

Want to find out more about Dynamic Creative Optimisation? Check out our extended guide: