Audio User Data

Description

This application uses the SPARK Wireless Core to send data in addition to the audio stream. It showcases the possibility of using custom processing stages with the SPARK Audio Core to enable data transmission within the same audio packet. Communication is between a Coordinator device and a Node device.

Behavior

The exchange of information is made possible by an application processing stage registered to the audio pipeline. If the user data is valid, this processing stage appends 1 byte of user data to the transmitting device’s audio samples. The receiving device also uses a custom processing stage to decapsulate this byte if present.

In this application, the Coordinator device’s switches are used to set the value of the user data byte. A LED is used on the Node device to reflect the value of the received user data.

The following diagram illustrates the general structure of the schedule used in this application.

Audio User Data schedule

Figure 13: Audio User Data application’s schedule.

Coordinator Device

  • Press SW1 to turn on or SW2 to turn off LED2 on the Node.

  • LED0 toggles every time a packet is successfully transmitted to the Node (almost always on because of the high packet rate).

Interface

Name

Description

SW1

Turn ON LED

Send SW1 state to Node and turn ON its LED2.

SW2

Turn OFF LED

Send SW2 state to Node and turn OFF its LED2.

LED0

Transmission Success

Toggle LED when a wireless transmission is successful.

LED1

N/A

N/A

LED2

N/A

N/A

Node Device

  • SW1 and SW2 are used to turn the volume up and down respectively. By default, the volume is at the maximum level.

  • LED1 toggles every time a packet is successfully received from the Coordinator (almost always on because of the high packet rate).

  • LED2 is turned on or off based on the value of the received user data byte (controlled by SW1 and SW2 on the Coordinator).

Interface

Name

Description

SW1

Volume Up

Raises the volume (default at 100%).

SW2

Volume Down

Lowers the volume.

LED0

N/A

N/A

LED1

Reception Success

Toggle LED when a wireless reception is successful.

LED2

Switch Press Event

Turn on or off depending on the Coordinator switch press event.

User Data Processing Stage

On the coordinator device, a user data byte will be appended to the audio payload upon activation of a User Button (SW1 or SW2). There is no user data appended to the audio stream when none of the switches are pressed.

When receiving an audio packet, the node checks if the user data byte is present by comparing the received payload size with the expected audio payload size. If there is a user data byte, the processing stage will extract it and make it available to the application.

Note

This processing stage is registered last on the Coordinator’s TX audio pipeline and first on the Node’s RX audio pipeline. This is done so that the user data byte is not processed by the Audio Core’s processing stages. The user data byte is inserted in the last pipeline stage by the Coordinator and then immediately removed by the Node upon reception prior to any additional processing that would occur in subsequent audio pipeline stages.

Configuration

This application does not require specific configurations.