hass-music-assistant icon indicating copy to clipboard operation
hass-music-assistant copied to clipboard

Clipping on TuneIn radio

Open corvy opened this issue 1 year ago • 2 comments

What version of Music Assistant has the issue?

2022.8.4

The problem

I have some issues with TuneIn radio. It works fine but every x amount of seconds I get some random sound clipping. This could happen in a frequency like 10-15 seconds or as long as a few minutes. In the logs I cannot find any information.

My Speaker is a Sonos speaker (Sonos 1) connected over WiFi. I have not found any issues with the network or WAN connection and there is no clipping when using the Sonos app. Also when I play music via Sonos on Music Assistant that works also fine.

Do you have tips how to debug this?

How to reproduce

Just play a radio station over TuneIn

Relevant log output

Not found any logs for this. Can I enable some debug?

Additional information

No response

What version of Home Assistant Core are your running

2022.9.7

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

Alternative

corvy avatar Sep 28 '22 13:09 corvy

Looking back at previous Sonos questions. Marcel recommended either selecting mp3 for the stream and ICY metadata to default OR flac for the stream and ICY metadata off. These settings are available in QUEUE>>THREE DOTS TOP RIGHT>>SETTINGS>>ADVANCED SETTINGS

OzGav avatar Sep 28 '22 21:09 OzGav

It seems that changing to ICY metadata off improves the problem. Clipping still occurs but not as frequent (just a feeling... no data to support it). Changing to MP3 seems to not be working. MP3 makes the timeout to start a tunein stream to be very slow, if it starts at all. Once when it started it stopped after about a minute. Logs are still empty, no information to be found. I will continue to do some testing later tonight.

corvy avatar Sep 29 '22 06:09 corvy

Any updates?

OzGav avatar Oct 01 '22 22:10 OzGav

I still get some clipping but it seems to be alot better. Last night I fitted a new Sonos Amp in the kitchen. Will check if this has the same issues over the next few days.

MP3 does not work for me, then the stream never starts or is extremely slow. Flac with no ICY metadata seems to work best. Also Wav seems to work OK, but not better than Flac with no ICY.

corvy avatar Oct 07 '22 07:10 corvy

Thanks. We haven’t received ongoing reports of clipping once the ICY metadata was turned off. So keep us updated on what you find.

OzGav avatar Oct 07 '22 10:10 OzGav

Hi. Any updates on this issue?

OzGav avatar Oct 24 '22 21:10 OzGav

Yes! Seems that the new Sonos Amp does not have this issue, it affects only a Sonos Play 1. I have also another one and a newer Sonos Roam that I will test to see if it is device specific or Sonos generation.

man. 24. okt. 2022 kl. 23:18 skrev OzGav @.***>:

Hi. Any updates on this issue?

— Reply to this email directly, view it on GitHub https://github.com/music-assistant/hass-music-assistant/issues/926#issuecomment-1289629746, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABBYNENLRMQMBKKUHWMR6LWE34LFANCNFSM6AAAAAAQXZWA5Q . You are receiving this because you authored the thread.Message ID: @.***>

corvy avatar Oct 25 '22 05:10 corvy

Can you tell to what level you have set the volume normalization in the player settings ? I can recommend -14 LUFS but -7 LUFS will probably more match the Sonos default. At any chance do not set it to 0 or above as that will cause clipping with 99% for sure.

marcelveldt avatar Oct 27 '22 06:10 marcelveldt

Sorry for not following up on this. I will test and get back to you. :)

corvy avatar Jan 17 '23 19:01 corvy

Any further update?

OzGav avatar Jan 27 '23 11:01 OzGav

Yes I have tried now for days to get this to work but none of my efforts seems to give any effect. I have tried to change crossfade, change the volume normalization from -7 to -14 and also disabling it. I have tried all codecs, wav and flac seems to work best. The settings I have tried that gives best effect so far is flac with crossfade all tracks. That only clips very seldom. The settings I run now is this + I recently lowered the sample rate to 44100. So far this has not produced clipping and I will update if this works over time.

Again, just for info. The newer Sonos AMP gen 3 does not have this problem at all. Only relevant for my old Sonos play 1.

corvy avatar Feb 08 '23 07:02 corvy

This almost sounds like a hardware issue because I have never ever heard about this issue before and many of our users use the Sonos Play 1. Does it only clip with a radio source ? And not with other tracks ?

Stupid question maybe but is the network connection good for the speaker ? Maybe network dropouts also result in distortion.

marcelveldt avatar Feb 08 '23 08:02 marcelveldt

Hello @marcelveldt. Thanks for the response. Well the clipping only happens on radio streams. When I play from e.g. Spotify there is no clipping. I have a great network with many access points and I have even tried to move the speaker to different places in the house. Right now it is next to my computer and there is full coverage and my speedtest on the laptop (20 cm from the speaker) gives around 300Mbit/s down and upload (sync fiber connection). So...

On the positive side, I have another Sonos Play 1 downstairs and I can try the same there. My kids use that one for the most part so I can experiment with it.

Is there any way I could debug this issue in the logs?

corvy avatar Feb 08 '23 10:02 corvy

Strange issue, that it only happens with radio streams. Did you try several radio streams ? For example BBC radio is using mpeg dash which is kind of special. The only real thing I can think of that causes clipping would be the volume normalization if somehow the metadata is wrong but you said you also tried disabling it. Did you restart playback after changing the setting ?

Please also test with the other Play 1 because I'm very curious :-)

Sorry, I don't think there will be anything useful in the logs as this is audio related.

marcelveldt avatar Feb 08 '23 10:02 marcelveldt

The radio of choice is Radio Rock in Norway https://tunein.com/radio/RADIO-ROCK-1058-s197605/ but I will for sure test some other stations. And I will test the other Play 1. Always restart the playback after settings change.

Keep you posted. Home-office this week so I test while not in Teams meetings :)

corvy avatar Feb 08 '23 13:02 corvy

I have been playing around with the settings trying to circle in the best config. Right now I think I might be on to something. Have not had any clipping for about an hour. The clipping had a frequency of about 5-10 minutes so this is good news. I will try to see if I can find out what is the factor that makes the difference. But I got a hunch on the ICY metadata. I have basically had that off since the recommendation early in this issue. Now I tried to turn it on with legacy chunksize.

image

Crossfade is also off. Just FYI.

corvy avatar Feb 09 '23 10:02 corvy

Hello again! I have now confirmed the problem to the ICY Metadata. The Sonos Play 1 only supports legacy ICY metadata. If you use default/large or disabled it ends up in clipping. When it is set to legacy no clipping occurs. So that solves it for me ;)

If anyone comes over this later, I just want to make sure that this (as far as I know) only applies to the first generation of the Sonos Play 1.

image

(the one on the left side)

corvy avatar Feb 16 '23 14:02 corvy