Stream audio from one device to another

Hello!

Hopefully a simple question: is it possible to stream audio from on Librem device to another?

For more background, I used to have an Apple TV that I could stream music and podcasts to from my phone or laptop via Airplay. Ive replaced the Apple TV with a LibremMini and would like to stream to it in a similar way.

Thanks!

Yes with AudioSharing.

And to bluetooth speakers. :crazy_face:

You have a LOT of options here, depending what you want to do.
Would streaming through a web browser on your phone be acceptable? Or would you expect it in an app?

I can’t vouch for everything on this list but I’ve used a couple. This should give you some idea but really there are so many ways of doing what you are looking for:

Main use case would be playing a podcast in the gnome podcasts app or music in Lollypop and wanting to send that audio to the mini so it can play through speakers connected to my TV. So, ideally it would only stream audio from a specific app and not the entire device, though that would be okay, too. As little action on the mini as possible would be great since I dont usually have a keyboard or mouse attached.

1 Like

smb file share
nfs file share
a media server like emby
stuff like https://www.musicpd.org/

VLC might also be able to do that, but last time I was trying that it was in 2003.

Actually I am tinkering with a similar problem and a possible solution - since most of the existing solution for me do not offer a similar convenience of AirPlay or Chromecast.

I have started to document and implement an idea here:

My basic idea is that pretty much anything these days that can play media (audio and/or video) can also stream that media from an http source. The problem I want to solve is that e.g I have media files on my laptop and want to have these played back on some remote device -like $something connect to my TV or $something-else connected to my stereo etc. And I do not want to first either copy that file to $somewhere (which I would need for solutions like MPD) and I also do not want to send e.g. the decoded audio through some pulseaudio pipe or something.

So my idea is to handle all that via http - a receiver and a sender. The receiver will listen on port 4424 (that’s what I use for now) for incoming http POST JSON requests. Via JSON you can set a source URL and start/stop/control the playback. On the sender side it can either just configure some $URL on the receiver and start the playback (say, to playback an internet radio URL) or if the argument is a local file, then the sender will spawn a local http server serving just this single file on a random port, construct an URL and specify this to the receiver.

This is petty simple, straight forward and can be implemented on a variety of devices. The above Github project contains an initial Linux implementation of that idea which already works quite well (still lots of things to do). I am also working on something to create a simple speaker device using an ESP32, start is coming along here:

At least this will solve my needs… maybe it can also be useful to others? And now of course you can all tell me which projects I missed that already solve exactly this problem but in much better ways :slight_smile:

PS: I have also been tinkering with RTP multicast but I am not really sure if this solves any of these problems in some usable way… it rather introduces more complexity.

Cheers
nicole

3 Likes

I looooove this! As described, that is. I haven’t had a chance to build/try it out myself yet. Do you see any barrier to building some kind of interface (maybe as a menu bar widget) that could send whatever audio is playing to the receiver? I assume with the “everything is a file” design of Linux that it should work…

In the case of musicpd, the content needs to be hosted on the server? The other options theoretically work, but not in the low contact way I’m looking for. I just want the receiving device to play the audio and not require me to locate the file/content that I want to play for it.

This seems like a promising option. Is there a way to invoke the receiving device to play in a way other than scanning a QR code or manually entering the URL? I’d like the receiving device to be more like a server that you can send a command/audio to in order to play it.

1 Like

Is it possible to make the mini look like bluetooth speakers? That would be a simple solution.

Yes you can enter manually the URL and leave opened the browser or vlc player, then when you want stream audio just open AudioSharing on the transmitter device.

When I want to stream audio to another device, I usually just enable network access to PulseAudio via paprefs and then I can see the other device as a yet another audio output I can switch to.

2 Likes

I am more thinking towards protocol and test implementations, but of course, yes, something like GUI button/widget/applet etc. is of course totally feasible, just that I will not implement it now (which is also in part due to the fact that I am not a great UI and/or UI framework developer… so I would leave this to others).

All of that stuff is still in early stages so it will still take some time… but the longer I am working on it the more ideas I get for extension and further development, with which I again need to be careful so I do not get distracted or carried away and in the end do not get anything done :wink:

Just during the weekend I basically gave up for now on Arduino for the ESP32 part and am now looking into the ESP ADF - I had issues basically with background tasks getting out of whack and very limited debugging possibilities. Now the IDF/ADF is based on FreeRTOS which will hopefully make things a bit more transparent - but also a bit more complicated. Let’s see…

Cheers
nicole

1 Like

Whoa, this sounds exactly what I want to do. Are there any ports to open or additional steps to make it discoverable? I’ve this set the preferences, but the device doesn’t appear in the Gnome sound settings.

Just here to note something else I noticed lately and I think others were hinting at it earlier in this thread, so apologies to those who were trying to tell me this.

In the course of pairing my Librem 5 with the mini to send some files, I noticed that you can select the paired device as your sound output, which works exactly as I want it to with one major exception: the audio quality is horrible. Just constant garbled sound.

This would be a great solution to my problem if the performance could be improved. I’m curious if anyone is using this functionality and has a better experience than me or even if you have the same so I know it’s not just me. Bluetooth audio from the L5 to another dedicated Bluetooth speaker has been decent, but not perfect, so I suspect the Bluetooth driver. Anyway, if anyone has suggestions for improvement, that would be greatly appreciated. Thanks!