Stream all audio FROM my android phone TO pulseaudio

I have seen a lot of apps and solutions online to receive audio from a desktop to an android phone. I also know how to stream audio from one desktop to another, using paprefs and pavucontrol.

What I want is to be able to stream from my Android phone to pulseaudio. There are individual apps with chromecast support, but then you're stuck with the app, and you need to be running something like Kodi on the desktop to receive it.

When you connect to a bluetooth audio source from Android, it just streams all outgoing audio. This is what I want to do over wi-fi, to pulseaudio. How can it be done?


Solution 1:

This can not be done

Don't read below if you are not interested in a solution for using DLNA-streams from Android to Ubuntu.


To send audio via a network connection from Android to Ubuntu you always need a renderer on your Ubuntu desktop and a streaming application on the android device. Android does not use pulseaudio as a sound server. We therefore depend on an additional app to send audio to the desktop.

There are several applications that can do this. I tested this successfully with gmediarender on the Ubuntu side and BubbleUpnp for Android.

  1. Install and run gmediarender on Ubuntu from the command line.

    sudo apt install gmediarender
    gmediarender -f <Name>
    

    Consult the manpage for more options.

  2. Install and run Bubble UPnP on the Android device.

  3. Search for the renderer name you gave in Bubble UPnP > Local Renderer

    enter image description here

  4. Select tracks to play on the Android device and listen to them on the Ubuntu machine.

    enter image description here

Note that this will also work for photos or video content you can stream to your computer using Bubble UPnP.

Solution 2:

I think a way better trade-off than the enormous stress with BubbleUpnp would be SoundWire. This will not stream to pulseaudio but to SoundWire server running on your Computer. But it will stream all audio from your Android device to it after and it can run in the background.

An alternative may be AirAudio but it needs root and it did not work for me even with Magisk...