I ran across this post on the Home Assistant forum, which shows something very similar to what I want to achieve. However, there is something that is unclear to me: with Snapdroid, will I able to stream all audio from my Android device to the Snapcast server so that it doesn’t matter which app I use, or is this just some control device? I couldn’t make that clearly out from the GitHub repo of Snapdroid.

My desired use case is to use this in the same way I would with AirPlay on an iPhone, and be able to use my music player connected to my Jellyfin server, my podcast application or my YouTube frontend application to play audio that is cast to the Snapcast server.

    • cyberwolfie@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      Hehe, and for that I apologize! In case you are interested, here are the options I am so far considering. Still very much in the research phase, trying to figure out my specs before I buy any gear I don’t already have. I am not very experienced with this, so feel free to point out any baloney in the below text. Anything that could spare me time researching dead ends is gratefully received.

      Option 1: Snapcast

      Since I will be running a Raspberry Pi 4 with Home Assistant anyway (not yet set up properly), I would like to make use of the Snapcast integration in HA to run the Snapcast server and then set up a Raspberry Pi Zero W (with some 3.5mm extension) with all speakers I want to connect. Ideally these Zeros could be powered by the speaker themselves (through USB for example) to avoid two plugs, but I don’t know how realistic it is to achieve this, and I have not done much research into this yet.

      The issue that I so far have is that I don’t know how I can stream audio from my Android device to the Snapcast server. From my understanding, and what I hoped to clarify with this thread, is that it requires a specific audio source that the Snapcast can recieve audio from. Here is a list. This seems to my limited experience much more doable from my laptop running Linux than from my Android device. But I don’t know…

      Currently I will be investigating whether I can use audio streaming in scrcpy to stream audio to the Pi, and then route that via PulseAudio to Snapcast. I don’t know yet if this is a really cool idea or an incredibly stupid idea. I want to setup scrcpy for another purpose anyway, so why not try? :) It might introduce additional latency from my device to the speakers, but as this happens before the “distribution” from the server to the clients, I don’t think this would affect the synchronization. Also, I will never use this to speak on the phone with anyone, so that there is some latency doesn’t really matter to me. The biggest issue would be toggling this off and on - maybe via a remote command with KDE Connect or something like that. If I could set that up as a custom tile in the quick access menu in Android, that might work.

      All in all it seems a bit too convoluted though, so I don’t have too much faith in this.

      Option 2: balenaSound

      So this is the solution I first learned about as an alternative to Sonos, but I was turned off by the need to connect my devices via the internet to the balenaCloud hosted by the developers. However, either I missed this in the first round of research, or they have released it since, but OpenBalena exists which has much of the functionality of balenaCloud (but not all) and can be self-hosted. If I could get the server to run on my Raspberry Pi 4, and then flash balenaOS onto each Pi Zero W, this could provide what I want as I understand that it allows to stream audio directly to the Zero Ws via Bluetooth (with subsequent sync to the OpenBalena server via WiFi). It would be a much simpler solution than the one above, especially in terms of toggling it on and off on my Android device.

      A downside to this solution though, is that I believe I would not be able to install it on a Pi running Home Assistant OS (correct me if I am wrong), and that running HA through Docker makes installing new integrations a bit more cumbersome? Maybe that will pose no problem, as I don’t plan on using too many integrations anyway (Zigbee, Netatmo and a MQTT broker). I could perhaps also run a VM that runs Home Assistant OS?

      • OminousOrange@lemmy.ca
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 year ago

        Wow, thanks for the detailed information! Hopefully you can get some direction that helps with your solution. For me, it’s starting to sound like OpenBalena might work. I’ve got an old PC running Proxmox for my services with HAOS in a VM and working great. If you go with that, you’ll just have to configure USB pass through for a ZigBee receiver and any other hardware.

        • cyberwolfie@lemmy.mlOP
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 year ago

          Nice. I don’t have much experience with VMs yet. Is USB pass-through easily configured?

          The Acrylic device also seems pretty nice - I’ll dig a little deeper on that one as well. The rabbit hole becomes ever deeper… :)

          • OminousOrange@lemmy.ca
            link
            fedilink
            English
            arrow-up
            2
            ·
            1 year ago

            I don’t think the hole ever has a bottom 😁. USB pass through is relatively straightforward, just took some searching as I was very new at Proxmox and most things Linux.

            The Arylic stuff looks promising if it can be local-only. It seems there’s a proprietary app, but I’ll continue to research that as well.

          • OminousOrange@lemmy.ca
            link
            fedilink
            English
            arrow-up
            1
            ·
            edit-2
            1 year ago

            Ok, a bit more digging and here’s what I’ve found. It seems perhaps I can be of assistance.

            • This guy has set up those Arylic Up2streams with the LinkPlay integration in HA, which looks to accomplish what you’re looking for.
            • Another viable HA integration looks to be Music Assistant, but the video makes it seem like it might be a bit clunky. Also looks like Apple music might not be an option.

            Either way, looks like LinkPlay or Music Assistant can do the work of Snapcast or balenaSound, but within HA, so no additional containers needed. Likely can avoid the Arylic app that way too if you go with those devices.

            My wife says no more toys at the moment, but if I were to implement this, I’d probably pick up one of those Up2Streams for each room and try out the LinkPlay integration.

            • cyberwolfie@lemmy.mlOP
              link
              fedilink
              English
              arrow-up
              1
              ·
              1 year ago

              Hm, the Music Assistant at least does not quite accomplish what I hope and it seems to rely on services such as Spotify or YT Music to be integrated. I couldn’t quite evaluate the LinkPlay-solution, but his comment on SD card corruption with RPis made me a bit worried for the balenaSound approach. I guess there’s a lot of write operations in such a setup, that can easily corrupt the SD cards. I wonder how often they kept failing for him - maybe it’ll end up being some sort of a “subscription fee” 😅

              My wife says no more toys at the moment, but if I were to implement this, I’d probably pick up one of those Up2Streams for each room and try out the LinkPlay integration.

              Then you have something to put on your list for Christmas, if that is something you celebrate :)

      • OminousOrange@lemmy.ca
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        1 year ago

        Just came across this device while rooting around for HA compatible solutions. Looks to be have lots of connectivity options. Might be a potential less wired option for your setup

        Have also seen Volumio mentioned a couple times.

    • cyberwolfie@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Ok, thanks for clarifying that - as I feared. I elaborated on my progress into finding a solution to this below, in case you have any interest in it or any thoughts that could help me along.

      • tadly@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 year ago

        I have not yet found a solution I would be happy with because you always have to sacrifice on something. Your scrpcpy idea is neat and something I haven’t though off but:

        1. others (visitors etc.) wouldn’t be able to “just use it”
        2. it would drain the battery
        3. on none-rooted devices the adb network connection is not permanent I think? either way, getting the connection is not as simple as “pressing a button to cast”

        As it stands, I have given up on integrating mobile devices into my multiroom audio setup for many reasons. Right now I have my HTPC as the snapcast server and RPIs (soon to be old surface 4) as clients dotted around with a special script on the server-side to do some magic in regards to Kodi.

        By chance I came across fcast which sounds interesting but relies heavily on adoption which you will not see in apps like youtube, youtube music, spotify etc. so (to me) it has no relevance.

        • cyberwolfie@lemmy.mlOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          It would be nice to have other people being able to use it, but it is not a top priority for me. Also battery drain is not that much of an issue as it will only be used while at home. The last point is a bit more concerning though, so I will see if I can test this out and see how well it works. And yes, the connection seems to be the biggest issue here. But it seems that once configured, it only requires running ‘scrcpy’ on the recieving end. And KDE Connect can be setup to run commands remotely, for example I just set it up to open VS Codium in a specific folder from my phone. I can’t seem to add that command as a quick access tile (which would be my preferred option), but I could add it as a widget on my home screen for quick access so that conncetion is a button press away. How long the connection can stay for I don’t know, but I will see if I can’t test that out this week.

          Did you check out balenaSound by the way? If so, what difficulties did you run into that made you discard it?

          fcast looks nice, but if I understand it correctly it would require implementation in every specific application. I think if I were to jump onto the Grayjay-wagon, that could be nice, but I would love for my solution to be app agnostic.

          • tadly@lemmy.world
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 year ago

            As long as you are connected, I think network adb will stay active but if you leave your network f.e., you have to re-enable it in the developer options. But don’t take my word for it. Feels like google changed this behaviour every major release with android.

            Did you check out balenaSound by the way?

            On their blog they say: This project is made possible by the awesome work of various open source projects, including Shairport Sync for Airplay, Raspotify for Spotify Connect and Snapcast for multi-room audio sync. So they “just” glue existing stuff together which leaves you with roughly the same limitations as if you would do it yourself. It might allow spotify to be used with snapcast for multiroom but as I’m a yt music user I didn’t digg any deeper.

            fcast looks nice, but if I understand it correctly it would require implementation in every specific application

            Correct. That’s what I meant with “adoption”. Really hope it finds adoption but I really doubt it :(

            • cyberwolfie@lemmy.mlOP
              link
              fedilink
              English
              arrow-up
              1
              ·
              1 year ago

              As long as you are connected, I think network adb will stay active but if you leave your network f.e., you have to re-enable it in the developer options. But don’t take my word for it. Feels like google changed this behaviour every major release with android.

              Oh, if that is the case, this will not work. I’ll test it out later this week to see.

              On their blog they say: This project is made possible by the awesome work of various open source projects, including Shairport Sync for Airplay, Raspotify for Spotify Connect and Snapcast for multi-room audio sync. So they “just” glue existing stuff together which leaves you with roughly the same limitations as if you would do it yourself. It might allow spotify to be used with snapcast for multiroom but as I’m a yt music user I didn’t digg any deeper.

              Hmm, maybe I misunderstood it. Here is a blog post that shows how it can also use Bluetooth. To me, it sounds like that makes an app agnostic solution as long as you are fine with using Bluetooth. My understanding is that you then just connect to one of your speakers with Bluetooth when you want to cast, and you can then control which speakers the audio should play from. I will research this more. I should order a 3.5mm jack extension to the Pi Zero W, which is the only part I miss to be able to set up a proof-of-concept at home.