The Alexa Auto SDK System Audio extension provides the default audio capturing and playback functionality for various platforms.
Table of Contents
The System Audio extension contains the platform implementations of:
aace::audio::AudioOutput
andaace::audio::AudioOutputProvider
for audio playback capabilityaace::audio::AudioInput
andaace::audio::AudioInputProvider
for audio capturing capability
Currently the System Audio extension supports:
- GStreamer tested with:
-
Generic Linux (Ubuntu 18.04)
Note: You'll need extra GStreamer plugins to play content from Amazon Music (which uses HLS) and other Music Service Providers. Installing plugins such as
gst-plugins-good1.0
,gst-plugins-bad1.0
, andgst-plugins-ugly1.0
is recommended.Note: GStreamer on Poky Linux for iMX8 does not support Audible or Amazon Music playback.
-
Automotive Grade Linux with 4A framework support (FF or GG)
-
- OpenMAX AL (Encoded audio playback only) tested with:
- QNX Multimedia Suite
- QNX Sound Architecture (QSA) (Raw audio only) tested with:
-
QNX 7.0.0
Note: You'll need a QNX Multimedia Suite license to use OpenMAX AL, and both OpenMAX AL and QSA are required in order to enable full funcitonality on QNX.
-
You'll need GStreamer development packages such as libgstreamer1.0-dev
and libgstreamer-plugins-base1.0-dev
.
The Alexa Auto SDK Builder automatically includes the System Audio extension when you build the Auto SDK. For example, assuming AAC_SDK_HOME
is the location where you've installed the Alexa Auto SDK, use this command to build the Auto SDK for generic Linux:
$ cd ${AAC_SDK_HOME}
$ builder/build.sh linux -t native [options]
When you run the C++ Sample App, a config-system-audio.json
file with default audio settings for Linux platforms is installed under /opt/AAC/etc
.
If you need to modify the configuration defined in the config-system-audio.json
file for your Linux platform, follow these steps:
- Open the
config.json.linux
file (located in theaac-sdk/extensions/system-audio/modules/system-audio/assets
directory). - Edit the
config.json.linux
file as necessary.
Note: For Poky 32 boards, you must set
"shared"
to"true"
in the"default"
node.
- Save the
config.json.linux
file asconfig-system-audio.json
under/opt/AAC/etc
. - Include a
--config /opt/AAC/etc/config-system-audio.json \
line when you run the C++ Sample App.
The default audio settings will not work for QNX. To modify the configuration defined in the config-system-audio.json
file for your QNX platform, follow these steps:
- Open the
config.json.qnx
file (located in theaac-sdk/extensions/system-audio/modules/system-audio/assets
directory). - Edit the
config.json.qnx
file as necessary. See the default QNX configuration for guidance. - Save the
config.json.qnx
file asconfig-system-audio.json
under/opt/AAC/etc
. - Include a
--config /opt/AAC/etc/config-system-audio.json \
line when you run the C++ Sample App.
Note: You may need to set the
AAL_CAPATH
system environment value to specify which path should OpenMAX AL used forCURLOPT_CAPATH
internally. If you don't set theAAL_CAPATH
system environment variable,/etc/ssl/certs
will be used by default.
For complex audio setup, you may need to write your own config file. To use this file, save it as config-system-audio.json
under /opt/AAC/etc
and include a --config /opt/AAC/etc/config-system-audio.json \
line when you run the C++ Sample App.
Here is the config file template:
{
"aace.systemAudio": {
"<provider>": {
"enabled": <boolean>,
"devices": {
"<device-name>": {
"module": "<module-name>",
"card": "<id>",
"rate": "<sample-rate>",
"shared": <boolean>
}
},
"types": {
"<type>": "<device-name>"
}
}
}
}
aace.systemAudio.<provider>
: Set toAudioInputProvider
orAudioOutputProvider
. You can write a configuration for each<provider>
, depending on the direction (input or output).aace.systemAudio.<provider>.enabled
: Set totrue
orfalse
. Setting this parameter tofalse
disables the registration of the<provider>
platform implementation. The default setting istrue
.aace.systemAudio.<provider>.devices.<device-name>
: Set to any"<device-name>"
or todefault
. If you set the"<device-name>"
to"default"
audio will be routed by default if there is no explicit"<device-name>
" available for the configured"<type>"
. You can configure multiple devices, depending on your platform."module"
: Specify a"<module-name>"
to explicitly define which audio backend to use. By default,"module"
is set to an empty string, which configures the system audio extension to use whatever backend is available."card"
: Specify the card id for the specific audio backend you defined with the"<module-name>"
parameter. By default,"card"
is set to an empty string since by default"<module-name>"
is not defined."rate"
: Specify the sample rate of audio input. By default the"rate"
is set to0
."shared"
(AudioInputProvider only): Set totrue
orfalse
. Set"shared:
totrue
for Poky 32 boards or in cases where the device should be shared within the Auto SDK Engine; otherwise, the System Audio extension will try to open the device for every audio input type. The"shared"
option is useful when the underlying backend doesn't support the input splitter. By default"shared"
is set tofalse
.
aace.systemAudio.<provider>.types.<type>
: Use the"type"
option to specify which device should be used for various types of audio. If you do not explicitly specify a device, thedefault
type is used. Seeaace::audio::AudioInputProvider::AudioInputType
andaace::audio::AudioOutputProvider::AudioOutputType
for the possible"<type>"
values.
Here is the default configuration for QNX platforms:
{
"aace.systemAudio": {
"AudioInputProvider": {
"devices": {
"default": {
"module": "QSA",
"shared": true
}
}
},
"AudioOutputProvider": {
"devices": {
"default": {
"module": "OpenMAX AL"
},
"raw": {
"module": "QSA"
}
},
"types": {
"COMMUNICATION": "raw"
}
}
}
}
If you use this configuration:
- The audio capturing for all types will use
QSA
, but it will be shared. This means that only a single PCM channel will be opened by the Engine. - The audio playback for all types except
COMMUNICATION
will useOpenMAX AL
.COMMUNICATION
audio will useQSA
instead. Note that the multiple PCM channels will be opened for each types.
Here is a configuration example for Linux platforms:
{
"aace.systemAudio": {
"AudioInputProvider": {
"devices": {
"default": {
"module": "GStreamer"
},
"loopback": {
"module": "GStreamer",
"card": "hw:Loopback,1,0",
"shared": true
}
},
"types": {
"LOOPBACK": "loopback"
}
},
"AudioOutputProvider": {
"devices": {
"default": {
"module": "GStreamer"
}
}
}
}
}
The above example shows how you could provide "Speaker reference" into the engine. Note that the card
parameter corresponds to the ALSA device name.
The System Audio extension supports playback of playlist URL from media streaming services (such as TuneIn) based on PlaylistParser
provided by AVS Device SDK. The current supported formats include M3U and PLS. Note that only the first playable entry will be played in the current implementation. Choosing a variant based on stream information or continuing playback of the second or later entry is not supported right now.
After the user asks Alexa to play on TuneIn, if Alexa acknowledges the request but says TuneIn is not available, the parser displays the following error:
2021-03-02 05:04:25.745 [AVS] E PlaylistParser:doDepthFirstSearch:url=http\://www.podtrac.com/pts/redirect.mp3/chtbl.com/track/5899E/traffic.megaphone.fm/HSW1953246087.mp3:getHeaderFailed
To avoid this error, provide a valid cacert.pem
to CURLOPT_CAINFO
in the Auto SDK configuration. Download the cacert.pem
file from here.
"libcurlUtils": {
"CURLOPT_CAPATH": "/path/to/certs",
"CURLOPT_CAINFO": "/path/to/cacert.pem"
}