Speed Up Rate of Text To Speech via Terminal

1

I used to have my TTS custom set to read things back nice and fast, works better for me as I'm basically ADD & mildy dyslexic.

Now I'm not much of an expert like most of you on here, but I've just hunted as best I can... tracking back to what I must have posted in Terminal originally.

This seems like it's on the right track:

https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/SpeechSynthesisProgrammingGuide/FineTuning/FineTuning.html

Perhaps something like:

SetSpeechRate(_ chan: SpeechChannel, _ rate: Fixed) -> OSErr
SetSpeechRate(_ chan: Alex, _ rate: 600) -> OSErr

I remember the original string was longer though. Am I on the right track?

I also found this link:

https://groups.google.com/forum/#!msg/macvisionaries/HOR7NWxsDQA/15E4M_6zqLUJ

======================================================================

I found a potential solution. The slider only goes up to a max of 350 wpm, but the setting is stored in:
~/Library/Preferences/com.apple.speech.voice.prefs.plist
To see it, run from terminal:
defaults read com.apple.speech.voice.prefs VoiceRateDataArray
I get something like this:

( 
        ( 
        1835364215, 
        201, 
        350 
    ) 
)

We need to change the last element in each sub-array.
Back up that file, in case this fails. Then from terminal, run:

plutil -convert json ~/Library/Preferences/com.apple.speech.voice.prefs.plist -o - | python -c 'import json, sys;d=json.load(sys.stdin);[x.__setitem__(-1, 500) for x in d["VoiceRateDataArray"]];json.dump(d, sys.stdout)' | plutil -convert binary1 -o ~/Library/Preferences/com.apple.speech.voice.prefs.plist - 

If it succeeds, reboot.
Only because I'm not sure how to get things to reload without it.
Once done, your system speech rate should be set to 500. Change that number as appropriate.
To reverse this, adjust the slider in the speech preferences.

==========================================

This didn't seem to work for me though:

I have no com.apple.speech.voice.prefs file on my computer. (Perhaps I can make one, and then modify it?)

Does it work for you?

Ritch

Posted 2016-03-12T08:08:05.020

Reputation: 11

I do have a com.apple.speech.voice.prefs.plist file, but upon opening it in BBEdit and doing a search for "VoiceRateDataArray" nothing comes up. I'm running 10.11.4. So that just tells you what doesn't work (for me), which could be useful to someone other than myself. – None – 2016-04-30T22:53:45.237

Answers

0

I think your first thing is to just find the file, it's very unlikely to not be there, but Spotlight doesn't like to find system files.

You can mod it manually in TextWrangler (freeware) by changing the last integer in VoiceRateDataArray, save & reboot.

To make sure you're looking in the right place...

  • Switch to Finder
  • Cmd ⌘ N for new window
  • Cmd ⌘ Shift ⇧ G for Go to
  • Copy/paste ~/Library/Preferences/com.apple.speech.voice.prefs.plist including the tilde ~
  • Right click, Open in TextWrangler.
  • Cmd ⌘ F to Find
  • Copy/paste VoiceRateDataArray & hit Enter ⌅
  • The value you need to change is 5 lines down, the 3rd integer
  • Change, Save, reboot.

Tetsujin

Posted 2016-03-12T08:08:05.020

Reputation: 22 456

0

I mentioned on another post that you can also use two more lines in terminal to avoid having to restart (I'll post them here, so any others who have this question can see it):

plutil -convert json ~/Library/Preferences/com.apple.speech.voice.prefs.plist -o - | python -c 'import json, sys;d=json.load(sys.stdin);[x.__setitem__(-1, 720) for x in d["VoiceRateDataArray"]];json.dump(d, sys.stdout)' | plutil -convert binary1 -o ~/Library/Preferences/com.apple.speech.voice.prefs.plist -

killall com.apple.speech.speechsynthesisd
killall SpeechSynthesisServer

You might have a corrupted .plist file. For whatever reason, I've been told to delete this file:

/Users/***YOURCOMPUTER***/Library/Preferences/com.apple.symbolichotkeys.plist

I can never remember though if it's that one or the one here: /Library/Preferences/com.apple.symbolichotkeys.plist

Whatever the case, you may have to rebuild some shortcuts, so I do want to give you fair warning about that.

Talos Potential

Posted 2016-03-12T08:08:05.020

Reputation: 131