Try using your Android device as an audio receiver for your Linux desktop

Overview

There are Bluetooth earphones and Bluetooth receivers, but it's a pain to charge. If you use a smartphone, you can basically charge it, and it would be nice if you could keep the earphones stuck in the smartphone and hear the sound of the PC from the smartphone when using the PC, right?

Linux PC sound-> LAN-> Android device earphone or speaker That's why.

Yes. let's do it.

Method

Use PulseAudio's ** module-simple-protocol-tcp **. PulseAudio is a sound server for managing audio input / output devices, but it also has a function to send audio to PulseAudio on another host via TCP.

However, the client this time is an Android device. Therefore, use the application ** PulseDroid **. This app is an open source Android app that plays the data sent over TCP with module-simple-protocol-tcp on Android. It's a very old app, but it can be used on Android 10 smartphones without any problems **.

PC side settings

$ pactl load-module module-null-sink sink_name=TCP_output
$ pacmd update-sink-proplist TCP_output device.description=TCP_output
$ pactl load-module module-simple-protocol-tcp rate=48000 format=s16le channels=2 source=TCP_output.monitor record=true port={Appropriate port number} listen=0.0.0.0

After that, start pavucontrol.

image898.png

Set the output destination of the output you want to transfer from the "Playback" tab to "TCP_output".

Android side settings

Download the Android app. https://github.com/dront78/PulseDroid/raw/master/bin/PulseDroid.apk

When you install and start it, it will be displayed like this.

Set the IP address of the PC in the Server and the port number you decided earlier in the Port, and press the Start button, and the sound should start playing! !! image877.png

The new Android device has a function to automatically end the background process in a certain time to reduce power consumption. Therefore, if you install an application before this function is adopted, the background process may end unexpectedly. As with PulseDroid, the sound disappears after a while.

To avoid this, select "Do not optimize" from Settings-> App information-> PulseDroid-> Advanced settings-> Battery optimization.

You should now be able to use it for hours! !! !! !!

Note 1

You can't hear it unless you start it with PulseDroid after load-module. (If it is reversed, simply restart PulseDroid and it's OK)

Persistent setting

If you want to turn it on automatically at startup on your PC, write it in the configuration file. .config/pulse/default.pa

.include /etc/pulse/default.pa

load-module module-null-sink sink_name=TCP_output
update-sink-proplist TCP_output device.description=TCP_output
load-module module-simple-protocol-tcp rate=48000 format=s16le channels=2 source=TCP_output.monitor record=true port={Appropriate port number} listen=0.0.0.0

Recommended Posts

Try using your Android device as an audio receiver for your Linux desktop
Try using a Linux server as a backup destination for Time Machine (Ver. 2020)
Boot Arch Linux from your Mac or Android using WOL