Page 1 of 1

Announcement functionality broken completely

PostPosted: Mon Feb 27, 2023 8:09 am
by shapa
It could be an Apple Silicon issue or MacOS 13.2.1, or Sonos latest firmware.

But all my announcements have stopped working recently. Apple TTS.

The Indigo part works:

"room Sonos
Sonos ZonePlayer: Office Bathroom Sonos, Current Volume: 25, New Volume: 70
Sonos Announcement Length: 1.23070294785
"

I see an error on Sonos: "Unable to play 'announcement.aiff' - the song is not encoded correctly."
The generated file itself is accessible via the Sonos Plugin webserver and is playing fine on the mac.

Could it be some codec incompatibility? Is it possible to change the plugin to generate mp3 instead?

Pre-generated .mp3 files work fine.

Re: Announcement functionality broken completely

PostPosted: Fri Mar 17, 2023 7:47 am
by shapa
OK, If someone is interested - I "fixed" the issue by adding .aiff to .mp3 conversion into the plugin (via lame).

Some dirty hack, works fine.

<------><------><------><------>ru = NSURL.fileURLWithPath_("./announcement.aiff")
<------><------><------><------>sp.startSpeakingString_toURL_(announcement, ru)
<------><------><------><------>s_announcement = "announcement.mp3"^M
<------><------><------><------>tts_delay = 0.5^M
<------><------><------><------># small delay to allow MP3 file creation completion^M
<------><------><------><------>self.plugin.sleep(0.5)^M
<------><------><------><------>lameExe = '"' + '/opt/homebrew/bin/lame' + '"'
<------><------><------><------>lameCommand = lameExe + ' -h "' + '"announcement.aiff"' + '" "' + '"announcement.mp3"' + '"'
<------><------><------><------>ps = subprocess.Popen(lameCommand,
<------><------><------><------><------>stdout=subprocess.PIPE,
<------><------><------><------><------>stderr=subprocess.PIPE,
<------><------><------><------><------>shell=True)
<------><------><------><------>self.plugin.sleep(0.5)^M