How to select a recommended voice for your Audio Asset
If you don't want to choose a voice from the library, we can give you some recommendations
Choosing the right voice for your project can take time. By using the /voice/select
endpoint, you can request a list of the five most suitable voices for your script, based on a provided ScriptID or content.
Code Example
import audiostack
import os
audiostack.api_key = os.environ['AUDIOSTACK_API_KEY']
advert = (
"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"
)
print("Creating your script from text...")
script = audiostack.Content.Script.create(scriptText=advert)
print("Finding the most relevant voice recommendations...")
req = audiostack.Speech.Voice.select_for_script(scriptId=script.data["scriptId"])
for i in req.data["voices"]:
print(f'{i["alias"]} is the perfect narrator for your script!')
print(f"Generating speech for {i['alias']}")
speech = audiostack.Speech.TTS.create(scriptItem=script, voice=i["alias"])
print("Creating your audio asset...")
mix = audiostack.Production.Mix.create(speechItem=speech, soundTemplate="pulsing_guitar", masteringPreset="balanced")
print("Downloading your MP3")
encoder = audiostack.Delivery.Encoder.encode_mix(productionItem=mix, preset="mp3")
encoder.download(fileName=f"{script.scriptName}__{i['alias']}.mp3", path=".")
Updated 5 months ago