Bluetooth® Low Energy audio - Telephony & Media Audio Profile


1 Introduction

The Telephony and Media Audio Profile is a Bluetooth® Low Energy Audio Profile specified by the Bluetooth SIG. It is categorized as a "use-case profile", meaning that it is a high-layer profile designed for a specific use case. The complete specification can be found on the Bluetooth SIG website[1]. Location of TMAP inside Bluetooth® Low Energy Audio Profiles architecture

The TMAP addresses the use-cases of Telephony and Media over Bluetooth® Low Energy Audio. This covers broadcast audio, where audio data is “broadcasted” from a broadcast source to an unlimited number of broadcast sinks, using broadcast isochronous streams (BIS). It also covers the unicast audio, where audio is streamed between two connected devices, allowing bidirectional streams and more efficient acknowledgment. For more details about unicast and broadcast features, see the wiki page "Introduction to Bluetooth® Low Energy Audio"[2].

2 Roles

The TMAP introduces six different roles:

  • Call Gateway: Based on the BAP unicast client, it concerns devices connected to networks used for telephony or voice over internet protocol (VoIP) applications. Example of devices implementing this role are smartphones, laptops, tablets, and PCs.
  • Call terminal: Based on the BAP unicast server, it concerns devices rendering audio for telephony and VoIP applications. Examples of devices implementing this role are earbuds, headphones, headsets, and speakers.
  • Unicast media sender: Based on the BAP unicast client, it concerns devices able to send media audio content using unicast. Example of devices implementing this role are smartphones, laptops, media players, TV, tablets, and PCs.
  • Unicast media receiver: Based on the BAP unicast server, it concerns devices rendering audio for media streams using unicast. Examples of devices implementing this role are earbuds, headphones, headsets, and speakers.
  • Broadcast media sender: Based on the BAP unicast client, it concerns devices able to send media audio content using broadcast. Example of devices implementing this role are smartphones, laptops, media players, TV, tablets, and PCs.
  • Broadcast media receiver: Based on the BAP unicast server, it concerns devices rendering audio for media streams using broadcast. Examples of devices implementing this role are earbuds, headphones, headsets, and speakers.

The requirements for the six roles are the following:

TMAP Role CAP Roles BAP Roles GAP Roles VCP Roles
Call Gateway Initiator & Commander Unicast Client Central Volume Controller
Call Terminal Acceptor Unicast Server Observer & Peripheral Volume Renderer
Unicast Media Sender Initiator & Commander Unicast Client Central Volume Controller
Unicast Media Receiver Acceptor Unicast Server Peripheral Volume Controller
Broadcast Media Sender Initiator Broadcast Source Broadcaster
Broadcast Media Receiver Acceptor Broadcast Sink & Scan Delegator Observer & Peripheral Volume Controller

3 TMAP advertising

A device implementing a TMAP role shall put a bitfield of the TMAP roles supported it in the advertising data. Advertising content of a TMAP device

4 Telephony and Media Audio Service (TMAS)

A device implementing a TMAP role (except for a BMS role) shall implement the GATT server role with one instance of Telephony and Media Service (TMAS). This service permits a remote TMA client to retrieve the roles of the device upon connection.

5 Telephony and Media Audio Profile application APIs

The following section lists and describes the APIs typically used in a TMAP application.

5.1 TMAP APIs

The following APIs are available for the TMAP:

TMAP_Init Initialize the Telephony and Media Audio Profile with the selected roles
TMAP_Linkup Link up the TMAP client with the remote TMAP server.
TMAP_DB_IsPresent Indicate if a TMAP database is saved in NVM
TMAP_BuildAdvPacket Build advertising packet for TMAP peripheral
TMAP_ReadRemoteTMAPRole Read the remote TMAP role value

5.1.1 TMAP initialization

1. First initialize the use-case device management module:

USECASE_DEV_MGMT_Init();

2. Then, initialize the TMAP with a TMAP_Config_t structure containing the desired roles, the maximum number of links and a pointer to a RAM section that contains the TMAP data:

static uint32_t aTMAPMemBuffer[DIVC(TMAP_DYN_ALLOC_SIZE,4)];
TMAP_Config_t tmap_config;

tmap_config.Role = Role;
tmap_config.MaxNumBleLinks = CFG_BLE_NUM_LINK;
tmap_config.pStartRamAddr = (uint8_t *)&aTMAPMemBuffer;
tmap_config.RamSize = TMAP_DYN_ALLOC_SIZE;
  
TMAP_Init(&tmap_config);

3. When implementing the CT or the UMR roles, mandatory published audio capabilities (PAC) must be registered using the following APIs:

CAP_RegisterSnkPACRecord(&aSnkPACRecord,&aSnkPACRecordHandle);
CAP_RegisterSrcPACRecord(&aSrcPACRecord,&aSrcPACRecordHandle);

5.1.2 Linkup remote TMAP server

To perform linkup on a remote TMAP server, use the dedicated API. If a database is already present, use the Restore mode.

/* Check if TMAP link is present in NVM from a previous connection*/
if (TMAP_DB_IsPresent(p_conn->Peer_Address_Type,p_conn->Peer_Address) == 0)
{
  TMAP_Linkup(ConnHandle, TMAP_LINKUP_MODE_COMPLETE);
}
else
{
  TMAP_Linkup(pNotification->ConnHandle,TMAP_LINKUP_MODE_RESTORE);
}

During the linkup process, the TMAP_REM_ROLE_VALUE_EVT and TMAP_LINKUP_COMPLETE_EVT events are generated:

void TMAP_Notification(TMAP_Notification_Evt_t *pNotification)
{
  switch(pNotification->EvtOpcode)
  {
    case TMAP_LINKUP_COMPLETE_EVT:
    {
      break;
    }
    case TMAP_REM_ROLE_VALUE_EVT:
    {
      uint16_t *tmap_role = (uint16_t *) pNotification->pInfo;
      break;
    }
  }
}

5.2 Audio stream management APIs

The following APIs are used by TMAP applications to manage audio streams:

API BAP Role(s) Description
CAP_Unicast_AudioStart Unicast client Configure and Start a broadcast source with the given parameters.
CAP_Unicast_AudioStop Unicast client Stop a broadcast source and go to configured or idle state.
CAP_Broadcast_AudioStart Broadcast source Configure and start a broadcast source with the given parameters.
CAP_Broadcast_AudioStop Broadcast source Stop a broadcast source and go to configured or idle state.
CAP_SetSnkAudioLocations Unicast server / Scan delegator Set/Update the supported sink audio locations.
CAP_SetSrcAudioLocations Unicast server / Scan delegator Set/Update the supported source audio locations.
CAP_RegisterSnkPACRecord Unicast server / Scan delegator Register published audio capabilities record for audio sink role.
CAP_RegisterSrcPACRecord Unicast server / Scan delegator Register published audio capabilities record for audio source role.
CAP_SetSupportedAudioContexts Unicast server / Scan delegator Set/Update supported audio context for reception and transmission.
CAP_SetAvailableAudioContexts Unicast server / Scan delegator Set/Update available audio context for reception and transmission.
CAP_RegisterAudioChannels Unicast server / Scan delegator Register sink/source audio channels (and associated audio stream endpoint) supported by unicast server.

For more details about the audio stream management procedures, see the architecture and integration wiki page[3].

5.3 Volume control management APIs

The following APIs are used by TMAP applications to manage volume control:

API VCP Role(s) Description
VCP_RENDER_SetAbsVolume Volume renderer Set the absolute volume of the local volume renderer
VCP_RENDER_SetMuteState Volume renderer Set the mute value of the local volume renderer.
CAP_VolumeController_StartSetVolumeProcedure Volume controller Start procedure to change the volume level on all the acceptors of the coordinated set acting in the VCP volume renderer role.
CAP_VolumeController_StartSetVolumeMuteStateProcedure Volume controller Start the procedure to change the (Volume) mute state on all the acceptors of the coordinated set acting in the VCP volume renderer role.

For more details about the audio stream management procedures, see the architecture and integration wiki page[4].

5.4 Media control management APIs

The following APIs are used by TMAP applications to manage media control:

API MCP Role(s) Description
MCP_SERVER_SetTrackTitle MCP server Set the title of the current track.
MCP_SERVER_SetTrackDuration MCP server Set the length of the current track.
MCP_SERVER_SetTrackPosition MCP server Set the current track position of the current track.
MCP_SERVER_NotifyTrackChanged MCP server Notify the remote MCP client that the track has changed.
MCP_CLIENT_MoveNextTrack MCP client Request the remote MCP server to move to the next track.
MCP_CLIENT_MovePreviousTrack MCP client Request the remote MCP server to move to the previous track.
MCP_CLIENT_PlayTrack MCP client Request the remote MCP server to start playing the current track.
MCP_CLIENT_PauseTrack MCP client Request the remote MCP server to pause the playing current track.
MCP_CLIENT_ConfigureTrackTitleNotification MCP client Configure the track title update notification.

For more details about the media control management procedures, see the architecture and integration wiki page[5].

5.5 Call control management APIs

The following APIs are used by TMAP applications to manage call control:

API CCP Role(s) Description
CCP_SERVER_SetActiveCall CCP server Set the current track position of the current track.
CCP_SERVER_TerminateCall CCP server Notify the remote MCP Client that the track has changed.
CCP_CLIENT_AnswerIncomingCall CCP client Set the title of the current track.
CCP_CLIENT_TerminateCall CCP client Set the length of the current track.

For more details about the media control management procedures, see the architecture and integration wiki page[5].

6 TMAP demonstrator using STM32WBA

The STM32WBA cube firmware allows to easily build and deploy TMAP unicast server and TMAP unicast client applications.

6.1 Project architecture

The figure below represents the firmware architecture of the TMAP unicast Server/Client example projects inside STM32CubeWBA MCU package. TMAP projects file architecture

6.2 TMAP demonstrator menus

The two TMAP projects present in STM32WBA cube firmware implement a menu displayed on the OLED Screen of the STM32WBA55G-DK.

6.2.1 TMAP unicast server screens

The following diagram show and describes the screens on the TMAP unicast server application: TMAP unicast server screens

6.2.2 TMAP unicast ClientScreens

The following diagram show and describes the screens on the TMAP unicast client application: TMAP Unicast ClientScreens

6.2.3 Audio streaming state screen

On the two TMAP unicast application, the screens displays the status of the audio stream when connected. The following table describes each possible screen:

No stream screen Displayed when a remote device is connected but no audio stream is established
Unidirectional Sink stream screen Displayed when a unidirectional stream is established with sink role
Unidirectional source stream screen Displayed when a unidirectional stream is established with source role
Bidirectional stream screen Displayed when a bidirectional stream is established (source + sink)

6.3 Demo using two STM32WBA

6.3.1 Hardware required

This demonstrator requires the following hardware:

  • 2x STM32WBA55G-DK boards
  • 1x Headphones/Headset with a 3.5mm jack cable, optionally with a microphone in which case the jack is 4-pin.

Additionally, as an audio source on the unicast client side, one of the following can be used:

  • 1x music source with a 3.5mm jack output (Laptop or smartphone with a jack output). If the music source is powered using a power supply, use a Ground Loop isolator device or run the laptop on a battery to avoid Ground Loop issues
  • 1x headset with microphone

6.3.2 Setup

The setup is as following: TMAP demonstrator setup (two STM32WBA)

6.3.3 Operate demonstrator

The two projects integrate a menu permitting to operate the demonstrator.

1. To establish the connection between the two STM32WBAs, press the right direction on the joystick of the unicast server to start advertising, then do the same on the unicast server to start scanning. Select your device in the list and press the right direction to initiate the connection.

2. Once the linkup is done on each side, access the menu using the right direction of the joystick

  • To start or stop an audio stream, navigate to the “Audio stream” submenu on the unicast client target and select the desired item list
  • To operate the unicast client volume, navigate to the “Local volume” on the unicast client target
  • To operate the unicast server volume, navigate to the “Remote Volume” submenu on the unicast client target, or navigate to the “Volume” submenu on the unicast server target

The following configurations are used in the unicast client project:

Configuration BAP audio configuration Legend Codec configuration
Media 4 ------->> 48_4
Telephony 3 <-------> 32_2

6.4 Demo using a STM32WBA and a compatible smartphone

The unicast client role can be managed by a smartphone compatible with LE audio. This allows to fully use the media control and call control brought by the media control profile (MCP) and call control profile (CCP).

6.4.1 Hardware required

  • 1x STM32WBA55G-DK boards
  • 1x headphones/Headset with a 3.5mm jack cable, optionally with a microphone in which case the jack will be 4-pin.
  • 1x smartphone compatible with LE Audio

The following smartphones are listed as compatible with LE audio

Brand Model Features ST compatible
Google Pixel 7/7Pro Unicast Yes
Google Pixel 8/8Pro Unicast Yes (only on 1.3.1 release)
Samsung Galaxy S23 Unicast No
Samsung Galaxy S24 Unicast No
Sony Xperia V 1/5 Unicast & Broadcast Yes (Broadcast), No (Unicast)

6.4.2 Setup

The setup is as following: TMAP demonstrator setup (Smartphone + STM32WBA)

6.4.3 Smartphone configuration

6.4.3.1 Google Pixel configuration & pairing

In order to first activate the experimental Bluetooth® Low Energy audio feature on Google Pixel smartphones, go to the Developer options menu and

  • Uncheck "Disable Bluetooth LE Audio
  • Check "Disable Bluetooth LE Audio hardware offload

How to enable LE Audio on Google Pixel smartphones

The first time you connect to a Bluetooth® Low Energy audio device, you have to enable the LE audio parameter in the device parameters. How to first pair a LE Audio device

6.4.4 Operate demonstrator

1. To establish the connection between the STM32WBA and the smartphone, press the right direction on the joystick of the STM32WBA unicast server to start advertising. Connect to the STM32WBA using the smartphone and unable LE Audio on the peripheral.

2. Use any media application (Spotify, YouTube, …) and start playing to establish a unidirectional audio stream between the two devices

3. Initiate or receive and accept a call on the smartphone using the cellular network or with a VoIP application to establish a bidirectional audio stream between the two devices.

The unicast server application can use the volume control profile (VCP), the media control profile (MCP), and the call control profile (CCP) to interact with the smartphone.

  • Navigate to the “Volume control” submenu, using the right direction of the joystick, to control the output volume of the unicast server. The smartphone should be notified of this volume change
  • Navigate to the “Media control” submenu to control the media currently played on the smartphone. The current track title and media state are retrieved and displayed on the screen of the unicast server. Use the up, right and down directions of the joystick to go to the next track, pause/play, or go to the previous track.
  • Navigate to the “Call control” submenu to control the calls received on the smartphone. The call state is displayed on the screen of the unicast server. Use the up and down directions of the joystick to answer or hang up a call.

7 References