Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make the `say` terminal utility and NSSpeechSynthesizer work with Siri voices

  • The say command-line utility seems to be unaware of Siri voices as of macOS 11 (Big Sur):

    • say -v '?' doesn't list Siri voices.

    • Targeting a Siri voice explicitly doesn't work:

      • say -v NoraSiri hi! doesn't find the Nora Siri voice (which is the default Siri voice).
    • Using a bundle ID (e.g., com.apple.speech.synthesis.voice.custom.siri.nora.premium)[1] doesn't complain about an unknown voice, but speech output fails with Open speech channel failed: -86:

      • say -v com.apple.speech.synthesis.voice.custom.siri.nora.premium hi!

      • Seemingly, any string with prefix com.apple.speech.synthesis.voice.custom triggers this error.

  • Similarly, NSSpeechSynthesizer doesn't list Siri voices as available and doesn't support selecting one for speech output.

macOS Big Sur itself is capable of using a Siri voice for TTS, as evidenced by the fact that you can select one as the system voice in System Preferences > Accessibility > Speech, e.g. in combination with the shortcut-key-based Speak selected text when the key is pressed feature.
(Curiously, though, a Siri voice selected as the system voice does not take effect if you right-click text and select Speech > Start Speaking from the context menu and possibly also not for other accessibility features - this discrepancy is the subject of this MacRumors forum thread.)

Unfortunately, it appears that this functionality isn't exposed through a utility or API.

  • Is there any way to use Siri voices with say or NSSpeechSynthesizer?

[1] The bundle IDs of the installed Siri voices can be determined as follows:

ls /System/Library/Speech/Voices/*.SpeechVoice/Contents/Info.plist | grep -i siri | xargs -n 1 /usr/libexec/PlistBuddy -c 'print CFBundleIdentifier' 

Note: The above works for me as of macOS Big Sur, upgraded from an earlier version, with at least one Siri voice installed. Siu Ching Pong -Asuka Kenji- reports that on a freshly installed, non-upgraded Big Sur machine the System/Library/Speech/Voices directory is empty.

To find the bundle IDs of all available (downloadable) Siri voices:

/usr/libexec/PlistBuddy -c 'print DownloadableCustomVoices' /System/Library/PrivateFrameworks/SpeechObjects.framework/Resources/SpeechDataDefaults.plist | grep 'VoiceIdentifier' | sed -E 's/.+ = //' 
like image 508
mklement0 Avatar asked Apr 09 '20 13:04

mklement0


People also ask

Can you add custom voices to Siri?

Go to Settings > Siri & Search, then do any of the following: Change the voice for Siri: (not available in all languages) Tap Siri Voice, then choose a different variety or voice. Change when Siri provides voice responses: Tap Siri Responses, then choose an option below Spoken Responses.

Are there alternate voices for Siri?

You can listen to all the Siri options below. The audio clips start and end with the new, fifth voice. “We're excited to introduce a new Siri voice for English speakers, giving users more options to choose a voice that speaks to them,” Apple told Axios in reference to the new fifth American voice.

How do I use Siri text to speech on my Mac?

To use Siri, long-press the button on the right side or trigger it with the “Hey Siri” voice command. Say something like “Speak screen” to make Siri read text on the screen. Alternatively, select the text you want Siri to read and then tap Speak.

Is Siri a speech synthesizer?

Siri is a personal assistant that communicates using speech synthesis. Starting in iOS 10 and continuing with new features in iOS 11, we base Siri voices on deep learning. The resulting voices are more natural, smoother, and allow Siri's personality to shine through.


1 Answers

In a WWDC20 talk, Apple says Siri voices are not available in AVSpeechSynthesizer.

The talk is called "Create a seamless speech experience in your apps." Apparently this applies to Catalina as well.

Here's the relevant slide:

WWDC20 Slide

I started a thread at macrumors regarding similar problems configuring the system voice to speak text.

like image 102
Jonathan Dagle Avatar answered Oct 25 '22 01:10

Jonathan Dagle