Sometimes we may have the need to listen to voice messages or watch a video while studying or working in a dormitory or office, but it is not convenient to play the sound out loud, and we don't want to constantly switch headphones (being lazy). In such scenarios, this kind of demand can be fulfilled.
Personal Application Scenarios#
iPad audio taken over by a computer, iPad placed nearby automatically plays TikTok, listens to music, as shown below:
There are also many other requirements that depend on individual circumstances.
On Windows 10 and above platforms, we can easily achieve this through a software. We only need to download a software called Bluetooth Audio Receiver from the Microsoft Store.
The usage of Bluetooth Audio Receiver is very simple and has two main requirements:
- The computer must have Bluetooth functionality or a Bluetooth adapter.
- Pair and connect the phone (or any A2DP-supported playback device) with the computer via Bluetooth.
Then run Bluetooth Audio Receiver, select the phone you want to play music from in the list, click Open Connection, and finally play music on the phone.
On the Linux platform, it may be a bit more complicated, but if you are already using Linux, installing a few software packages with a few commands should be a piece of cake.
First, make sure you have installed Bluez, Pulseaudio, and the pulseaudio Bluetooth module on your Linux system. Most Linux distributions come pre-installed with these tools. In case they are missing, install them as shown below.
Installing Bluez on Linux#
To install Bluez on Arch Linux and its variants, run:
$ sudo pacman -S bluez
On Debian and Ubuntu:
$ sudo apt install bluez
On Fedora, CentOS, and RHEL:
$ sudo dnf install bluez
$ sudo yum install bluez
$ sudo zypper install bluez
After installing Bluez, make sure the Bluetooth service is started and enabled at boot.
$ sudo systemctl start bluetooth
$ sudo systemctl enable bluetooth
To verify the Bluetooth status, run:
$ systemctl status bluetooth
Installing Pulseaudio on Linux#
PulseAudio is an open-source, cross-platform, networked sound server program distributed through the freedesktop.org project. It supports Linux, as well as various BSD distributions such as FreeBSD and OpenBSD, and macOS. Pulseaudio is available in the default repositories of most Linux distributions. To play audio via Bluetooth, we should install the pulseaudio Bluetooth module.
Run the following command to install Pulseaudio and other required programs on Arch Linux and its variants like EndeavourOS and Manjaro Linux:
$ sudo pacman -S pulseaudio pavucontrol pulseaudio-bluetooth
On Debian, Ubuntu, and Linux Mint, simply run:
$ sudo apt install pulseaudio pulseaudio-utils pavucontrol pulseaudio-module-bluetooth
On Fedora, RHEL 8, AlmaLinux 8, and Rocky Linux 8:
$ sudo dnf install pulseaudio pulseaudio-utils pavucontrol pulseaudio-module-bluetooth
On CentOS 7.x and RHEL 7.x:
$ sudo yum install pulseaudio pulseaudio-utils pavucontrol pulseaudio-module-bluetooth
$ sudo zypper install pulseaudio pulseaudio-utils pavucontrol pulseaudio-module-bluetooth
Pairing Linux PC with Phone#
Make sure your phone is paired with your PC. Bluetooth pairing is very simple! You may have done it many times before. I won't go into detail here, but if you're lucky, you should be able to hear the sound from your phone through your computer after connecting. If not, you may need to continue with the following steps.
Create a file named ~/.config/pulse/system.pa:
$ mkdir ~/.config/pulse/
$ nano ~/.config/pulse/system.pa
Add the following lines to the file:
Save and close the file. Restart the Bluetooth service to apply the changes:
$ sudo systemctl restart bluetooth
You can directly edit the "/etc/pulse/system.pa" file and make the changes. However, it is strongly recommended not to edit system-wide configuration files and instead edit user-specific configuration files. That's why you should create the "~/.config/pulse" directory, copy the system configuration file into it, and edit it according to your needs. The "~/.config/pulse/default.pa" file is not a complete copy, but it can start with the line ".include /etc/pulse/default.pa" and then override the defaults. This way, we can avoid problems when pulseaudio is updated in the future.
You have now completed all the steps. Just enjoy it!
Reference article: Turn Your Linux PC Into Bluetooth Speakers For Your Phone - OSTechNix