core icon indicating copy to clipboard operation
core copied to clipboard

Bell: Volume and Timing/Sync Issue

Open p4co86 opened this issue 3 months ago • 8 comments

When bell is pressed and music is playing, the Volume starts rising immediately to the volume of the bell im the settings, the track wich is playing is then quiet loud. After 500ms or 1000ms something it that range, bell in zone 1 is ringing, after that bell in zone 2 is ringing. At the moment I have only 2 zones running. After bell was ringing in the second zone, music plays again as expected. that means bell is out of sync, it should be ringing in all zones simultaneously right?

Thanks!

p4co86 avatar Aug 29 '26 15:08 p4co86

Does this still occur in beta20?

rudyberends avatar Sep 05 '26 11:09 rudyberends

Yes, but i found i mistake on my site, the zones had diferent amp wakeup times, 300ms differenz. I fixed that by myself, but they are stil a bit out of sync. The Issue with volume is also present on beta 20

I noticed another issue, when bell was ringing, the relay for the amp is turning off after about 5-6 seconds after the bell, not the power group one, this stays on. I then have to pause the playback until the standby time is over, playing again turns the relay for the amp again on. I should stay on the whole time when playing and then the bill triggered and after the bell of playback is still going on, like the power group

p4co86 avatar Sep 05 '26 16:09 p4co86

Thanks for testing beta20 and for the extra detail — all three points turned out to be real, and they were three separate faults. Fixes are on dev and will be in the next beta.

The volume. beta20 did contain a fix for this, and it did nothing for you — my mistake. It waited for the alert to actually become audible before raising the level, but it worked that out by asking the output how much audio it buffers. Only one of our output types can genuinely answer that; for most of them the figure is a field an operator can fill in by hand, empty unless someone did, and for several it does not exist at all. So the wait came out as zero and the level went up the instant the source switched, exactly as before.

That is now approached from the other side. Outputs that report where they are in the track get compared against the server's own clock — the gap between the two is the audio still travelling to that room, no configuration needed. Squeezelite can answer that and simply never passed the number on; it does now. And an output that cannot say anything either way is assumed to be holding about a second, rather than nothing: guessing high costs almost nothing, because the extra wait falls while the music is still playing anyway.

The remaining sync drift. Same root cause, so equalising your wake-up times by hand was the right move but could not finish the job: after that, the only thing left putting the rooms apart is how much each output buffers, and that was the number nothing knew. With it measured, every zone now leads with enough silence to land together with the slowest one.

The relay. This is the one I would like you to confirm. Switching an amp is not instant — a relay command is a process or a network call, and it queues behind other zones sharing the same device. An alert flips a zone twice inside that window: the announcement stops the player, and the restore starts it again. If the "on" arrives while the "off" is still being carried out, the relay had already moved but the server never wrote it down, and it then suppressed the command that would have switched it back — believing it was already on. Which matches what you describe exactly, including having to pause until the standby expires before play brings it back.

That is fixed, but it can only be what you are hitting if that zone's power-off actually runs during the alert. Could you check the power-off delay for that zone — the value, and whether "switch off immediately" is enabled? If it is set to switch off immediately, or to a few seconds, this is your bug. If it is on the default of five minutes, something else is switching your relay and I would like to see a log covering one bell press.

rudyberends avatar Sep 06 '26 14:09 rudyberends

Hi,

thanks for the detailed explanation. Results from today (17 Oct). The server reports 4.0.0-beta.22 (/api/v1/health). Logs were taken by polling GET /api/v1/zones every ~150 ms, so timings are ±150 ms and show the server's view, not the physical relay.

  1. RELAY – a different scenario than the one you fixed

Flur (13) and Küche (14) are the only zones with relay management, and both switch the SAME physical relay. Power-off delay is 1000 ms for both. There is no "switch off immediately" option in my UI, only the delay value.

Test A – real doorbell, only Flur playing radio before (Küche paused): after the bell, Flur returns to radio and Küche returns to paused. 1 s later the server powers Küche off. That switches the shared relay off, so Flur goes silent. The server still reports Flur power=on/target=on, so no "on" is ever sent again. Happened twice (18:54:15 and 18:54:52):

18:54:15.364 Flur playing power=on target=on vol=80 src=track 18:54:15.364 Küche playing power=on target=on vol=70 src=track 18:54:20.991 Flur playing power=on target=on vol=40 src=radio 18:54:21.626 Küche paused power=on target=off vol=28 src=radio 18:54:22.710 Küche paused power=off target=off vol=28 src=radio <- Flur goes silent here

Test B – real doorbell, Flur AND Küche playing before: both resume, nothing powers off, relay stays on.

So power state is tracked per zone, but when two zones share one relay, powering off one zone also cuts the other, and the other zone's state is never updated. Suggestion: treat zones that share a relay as one power group – switch off only when all of them are idle, and re-send "on" whenever one of them plays.

  1. ALERT VOLUME – still rises before the bell is audible

On beta.22, when music is playing and the bell is pressed, the music suddenly jumps to alert volume (e.g. 50 -> 80), audibly distorted, for up to about one second, and only then the bell sounds. In the server's view the volume changes in the same poll as the source switches to the alert:

18:54:15.364 Flur playing vol=80 src=track (was vol=40 src=radio) 18:54:15.364 Küche playing vol=70 src=track (was vol=28, paused) 18:54:52.798 Flur playing vol=80 src=track (second press, same pattern)

Only twice did the rise come ~0.6 s after the switch (Flur 18:57:08.84 -> 09.46, Esszimmer 18:54:15.36 -> 15.99), which is still before the bell is audible.

Outputs are Squeezelite (LoxBerry Squeezelite-MR plugin). /zones shows output.protocol = "squeezelite", output.capabilities = null, output.sync = null.

Thanks!

p4co86 avatar Oct 17 '26 17:10 p4co86

Sorry, your test report from 17 Oct slipped through because the issue was already closed. Thanks for the detailed timelines, they're exactly what I need. Reopening this and looking at both points now:

  1. Shared relay: two zones that switch the same relay should act as one power group, switching off only when all of them are idle and sending "on" again whenever one of them plays.
  2. Alert volume on Squeezelite: the level is raised as soon as the source switches, because a Squeezelite output reports no buffer, so the wait before raising it comes out as zero.

I'll post here when the fixes are in a build you can try.

rudyberends avatar Nov 07 '26 15:11 rudyberends

Both points are fixed on dev and will be in the next beta:

  1. Shared relay: before a zone switches its relay off, the server now checks whether another zone uses the same physical relay (same crelay channel, GPIO pin, URL or UDP command) and still wants power. If so, the relay stays on; only the last zone on that relay to go idle switches it off. So Küche going back to paused after the bell no longer cuts Flur.
  2. Alert volume on Squeezelite: the volume is now raised when the player reports that the bell has actually started, instead of right when the source switches. The wait was calculated from a zone clock that only moves in whole seconds, so on Squeezelite it often came out as zero. The very first few tens of milliseconds of the bell may still play at the old level, because Squeezelite applies volume per buffer, but the second of loud music before the bell should be gone.

The ghcr.io/sonn-audio/core:dev image will have both once the current dev build finishes (about 15 minutes). If you get a chance to try it, the same Flur/Küche test as before would be perfect. Thanks again for the detailed report!

rudyberends avatar Nov 07 '26 15:11 rudyberends

Zones are not in sync while ringing, but it is working. Thanks. Flur was playing a song, Küche was off. Both are Playing correct and the volume is also correct now. Only the sync problem is there.

p4co86 avatar Nov 07 '26 18:11 p4co86

Thanks for confirming, good to hear the relay and the volume are right now!

The sync problem is fixed on dev too. Until now a bell rung in several rooms started a separate stream on each Squeezelite player, and each player buffered and started on its own schedule. Now rooms with Squeezelite players that get the same bell play it as one shared, synchronised stream, the same way a Squeezelite group plays music. Each player loads it paused, and they start together once all of them have buffered. If one room's amp is still waking up (like Küche coming from off), all rooms wait for it, so the bell may start a few hundred milliseconds later than before. Volume, raising to bell volume and restoring afterwards still happen per room, as in your last test.

Two things to know:

  • Only the start is synchronised. Each room still ends the bell on its own timer, so the tail could stop a fraction earlier in one room than in the other.
  • All rooms play the first room's processed stream, so if Flur and Küche have different EQ settings, both hear the same one during the bell.

The ghcr.io/sonn-audio/core:dev image will have this once the current build finishes (about 15 minutes). The same Flur/Küche test would be perfect, with debug logs if the rooms are still out of step.

rudyberends avatar Nov 08 '26 10:11 rudyberends