2

I've finished training MacOS 14.0 on my Personal Voice ("Myself"), and Live Speech correctly speaks phrases in my voice using the Live Speech interface. In Terminal, the command say -v '?' correctly lists my voice, but the command say -v Myself "Hello, World"; echo $? produces no audio output and indicates normal completion (echo $? => 0).

I've tried rebooting. Is this a bug? Is there an additional step needed?

2 Answers 2

5

The "say" command works fine with personal voice, but it doesn't do the necessary tasks to request permissions to be granted to the Terminal app.

The problem is that Mac OS Sonoma does not allow you to manually add an application to the list of authorized apps, even though there is a "+" sign in Settings - Accessibility - Personal Voice - Allow applications to use your personal voice.

To fix this, you can compile and run an objective-c command line tool that requests permissions when it's run from terminal from the first time, then terminal will be granted with Personal Voice permissions and "say" (and any other command line tool that uses personal voice speech synthesis) will work.

A very tiny implementation would be: (Requires Xcode 15 or latest Command Line Tools)

#import <AVFoundation/AVFoundation.h>

int main(){
  [AVSpeechSynthesizer requestPersonalVoiceAuthorizationWithCompletionHandler:^(AVSpeechSynthesisPersonalVoiceAuthorizationStatus status){
     // authorization popup should be visible now
  }];
  [[NSRunLoop currentRunLoop] run];
  return 0;
}

Save it as: mysay.c

and you can compile it at command line with:

gcc -x objective-c -framework AVFoundation -framework Foundation mysay.c -o mysay

and run it as

./mysay

Mac OS should then popup a message asking to grant permissions to Terminal. After accepting this, say -v YourVoiceName "Hello world" should work

enter image description here

3
  • Nice work! As you mentioned, Xcode is required. I'd been curious whether the command line utilities would suffice, since say works fine without the full xcode for the built-in voices, but saying in a custom voice does appear to require the full xcode installation.
    – Chap
    Commented Nov 15, 2023 at 22:52
  • 2
    Since Command Line Tools includes the latest MacOS SDK , they would suffice to compile without the need of full Xcode. You may need to run "sudo xcode-select -s /Library/Developer/CommandLineTools" first Commented Nov 16, 2023 at 10:02
  • You're correct. I deleted the Xcode app, and after rebooting the Mac, say -v MyVoice continues to work. (The reboot appears to be necessary.)
    – Chap
    Commented Nov 17, 2023 at 18:24
1

On Create a Personal Voice on Mac - Apple Support it says that

Personal Voice can be used only with Live Speech and with third-party apps that you allow, such as Augmentative and Alternative Communication (AAC) apps.

and actually it works with Live Speech (had to restart before first use). On the settings page of the Personal Voice there is a allow list that cannot be edited, but maybe say command should be added to this list first.

1
  • That's evidently the "additional step" I was looking for. Odd that the allow list can't be edited. Also odd that they specify "third-party" apps. Will try to find and install an "AAC app" and see if that enables the allow list.
    – Chap
    Commented Oct 6, 2023 at 22:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .