Announcer update? To find some alternative to "play sound"?

Plug-ins, scripts, and other software to improve your home automation experience.
shapa
Posts: 483
Joined: Mon Sep 08, 2014 6:51 am
Location: Swindon

Announcer update? To find some alternative to "play sound"?

Post by shapa »

Using Announcer Plugin a lot - directly connected speakers to my mac home server. Simple and efficient to announce messages, not relying on internet connection.

With the latest OS (10.14+), after reboot - "software is not compatible" on the first call, because of playsound is 32bits. So I need to login remotely and push the button.
Unfortunately, there is no way to switch off the nag message anymore - Apple is pushing developers to upgrade.

Is it possible to use some alternative tool? Or built-in functionality?
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Announcer update? To find some alternative to "play soun

Post by jay (support) »

Simple script that spawns an external process that uses the say terminal command:

Code: Select all

from os import system
system('say Hello world!')
Or, you can directly call macOS APIs:

Code: Select all

from AppKit import NSSpeechSynthesizer
speechSynthesizer = NSSpeechSynthesizer.alloc().init()
speechSynthesizer.startSpeakingString_('Hello world!')
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
shapa
Posts: 483
Joined: Mon Sep 08, 2014 6:51 am
Location: Swindon

Re: Announcer update? To find some alternative to "play soun

Post by shapa »

I know, thanks :)

But announcer is a bit more convenient.
Attachments
Screenshot 2019-07-02 00.54.55.png
Screenshot 2019-07-02 00.54.55.png (211.56 KiB) Viewed 2723 times
nsheldon
Posts: 2469
Joined: Mon Aug 09, 2010 2:12 pm
Location: CA
Contact:

Re: Announcer update? To find some alternative to "play soun

Post by nsheldon »

Hi shapa.

Thanks for the reminder. @Jay: Thanks for the scripting tips too.

The primary reasons for relying on Play Sound with the Announcer plugin, as opposed to using basic command-line "say" functionality or macOS API calls were 1) Play Sound is multi-threaded. It can play multiple audio streams simultaneously which is perfect if you want to have background "ambiance" to play behind the spoken announcement. You can't do that with the "say" command. I'm not at all familiar with the macOS API. Perhaps that can be done using that method, though it'd probably require a fair bit of work to implement. And 2) Play Sound audio output can be hijacked by AirFoil and sent to any number of AirPlay speakers simultaneously. This is also the reason for the "Use Specific Copy of Play Sound" option in that dialog. By having multiple copies of Play Sound running, you can actually have multiple simultaneous announcements playing at once all being sent to different AirPlay speakers. I believe the "say" command uses the same macOS API calls to generate the audio, which means that in order for AirFoil to send the output to another speaker, it'd have to send all system audio to the other speaker, not just the output produced by Announcer.

In any case, I'll see what I can come up with, but unfortunately, the Play Sound developer has been long absent with no trace of the original code and no equivalent, at least of which I'm aware. If I can't find a solution, the options are to either discontinue the Announcer plugin or severely handicap its functionality, rendering it no more useful than the built-in "Speak" option found at the bottom of all Indigo event settings. (No disparagement toward that feature intended).
shapa
Posts: 483
Joined: Mon Sep 08, 2014 6:51 am
Location: Swindon

Re: Announcer update? To find some alternative to "play soun

Post by shapa »

Actually, the developer moved here:

http://david.blache.net

Tried to contact him...
User avatar
McJohn
Posts: 680
Joined: Tue Dec 18, 2012 5:58 am
Location: The Netherlands
Contact:

Re: Announcer update? To find some alternative to "play soun

Post by McJohn »

How was the contact? :D
Post Reply

Return to “Nathan Sheldon Software”