Easily Stream A2B Audio Directly to Disk with the Promira Serial Platform

The new A2B Bus Monitor Application for the Promira Serial Platform® provides automotive audio engineers an easy-to-use web interface to non-intrusively monitor Analog Devices' Automotive Audio Bus (A2B).

One of the key benefits is seeing the levels of all upstream and downstream digital audio channels simultaneously. Live audio on the A2B bus can also be streamed through the web interface. This instantaneous feedback can help engineers verify channel alignment to make sure the  audio is right where it should be.

After a capture is stopped, an audio sample can be downloaded as a multi-channel WAV file through the web interface. However, the capture buffer in the A2B Bus Monitor is limited to less than 15 seconds. If more audio data is needed,  the WebSocket interface of the A2B Bus Monitor can be used to stream audio data directly to a disk.

To help developers get started, a sample Python script can be downloaded here. This example package includes the script  audio_capture.py and documentation about how to run it. This script requires Python 3, which can be downloaded for free from the Python website.

The audio_capture.py script captures one or more audio streams to disk as 32-bit signed, mono, little-endian PCM files, one file per channel. When the script is invoked with no arguments, the following information is displayed:

     > python audio_capture.py
     usage: example URL SAMPLE_RATE CH1 CH2 CHn...
     URL must start with ws:// or wss://
     SAMPLE_RATE is the audio sample rate in Hz, e.g. 48000
     CH1... is a list of channels to record as integers

Here is an example of how you would invoke the script and the expected output. Please note that [PROMIRA_IP] should be replaced with the specific IP address of your Promira Serial Platform. Cownstream audio channels are numbered 0 through 13, and upstream audio channels are numbered 32 through 45. In this example, the script is streaming the first upstream audio channel (32) to disk.

     > python audio_capture.py ws://[PROMIRA_IP]/api 44100 32
     Starting capture...
     Audio streaming...
     ch: 32 ts: 13.385327140000001
     audiofile setOffset: 2569982
     ch: 32 ts: 13.48532714 stream: 19200 bytes
     ch: 32 ts: 13.58532714 stream: 19200 bytes
     [...]
     ch: 32 ts: 30.985327140000205 stream: 19200 bytes
     ^C
     Stopping capture...
     Stopping streaming...
     Disconnecting...
     Done.

When the script has finished, the file  raw-audio-ch32.pcm should be located in the directory where the script was run.

Have questions? Click below if you would like to learn more, or have a personal demo designed to specifically address your needs.

Request a Demo