Configuring Linux as an A2DP Audio Sink
In the last post I described how to configure a Bluegiga WT-32 Bluetooth audio module to stream audio via the A2DP profile. All that was needed was to connect to the module via the WT-32 serial port, activate the A2DP source profile, and connect the audio to the audio inputs. Now it’s necessary to configure the A2DP sink.
The information for configuring the A2DP sink comes from João Paulo’s mini-tutorial for configuring the PulseAudio A2DP sink and this thread from the Ubuntu forums. I recommend you read these before proceeding; the instructions given below are taken from them, only updated specifically for Linux Mint 9.
Before starting ensure you have the following software installed:
BlueZ Bluetooth protocol stack
Blueman Bluetooth manager
PulseAudio audio server
PulseAudi volume control
The versions installed as part of Linux Mint 9 are recent enough to serve our purposes. If one of these does not come installed as part of Linux Mint 9 it can be obtained from the repositories.
To enable the A2DP sink:
1. Enable the A2DP source interface on BlueZ.
a. Open the file /etc/bluetooth/audio.conf in a text editor and add the following line:
right after the line containing ‘[General]’.
b. Restart the system. (This step only has to be done the first time you configure the audio sink.)
2. Connect the Linux system to the WT-32 A2DP source.
a. Left-click the Blueman icon in the system tray to start the manager. If the WT-32 module doesn’t show up in the list select Adapter : Search to locate it.
b. Once the WT-32 shows up in the list of Bluetooth devices, click it and select Device:Setup. The Bluetooth Assistant form will open and prompt for a passcode. Select Proceed Without Pairing and click Forward.
c. A form prompting for the WT-32 PIN will be displayed. Enter the PIN and click OK.
d. Now you will get a form asking to which of the WT-32 streams you wish to connect. Select A2DP Source and click Forward.
If all has gone well you will see the message “Device added and connected successfully.” Click Close. The Bluetooth manager should have a display similar to the one shown below.
To check the connection select Menu:Sound & Video:PulseAudio Volume Control. When the application opens select the Input Devices tab. The WT-32 should be listed as one of the input devices. If you feed audio into it you should see the sound level changing as the sound changes.
3. To connect the Bluetooth audio to the system speakers:
a. Open a terminal and execute the following command:
pactl list | grep Name:
The result will be a list of names associated with alsa modules, sources, and sinks.
b. Look for the alsa analog stereo output to identify the sink. On my system it takes the form alsa_output.pci-0000_00_1f.5.analog-stereo.
c. Look for the Bluetooth source to identify the source. It will be of the form bluez_source.XX_XX_XX_XX_XX_XX where XX_XX_XX_XX_XX_XX represents the WT-32 MAC address. This is the same address displayed in the Bluetooth manager.
d. Open a terminal and execute the command:
pactl load-module module-loopback source=<name> sink=<name>
where the source and sink names are those identified above. Please note the source and sink names are case sensitive.
At this point if you feed audio into the WT-32 you should hear it in the system speakers.