music-assistant / hass-music-assistant

Turn your Home Assistant instance into a jukebox, hassle free streaming of your favorite media to Home Assistant media players.
Apache License 2.0
1.4k stars 51 forks source link

[B30] All music is stuttering #1262

Closed assumptionsoup closed 1 year ago

assumptionsoup commented 1 year ago

What version of Music Assistant has the issue?

2.0.0b30

The problem

I'm trying music assistant for the first time and everything is stuttering horrendously. As in, 1+ second pauses after 1 second of music. I've set my dlna wiim player to play mp3's in the music assistant player settings. I've also tried aac and flac, with similar results. I can't try Chromecasting or airplay because music assistant can't seem to discover them.

I've tried playing music from the local ssd disk and from YouTube, and both stutter horribly. My HA and wiim player are on ethernet, and wiim doesn't stutter when I play hd music in Amazon music or any other service.

I've recently switched from a rpi to a HP t630, but they both were exhibiting this problem.

The music assistant interface is also extremely unresponsive when doing this and I'll often be unable to get the music to stop playing when trying to pause.

Local music doesn't stutter when played through home assistant's native player.

How to reproduce

Play any music through music assistant.

Relevant log output

No response

Additional information

No response

What version of Home Assistant Core are your running

2023.5.3

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

Generic x86-64 (e.g. Intel NUC)

erkr commented 1 year ago

DLNA players can notoriously cause issues, but chromecast works really good for most of us. That these are not recognised could indicate network issue. Chromecast players need to be in the same subnet where multicast needs to work as well

assumptionsoup commented 1 year ago

They're all on the same subnet. Multicast might be an issue? I'll need to see if there are any settings for that on my router, but I don't have access atm. I discovered I needed to add a few ip addresses to the manual ip configuration for HA cast configuration. Now that I've added those, they work in HA. But they still don't show up in music assistant. Is music assistant discovering chromecasts separately from HA? There are quite a number of open tickets about chromecasts becoming unavailable in HA. Maybe music assistant also needs a manual ip configuration? Or can steal it from HA?

DLNA works fine without stuttering in HA, which makes me think there's a problem in music assistant, not the device.

OzGav commented 1 year ago

Is music assistant discovering chromecasts separately from HA?

Yes it is completely separate. When the HA integration arrives that will change however you won't get all the MA features if MA can use the native player. Definitely sounds like you have some sort of networking issue if you had to do workaround to get HA to work.

assumptionsoup commented 1 year ago

Considering:

If it is a network issue, I think it's more likely there's a problem in MA/HA or the HA OS configuration.

marcelveldt commented 1 year ago

If music is stuttering it is in 99% of the cases network (bandwidth) or performance (cpu power) related. Be aware that MA is aimed to provide the best quality of playback and so has a somewhat heavier load on both cpu and network/bandwidth then HA, especially considering the fact that the stream is provided by MA itself.

So take a look at your network, is the connection speed OK (especially 2,4 Ghz WiFi is poor for music streaming) and have a look at cpu and memory usage of the machine running HA/MA.

Normally speaking it should run just fine on a pi 4 with 2gb or more and a descent network connection.

What is strange is that cast is not working out of the box, it is very rare that does not work with a plain network setup like yours. Is your HAOS network config setup with DHCP for both IPv6 and IPv4. ?

Just to confirm: I may hope your HA box is connected to ethernet and not WiFi ?

assumptionsoup commented 1 year ago

Both my HA box and the dlna wiim it's casting to are on ethernet (I also tried wifi 5ghz, same problem. I moved both to ethernet to see if it fixed the issue, which it didn't). And I migrated from a pi 4 (not sure how much ram) to a HP t630 with 8gb ram which should be more powerful afaict. The issue was on both. HA's CPU dashboard shows 2-4% usage while trying to play a local mp3. And ipv4/6 are set to automatic in the ui. I assume that's DHCP? Or is there a command I should run to check?

erkr commented 1 year ago

Normally the HA cast integration detects chromecast devices without the need to configure IPs. So that indicates your network blocks the standard discovery mechanism used and will be the reason MA doesn't detect them either. Multicast's are used to discover them. In router and APs the setting that controls them is called IMGP snooping

assumptionsoup commented 1 year ago

I've gained access to my router by factory resetting it. I don't see any IGMP settings on my router. I do see it counting multicast packets rx/tx. Is there a section this is usually under? Or alternate name?

Interestingly, when I reset my router, MA started seeing some of my chromecast groups and one chromecast (but not all). But it can't connect to any of them.

assumptionsoup commented 1 year ago

Ahhhhhhhhhh!!!

It's a known problem with this router. https://www.reddit.com/r/centurylink/comments/o9vwk4/solution_issues_with_iot_devices_and/

Solution: Disable "Cyber Security"

Thanks for the help!