How to Use Sound Templates

API.audio's sound design templates enable you to customise your script speech tracks with different sounds and effects.

API.audio currently offers over 40 different sound templates, with more added every week! The sound templates cover a vast array of different use cases and verticals ranging from fitness to advertising.

Sound Templates comprise sound segments and sound effects. Each template generally consists of 3 sound segments - intro, main and outro, and 3 sound effects (<<soundEffect::effect1>>), making it very convenient for you to pair speech with appropriate sounds, with no specialised audio knowledge required.

The difference between segments and effects is that sound segments play in the background of speech, whereas sound effects are standalone sounds to be used between speech sections and play without speech. Sound effect could be a whistle sound, an alarm clock ringing or dogs barking, for example.

To list all available sound templates:

#List all available sound design templates 
sound_templates = apiaudio.Sound.list()

You can also delve into these sound design templates. You can see below some of the tags that are available

Sound methods are:

list() List all the available sound templates in our api. 
The parameters are all optional, and can be used in 
combination to get the perfect sound for your usecase.

Parameters:
- industryExamples (string) - Try with one or more (separated by commas) of: news, 
travel, business, relaxation, fitness, relax, children stories
- contents (string) - Try with one or more (separated by commas) of: intro, 
main, outro, effect1, effect2, 
main outro, droid_main, chewie_main, 
effect3, ambience, only effects
- genre (string) - Try with one of: electronic, acoustic, 
atmospheric, abstract, rock
- tempo (string) - Try with one of: mid, up, down, uptempo
- tags (string) - Try with one or more (separated by commas) of: intense, minimal, reflective, melodic, happy, nostalgic, 
focus, energetic, uplifting, active, 
relaxed, ambience, mysterious, 
positive, informative, workout, 
work, meditation, travel, full silence

Getting Started

In order to use a sound design template you first need to create a script annotated by sections.
Each sound design template is carefully crafted with 3 main segments (intro, main and outro) and 3 effects.

Simply annotate your script in 3 sections, define sound segments as intro, main and outro, and add an effect to the beginning and/or the end. (In the near future version of sound design you will be able to use sound effects together with speech!)

There are 2 different ways to use sound templates in your script:

  1. Pairing a backing track with a speech section
text= """
<<soundSegment::intro>>
<<sectionName::intro>>
Here goes your text
"""
  1. Use a sound effect
text= """
Here goes your text and now a beautiful effect <<soundEffect::effect1>>
"""

For creating speech without any sound, simply do:

<<sectionName::hello>> your text

Example

Let's look through an example. In this case we are an ad company, wanting to create ads programmatically, in a few easy steps. Let's get started with creating a script.

First, let's divide our script into 3 sections. Intro, main and outro, using the following convention:

<<soundSegment::intro>>
<<sectionName::intro>>

Let's also add a sound effect to the very end

text= """   
    <<soundSegment::intro>>
    <<sectionName::intro>>
    This really is the final call for Hyundai's massive clear out sale! Only until midnight tonight!
    <<soundSegment::main>>
    <<sectionName::main>> 
    We're clearing out all remaining 2021 Hyundais at Ottawa's top volume Hyundai dealers. 
    These are the last days for clear out pricing and amazing clear out incentives. 
    <<soundSegment::outro>>
    <<sectionName::outro>>
    Get into a new Hyundai today. At Hyundai, better cars for passionate car drivers. 
    <<soundEffect::effect1>>
"""
script = apiaudio.Script.create(scriptText=text)
print(script)

Now let's create speech. You can choose a speaker, change the speed or apply some silence padding.
Let's define a sound template.
Notice that you can switch sound templates, while keeping the script unchanged! Try changing it to "headlines" for example.

r = apiaudio.Speech.create(
    scriptId=script.get("scriptId"),
    voice="aria",
    speed=120,
)
print(r)
template="jakarta"
r = apiaudio.Mastering.create(
    scriptId=script.get("scriptId"), soundTemplate=template
)
print(r)
url = apiaudio.Mastering.retrieve(scriptId=script.get("scriptId"))
print(f"✨ Mastered file for template ✨")
print(url)

Listen To How It Sounds

These examples are fully produced with the API, using synthetic voices and sound templates.

Car Ad Example
Ad example

Complete Example

import apiaudio
# # Make sure to import your API key
apiaudio.api_key ="API_Key"
text = """
    <<soundSegment::intro>>
    <<sectionName::intro>>
    This really is the final call for Hyundai's massive clear out sale! Only until midnight tonight!
    <<soundSegment::main>>
    <<sectionName::main>> 
    We're clearing out all remaining 2021 Hyundais at Ottawa's top volume Hyundai dealers. 
    These are the last days for clear out pricing and amazing clear out incentives. 
    <<soundSegment::outro>>
    <<sectionName::outro>>
    Get into a new Hyundai today. At Hyundai, better cars for passionate car drivers. 
    <<soundEffect::effect1>>
"""
script = apiaudio.Script.create(scriptText=text)
print(script)
r = apiaudio.Speech.create(
    scriptId=script.get("scriptId"),
    voice="aria",
    speed=120
)
print(r)
template="jakarta"
r = apiaudio.Mastering.create(
    scriptId=script.get("scriptId"), soundTemplate=template
)
print(r)
url = apiaudio.Mastering.download(scriptId=script.get("scriptId"), destination=".")
print(f"✨ Mastered file for template ✨")
print(url)