Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I love the text to Speech feature of Mac OS X. Since I'm not a native English speaker I'm very happy about all the additional languages added since Lion came out. However, I do use English as well as my native language (German). Changing voices is a bit of a pain. It just requires too many steps to be comfortable.

Is there any way to make this easy? I was looking for shortcuts, maybe a drop down menu somwhere up in the right corner, anything would be fine.

Since my search was not successful, I hope to find some advice here on SuperUser. Thanks a lot!

cu Roman

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

I have used FastScripts to assign a shortcut to this script:

try
    set old to the clipboard as record
end try
try
    tell application "System Events" to keystroke "c" using command down
    delay 0.05
    say (the clipboard) using "Kyoko"
end try
try
    set the clipboard to old
end try

You could also create a service in Automator:

There is a bug in 10.7 and 10.8 where the shortcuts for Automator services don't always work until you hover over the services menu from the menu bar. WorkflowServiceRunner can also use over 100% CPU while speaking text.

Another option would be to use UI scripting to change between two voices:

tell application "System Preferences"
    reveal anchor "TTS" of pane "com.apple.preference.speech"
end tell
tell application "System Events" to tell process "System Preferences"
    tell pop up button 1 of tab group 1 of window 1
        click
        delay 0.1
        if value is "Alex" then
            click menu item "Victoria" of menu 1
        else
            click menu item "Alex" of menu 1
        end if
    end tell
end tell
quit application "System Preferences"

Changing the SelectedVoiceID key in com.apple.speech.voice.prefs.plist also works, but I don't know how to apply the changes immediately.

share|improve this answer
    
Wow, thanks a lot for this very detailed answer and for showing me so many options. The Automator service works great for me, furthermore now I know about those services. I might want to add some other ones too :) –  user83946 Sep 17 '12 at 12:14
add comment

Thank you very much Lauryi.

I have extended your UI scripting approach to work properly with german and english voices. The problem is, when your system language is not english, all non system languages are hidden (if not currently selected). You have to select: show more voices.. first to get to the desired language. My code lack a bit of elegance, but works. Here it is (updated):

tell application "System Preferences"
    reveal anchor "TTS" of pane "com.apple.preference.speech"
end tell
set tom to 0
tell application "System Events" to tell process "System Preferences"
    tell pop up button 1 of tab group 1 of window 1
        click
        delay 0.2 -- without this the value was sometimes "Loading Voices…"

        if value is "Tom" then
            click menu item "Anna" of menu 1
        else
            click menu item "Mehr Stimmen anzeigen" of menu 1 -- show up all available voice
            set tom to 1
        end if
    end tell
end tell
if tom is 1 then
    delay 0.5
    tell application "System Events" to tell process "System Preferences"
        tell pop up button 1 of tab group 1 of window 1
            click
            delay 0.2 -- without this the value was sometimes "Loading Voices…"
            click menu item "Tom" of menu 1
        end tell
    end tell
end if
quit application "System Preferences"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.