Main Content

Simulate Multistream Audio in Hearing Aid Scenario

This example shows how to create, configure, and simulate multistream audio in a telephony scenario for hearing aids by using Bluetooth® Toolbox and the Communications Toolbox™ Wireless Network Simulation Library.

Using this example, you can:

  1. Create a telephony scenario for hearing aids consisting of a source node and two sink nodes.

  2. Establish asynchronous connection-oriented (ACL) and connected isochronous stream (CIS) connections between the source node and sink nodes.

  3. Generate, configure, and add on-off application traffic from the source node to the sink nodes.

  4. Simulate the scenario and get the statistics.

Hearing Aid Scenario

Multistream audio capability of Bluetooth LE technology enables you to transmit multiple, independent, synchronized audio streams between an audio source device, such as a smartphone, and one or more audio sink devices such as earbuds. To support multistream capability, Bluetooth LE audio uses CIS and connected isochronous group (CIG). For more information about CIS and CIG, see Bluetooth LE Audio. Building on its low power, high quality, and multistream capabilities, LE audio adds support for hearing aids. LE Audio enables the development of Bluetooth hearing aids that bring all the advantages of Bluetooth audio to the growing number of people with hearing loss. This figure illustrates a basic telephony scenario for hearing aids, enabling the hearing aids to connect to a mobile phone.

bluetooth_multistream_audio_hearing_aid_scenario.png

The audio source, a smartphone, sends distinct right and left audio streams to the right sink (right hearing aid) and left sink (left hearing aid), respectively. Initially, the source establishes ACL links with both the sink nodes. The source transmits the control data for audio streaming over the ACL links by using the connection events. The source then transmits audio data to the right Sink and left Sink by using their respective CIS events.

Create and Configure Scenario

Check if the Communications Toolbox™ Wireless Network Simulation Library support package is installed. If the support package is not installed, MATLAB® returns an error with a link to download and install the support package.

wirelessnetworkSupportPackageCheck

Initialize the wireless network simulator.

networkSimulator = wirelessNetworkSimulator.init;

Create a Bluetooth LE Central node and two Peripheral nodes. The Central node represents the source, and the two peripheral nodes represent the right sink and left sink.

source = bluetoothLENode("central",Name="Source");
rightSink = bluetoothLENode("peripheral",Name="Right Sink");
leftSink = bluetoothLENode("peripheral",Name="Left Sink");

Create a Bluetooth LE CIS configuration object, specifying the isochronous interval and number of subevents of a CIS connection between the source and right sink.

cfgCISRightSink = bluetoothLECISConfig(ISOInterval=30e-3,NumSubevents=2);

Create a Bluetooth LE connection configuration object, specifying the connection interval, active communication period, and access address of a connection event between the source and right sink. Configure the CIS connection between the source and the right sink.

cfgConnectionRightSink = bluetoothLEConnectionConfig(ConnectionInterval=60e-3, ...
    ActivePeriod=10e-3,AccessAddress="5DA44270");

[connectionConfigRightSinK,cisConfigRightSink] = configureConnection(cfgConnectionRightSink, ...
    source,rightSink,CISConfig=cfgCISRightSink);

Create a Bluetooth LE CIS configuration object, specifying the isochronous interval and number of subevents of a CIS connection between the source and left sink.

cfgCISLeftSink = bluetoothLECISConfig(ISOInterval=30e-3,NumSubevents=1);

Create a Bluetooth LE connection configuration object, specifying the connection interval, offset for the starting connection event, active communication period, and access address of a connection event between the source and left sink. Configure the CIS connection between the source and the left sink.

cfgConnectionLeftSink = bluetoothLEConnectionConfig(ConnectionInterval=60e-3, ...
    ConnectionOffset=30e-3,ActivePeriod=10e-3,AccessAddress="5DA44271");

[connectionConfigLeftSink,cisConfigLeftSink] = configureConnection(cfgConnectionLeftSink, ...
    source,leftSink,CISConfig=cfgCISLeftSink);

Add Application Traffic

Generate an on-off application traffic pattern by using the networkTrafficOnOff object. Configure the on-off application traffic by specifying the application data rate and packet size. Add application traffic from the source to the right sink and left sink nodes.

trafficSourceToRightSink = networkTrafficOnOff(DataRate=200,PacketSize=100,GeneratePacket=true);
addTrafficSource(source,trafficSourceToRightSink,DestinationNode=rightSink,CISConfig=cisConfigRightSink)

trafficSourceToLeftSink = networkTrafficOnOff(DataRate=100,PacketSize=100,GeneratePacket=true);
addTrafficSource(source,trafficSourceToLeftSink,DestinationNode=leftSink,CISConfig=cisConfigLeftSink)

Simulate the Scenario and Get Statistics

Add the source, right sink, and left sink nodes to the wireless network simulator.

addNodes(networkSimulator,[source rightSink leftSink])

Set the simulation time, in seconds, and run the simulation.

run(networkSimulator,0.5)

Retrieve statistics for all the nodes. For more information about these statistics, see Bluetooth LE Node Statistics.

sourceStats = statistics(source)
sourceStats = struct with fields:
    Name: "Source"
      ID: 1
     App: [1x2 struct]
      LL: [1x2 struct]
     PHY: [1x1 struct]

rightSinkStats = statistics(rightSink)
rightSinkStats = struct with fields:
    Name: "Right Sink"
      ID: 2
     App: [1x1 struct]
      LL: [1x1 struct]
     PHY: [1x1 struct]

leftSinkStats = statistics(leftSink)
leftSinkStats = struct with fields:
    Name: "Left Sink"
      ID: 3
     App: [1x1 struct]
      LL: [1x1 struct]
     PHY: [1x1 struct]

References

[1] Bluetooth® Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed June 22, 2023. https://www.bluetooth.com/.

[2] Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification." Version 5.3. https://www.bluetooth.com/.

See Also

Objects

Related Topics