Audio (APL for Audio)
Audio component plays the provided audio file, such as an MP3 file.
Audio component has the base component properties and the following component-specific properties:
|Specifies the URL for a remote audio file to play.
Specifies the URL for a remote audio file to play. The URL must reference an audio file that meets the audio file requirements.
source property accepts a single URL to play a single audio file. To play a series of audio files, use a
Sequencer component with
Audio as its child component.
Alexa Skills Kit Sound Library support
Audio component supports the Alexa Skills Kit Sound Library for playing sound effects.
When you copy code for a sound from the sound library documentation, the code includes the full Speech Synthesis Markup Language (SSML)
audio tag. Extract the URL for the sound and assign it to the
source property of the
For example, copying the sound "nature_08" copies the following SSML code.
To use this in the
Audio component, assign the URL
soundbank://soundlibrary/water/nature/nature_08 to the
source property as shown in this example.
The following example loads and plays a random sound from the sound library. Click the Load Audio button to play the clip the first time. Click the Reload button to load a different randomly-chosen sound. This example uses a hard-coded array of the sound library sounds in the data source.
Audio file support
Audio files used with the
Audio component must meet the following requirements.
Audio input formats
Audio component supports audio files in the following formats:
Audio input requirements
The audio file must meet the following requirements:
- Bit rate – The bit rate must be less than or equal to 1411.20 kbps.
- Sample rate – The sample rate must be less than or equal to 48kHz.
- File size – The file size of the audio clip can't be greater than 10 MB. If your file size is larger than 10 MB, consider editing the duration of the file or converting the file to another format, such as MP3 or Opus.
- Response length – The combined total time for the entire audio response generated from the components can't be more than 240 seconds.
Any URL provided in an APLA document, such as with the
source property in an
Audio component, must comply with the following:
- HTTPS – The audio file must be hosted at an Internet-accessible HTTPS endpoint.
- SSL certificates: – The domain hosting the audio file must present a valid, trusted SSL certificate. Avoid self-signed certificates. APL and Alexa Skills both use the same trusted list of CAs: List of trusted CAs from Mozilla
- CORS wildcards – Audio files must be CORS wildcard-enabled. The service must respond with the following header:
Supported channel layouts
The APL rendering engine supports the following channel layouts as input:
Maximum concurrently mixing audio sources
You can mix no more than four audio sources together at any given moment.
This example plays the rainforest sound stored at the specified URL. In this example, the audio file at the URL
https://example.com/mySampleAudio/rainforestSoundEffect.mp3 must meet the requirements described in Audio file support
This example plays the bird sound effects provided in the ASK sound library.
Was this page helpful?
Last updated: Nov 28, 2023