You can make your Alexa Skills and Google Actions way more fun using MP3 files – to add sound effects, music, background, custom voices, etc.
SSML (Speech Synthesis Markup Language) is the specific feature that enables us to add MP3 files to Alexa Skills and Google Actions. However, the MP3 files have to meet certain criteria:
- Bit rate: 48 kbps
- Sample rate: 16000 Hz
In this post, I’m sharing the specific steps you can use to prepare your MP3 files to meet the above criteria.
Step-by-Step Instructions for Adding Audio Files to Alexa Skills & Google Actions
1. Select (or record) an audio file
Or you can record it yourself using a FREE tool such as Audacity.
2. Download & install Audacity
Audacity is a free tool that is available for Windows, Mac, and Linux. We’ll use it to prepare our audio files for use in Alexa Skills and Google Actions.
If you don’t have Audacity yet, you can download it from here and install it.
3. Open your audio file in Audacity
After you install Audacity, open your audio file in Audacity.
4. Set sample rate to 16000 Hz
As shown in the image below, set the sample rate to 16000 Hz in Audacity.
5. Export to MP3 file with 48 kbps bit rate
Click File > Export Audio in Audacity.
In the window that opens, select MP3 Files as the Format.
Then click Options. In the window that opens, select 48 kbps. Then click OK and Save. This will save your audio as an MP3 file with 48 kbps bit rate.
6. Host your mp3 file
Your MP3 file must be hosted on a server that meets the following criteria:
- File must have an internet-accessible address (URL)
- File must be delivered over HTTPS
Here’s an example that meets these criteria:
Amazon S3 is an easy way to host your MP3 file and meet these criteria. You can also host it using any other method that meets the above criteria.
7. Add mp3 file to your Alexa Skill and Google Action using SSML
The last step is to add your MP3 file to your Alexa Skill (or Google Action). You do this using SSML, here’s the sample SSML code:
<audio src="https://your-s3-bucket.amazonaws.com/your-audio-file.mp3" />
For a real-world example of a skill that uses audio files, check out our skill Know Your Animals, it’s a fun trivia game about animals!
Use Audio to Make Your Skills and Actions Stand Out
Adding audio files is a great way to make your Alexa Skills and Google Actions stand out. It’s also a great way to make them memorable. Just use the steps above – and of course, post a comment if you have any questions. Onwards!