Introduction
Our text to sound effects model enables you to create high-quality sound effects from a short description. These sound effects could be used in a variety of applications, including game development and building apps for music production. In this tutorial, we will use the text to sound effects API to generate a sound effect from a short description using the Python SDK. We’ll then save this sound effect to a file.For general tips on prompting, see the sound effects product
docs. And for information on the API
configuration visit the API reference.
How to generate a sound effect with the API
Requirements
Before proceeding, please ensure that you have the following:- An ElevenLabs account with an API key (here’s how to find your API key)
- Python or Node.js installed on your machine
.env
file in your project directory and fill it with your credentials like so:
.env
Using the sound effects SDK
Now we can use the SDK to generate a sound effect from a short description and save it to a file as shown below.Configuration
duration_seconds
: The duration of the sound effect in seconds. If not provided, the API will automatically determine the correct length. The maximum value is 22prompt_influence
: The amount of influence the prompt has on the generated sound effect. If not provided, the API will use the default value of 0.3
API pricing
The API is charged at 100 credits per generation with automatic duration or 20 credits per second with a set duration.Next steps
We’re excited to see what you build with the API. Here are some ideas of what you might want to use it for:- Adding sound effect generation to a video editing application
- Enabling users to create on-demand samples for their music production
- A new type of video game where every sound is generated dynamically