Base Component Properties (APL for Audio)

A component is a primitive element that generates an audio clip when Alexa inflates your document. For example, a simple Speech component defines text to convert to speech. The Audio component identifies an audio file to play. Other components let you mix and arrange the speech and audio in different ways.

Properties

All components support the following properties.

Property Type Default Description
bind Array of Binding [] Expressions to add to the data binding context.
description String "" Optional description of this component.
id String "" A unique ID you provide for the component, used to refer to the component from other components.
type String REQUIRED The type of the component.
when Boolean true When true, the document inflates this component. When false, the document ignores this component and all of its child components.

The Default column lists the default values of properties. All REQUIRED properties must be set for the component to render.

bind

The bind property of a component extends the data-binding context for the component and its children. The bind property specifies an ordered set of data-bindings that extend the current context. Bindings are ordered; later bindings can use previous definitions.

The bind property evaluates after the when property for the component and before any other properties.

Each binding object in the binding array contains the following:

Property Type Default Description
name String REQUIRED The name to use for this binding. Must be a valid name.
value Any REQUIRED The value to assign to this binding.
type any, boolean, string, or number any Property type.

The following example illustrates how a later binding might use the results from an earlier binding.

{
  "type": "Speech",
  "bind": [
    {"name":"FirstName","value":"Jasmine"},
    {"name":"LastName","value":"Smith"},
    {"name":"Title","value":"Dr."},
    {"name":"FormalName","value":"${Title} ${LastName}"}
  ],
  "content": "Should I call you ${FirstName} or ${FormalName}?"
}

In this example, FormalName depends upon the prior definitions of Title and LastName. The final text is “Should I call you Jasmine or Dr. Smith?”. This example is contrived. In actual use the values of FirstName, LastName, and Title would be bound to elements provided in the raw data.

Capitalize your bound property names to avoid conflicts with intrinsic component properties. For example, use "MyCounter" or "MY_COUNTER" instead of "myCounter".

description

A string that describes the component, for documenting your APL document. Including descriptions for your components in the context of your document makes your document easier to read and understand. The description has no effect on the rendering the component.

id

A developer-assigned string value used to refer a particular component in the document. The valid characters in an id are [_a-zA-Z0-9]+. The id is not required to be unique, but uniqueness is recommended.

type

Specifies the particular component to inflate. This must be one of the supported primitive components:

The type property is required.

when

When true, inflate the component. When false, ignore the component and all child components.

When not specified, when defaults to true.

Available components for APL for Audio

The following components are available:

You can apply filters to an audio component to modify an audio clip as it streams. For more details, see Filters.