Bad first msec of the say command send to Squeebox

Hello
I am running a LMS version 8.4.0 with four squeezelite players
I am able to play sound coming from VoiceRSS by using the say command on a rule.
However:

  • All the players are stopped.
  • My rule is executing
  • I hear during a few msec the previous sound of the last track played by the LMS.
  • I hear the TTS output perfectly
    When I look at the log I see that the first commands send to the LMS are turn on the player and put the volume to 100. It seems normal that I hear the last media sound.

2023-12-05 12:30:06.375 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: players 0
2023-12-05 12:30:08.332 [DEBUG] [eezebox.internal.SqueezeBoxAudioSink] - Processing audioStream xxxx/audio/374facb2-2b24-4447-ba51-ccbd888f69af.wav of format AudioFormat [codec=PCM_SIGNED, container=WAVE, bigEndian=false, bitDepth=16, bitRate=256000, frequency=16000, channels=1]
2023-12-05 12:30:08.333 [DEBUG] [rnal.handler.SqueezeBoxPlayerHandler] - Play notification sound on player 00:00:00:00:00:01 at URI xxxxxx/audio/374facb2-2b24-4447-ba51-ccbd888f69af.wav
2023-12-05 12:30:08.333 [DEBUG] [ternal.handler.SqueezeBoxPlayerState] - Cur State: vol=0, mut=NOT MUTED, pwr=OFF, stp=STOPPED, ctl=PAUSED, shf=OFF, rpt=OFF, tix=0, tnm=1, tim=0
2023-12-05 12:30:08.333 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Setting up player for notification
2023-12-05 12:30:08.333 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Powering on the player
2023-12-05 12:30:08.333 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: 00:00:00:00:00:01 power 1
2023-12-05 12:30:08.333 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: 00:00:00:00:00:01 mixer volume 100
2023-12-05 12:30:08.433 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Adding notification message to playlist
2023-12-05 12:30:08.434 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: 00:00:00:00:00:01 playlist add xxxxxx/audio/374facb2-2b24-4447-ba51-ccbd888f69af.wav Notification
2023-12-05 12:30:09.135 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Playlist updated
2023-12-05 12:30:09.135 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Playing notification
2023-12-05 12:30:09.135 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: 00:00:00:00:00:01 playlist index 1
2023-12-05 12:30:12.038 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Restoring player state
2023-12-05 12:30:12.039 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: 00:00:00:00:00:01 mixer volume 0
2023-12-05 12:30:12.040 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Removing notification message from playlist
2023-12-05 12:30:12.040 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: 00:00:00:00:00:01 playlist delete 1
2023-12-05 12:30:12.441 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Playlist updated
2023-12-05 12:30:12.442 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: 00:00:00:00:00:01 playlist index 0
2023-12-05 12:30:12.442 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: 00:00:00:00:00:01 time 0
2023-12-05 12:30:12.442 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Stopping the player
2023-12-05 12:30:12.443 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: 00:00:00:00:00:01 stop
2023-12-05 12:30:12.443 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: 00:00:00:00:00:01 mixer volume 0
2023-12-05 12:30:12.443 [DEBUG] [handler.SqueezeBoxNotificationPlayer] - Powering off the player
2023-12-05 12:30:12.443 [DEBUG] [rnal.handler.SqueezeBoxServerHandler] - Sending command: 00:00:00:00:00:01 power 0

I’m not sure what to say or do about this. The LMS design isn’t very conducive to being used for notifications and there are a few edge/timing cases such as the one you’re experiencing with a few msec of the previous track being heard. I’m sorry, but I’ve spent quite a few hours trying to make it work better, but the LMS just doesn’t want to cooperate. :roll_eyes:

I’m not sure I understand what you’re saying about the players being stopped. Are you saying that when you send a notification to one player, all 4 of your players stop playing? Are the players linked?

He is explaining the state of the players before the rule execution.
They are in stop, then the rule is executed.

I hear this sound also. But not only on notifications. Its a lms thing. You’ll get used to it :wink::grin:
I think it’s from a buffer in the player or something.
Greets…

Ah, I see. Thanks.

:rofl: :rofl:

The first command received by the server is Power on and after set the volume to 100.
After this command the server will play the last element in the playlist.
I think this is the sound I hear before the notification sound.
Is is possible to first add the notification sound to the playlist and only after that to power on the player and set the volume?

Like I said, I spent many, many hours of my time trying to get this to work as well as possible. The LMS just isn’t designed to be temporarily interrupted to play another track, then restore what was previously playing.

You’re more than welcome to experiment with the code yourself. And if you come up with something that works better than the current implementation in all scenarios, then submit a PR.