21

I use Mac's Text to Speech function a lot. Under Settings > Speech > Text to Speech I also have set a "Key" for quick access.

Since I also want Text to Speech to read German and OS Lion offers Voices for other languages, I would like to have a second shortcut for German.

Does anyone know where I can set this? Or is the only way to constantly change the System Voice before I want a German text to be read? (And then reset the voice to Alex for English texts)? And what about French text?

What options exist for this general problem?

1
  • 2
    did you try the functionality already built into OS X?
    – nohillside
    Sep 4, 2015 at 7:58

7 Answers 7

24

Say as …

You can use the say command with OS X's other voices to get different languages. Use the Thomas voice to get French pronunciation or Yannick for German.

In this example, I will use Thomas and French as this is what I know but Yannick should work as well for German text.

Try the following command in Applications > Utilities > Terminal.app:

say -v Thomas  "Bonjour. Je m'appelle Thomas."

If this is acceptable, you can wrap the say command up in an Automator service; which we will do next.

Automator Service

To create the Automator Service:

  1. Launch Automator.app
  2. Create a new Quick Action (previously Service)
  3. Add a Run AppleScript action
  4. Copy and paste in the AppleScript below:

    on run {input, parameters}
        do shell script "say -v Thomas " & (quoted form of (input as string))
        return input
    end run
    
  5. Save the service as Speak in French

Automator say service

To use the service:

  1. Select text in TextEdit or Safari
  2. Control + Click to reveal the Context Menu
  3. Select Services > Speak in French

Et voilà ! Other languages and voices are available.

This Automator approach allows you to keep your computer default voice set to your preferred language. While allowing selected text to be read in the alternative voice.

Available Voices and Languages

You can list the available voices and their associated languages with the command:

say -v ?

The available voices can change between versions of macOS. On macOS 10.13, the command returns:

Alex                en_US    # Most people recognize me by my voice.
Alice               it_IT    # Salve, mi chiamo Alice e sono una voce italiana.
Alva                sv_SE    # Hej, jag heter Alva. Jag är en svensk röst.
Amelie              fr_CA    # Bonjour, je m’appelle Amelie. Je suis une voix canadienne.
Anna                de_DE    # Hallo, ich heiße Anna und ich bin eine deutsche Stimme.
Carmit              he_IL    # שלום. קוראים לי כרמית, ואני קול בשפה העברית.
Damayanti           id_ID    # Halo, nama saya Damayanti. Saya berbahasa Indonesia.
Daniel              en_GB    # Hello, my name is Daniel. I am a British-English voice.
Diego               es_AR    # Hola, me llamo Diego y soy una voz española.
Ellen               nl_BE    # Hallo, mijn naam is Ellen. Ik ben een Belgische stem.
Fiona               en-scotland # Hello, my name is Fiona. I am a Scottish-English voice.
Fred                en_US    # I sure like being inside this fancy computer
Ioana               ro_RO    # Bună, mă cheamă Ioana . Sunt o voce românească.
Joana               pt_PT    # Olá, chamo-me Joana e dou voz ao português falado em Portugal.
Jorge               es_ES    # Hola, me llamo Jorge y soy una voz española.
Juan                es_MX    # Hola, me llamo Juan y soy una voz mexicana.
Kanya               th_TH    # สวัสดีค่ะ ดิฉันชื่อKanya
Karen               en_AU    # Hello, my name is Karen. I am an Australian-English voice.
Kyoko               ja_JP    # こんにちは、私の名前はKyokoです。日本語の音声をお届けします。
Laura               sk_SK    # Ahoj. Volám sa Laura . Som hlas v slovenskom jazyku.
Lekha               hi_IN    # नमस्कार, मेरा नाम लेखा है. मैं हिन्दी में बोलने वाली आवाज़ हूँ.
Luca                it_IT    # Salve, mi chiamo Luca e sono una voce italiana.
Luciana             pt_BR    # Olá, o meu nome é Luciana e a minha voz corresponde ao português que é falado no Brasil
Maged               ar_SA    # مرحبًا اسمي Maged. أنا عربي من السعودية.
Mariska             hu_HU    # Üdvözlöm! Mariska vagyok. Én vagyok a magyar hang.
Mei-Jia             zh_TW    # 您好,我叫美佳。我說國語。
Melina              el_GR    # Γεια σας, ονομάζομαι Melina. Είμαι μια ελληνική φωνή.
Milena              ru_RU    # Здравствуйте, меня зовут Milena. Я – русский голос системы.
Moira               en_IE    # Hello, my name is Moira. I am an Irish-English voice.
Monica              es_ES    # Hola, me llamo Monica y soy una voz española.
Nora                nb_NO    # Hei, jeg heter Nora. Jeg er en norsk stemme.
Paulina             es_MX    # Hola, me llamo Paulina y soy una voz mexicana.
Samantha            en_US    # Hello, my name is Samantha. I am an American-English voice.
Sara                da_DK    # Hej, jeg hedder Sara. Jeg er en dansk stemme.
Satu                fi_FI    # Hei, minun nimeni on Satu. Olen suomalainen ääni.
Serena              en_GB    # Hello, my name is Serena. I am a British-English voice.
Sin-ji              zh_HK    # 您好,我叫 Sin-ji。我講廣東話。
Tessa               en_ZA    # Hello, my name is Tessa. I am a South African-English voice.
Thomas              fr_FR    # Bonjour, je m’appelle Thomas. Je suis une voix française.
Ting-Ting           zh_CN    # 您好,我叫Ting-Ting。我讲中文普通话。
Tom                 en_US    # Hello, my name is Tom. I am an American-English voice.
Veena               en_IN    # Hello, my name is Veena. I am an Indian-English voice.
Victoria            en_US    # Isn't it nice to have a computer that will talk to you?
Xander              nl_NL    # Hallo, mijn naam is Xander. Ik ben een Nederlandse stem.
Yelda               tr_TR    # Merhaba, benim adım Yelda. Ben Türkçe bir sesim.
Yuna                ko_KR    # 안녕하세요. 제 이름은 Yuna입니다. 저는 한국어 음성입니다.
Yuri                ru_RU    # Здравствуйте, меня зовут Yuri. Я – русский голос системы.
Zosia               pl_PL    # Witaj. Mam na imię Zosia, jestem głosem kobiecym dla języka polskiego.
Zuzana              cs_CZ    # Dobrý den, jmenuji se Zuzana. Jsem český hlas.
6
  • 2
    Based on my own (very subjective) evaluation as a native French speaker I would say the voice is very good. I just joined this site to upvote your answer!
    – Relaxed
    Sep 4, 2015 at 12:26
  • 2
    great answer! I guess it is easily generalizable to other languages as well. What would be in this case the name of the narrators? :-)
    – Ant
    Sep 4, 2015 at 12:54
  • Many other voices & languages are available; see the Other Languages section. Sep 4, 2015 at 14:17
  • 1
    I have updated the answer; I believe Service is now called Quick Action in macOS 10.14. Jul 2, 2019 at 12:30
  • 1
    @SuperSpy no, Siri's voice is not available for general use. Oct 1, 2019 at 6:35
7

Kind of old post and maybe you have found a solution already. One way to simplify this is with Automator.

Open Automator, choose Service, Service receives selected text, drag action "Speak Text" to build worklow select Voice (for example: Ryan Speaking) Save

Repeat with different voices.

(The Services List can be edited/cleaned up with Service Scrubber Application and partly under System Preferences > Keyboard > Keyboard Shortcuts > Services)

Edit: Now that you have two or more Voices under the Services Menu, you can go to: System Preferences > Keyboard > Keyboard Shortcuts > Application Shortcuts and create a new Shortcut for each voice.

So far, it works like this on my machine (OS 10.6.8): Default System Voice: Ryan (Infovox) Shortcut Selected in Speech Pref to Control+S. This starts and stops English text.

The German voice I have assigned Control+Y (Yannick voice from Lion OS). Control+Y starts German voice for German selected text; which can be stopped by clicking the main start/stop shortcut twice, here Control+S+S. The reason for twice is because pressing it once starts the English voice over the German voice. That's the best I could come up so far. Make sure the shortcuts don't conflict with other shortcuts. You will notice that the additional shortcut allows you to start several voice threads, talking over each other plus the default system voice, which drives up processor activity, but no problem if one remembers to stop the speaking by double-executing of the shortcut for the default voice.

Not sure if this works system-wide, but works in my browsers, Mail, and the BookReader app I'm using.

Edit 2: I have noticed that when activating a secondary text-to-speech voice via the Automator Service the Automator Runner process drives up processor activity to above 100% with fans speeding up. Not sure if there is a solution to this.

1
  • 1
    Can you add a screenshot of your Automator workflow? With Automator this is usually easier to understand than a textual description
    – nohillside
    Nov 27, 2012 at 4:27
3

I wrote a tool for that, just go to:

https://github.com/Fredmf/polyglott

2
  • Hi, welcome to Ask Different. Please explain a little bit what your tool does and how. Thanks! Sep 27, 2016 at 12:53
  • Thank you for creating this. I found this the most helpful tool on this page.
    – SuperSpy
    Sep 30, 2019 at 19:13
2

You could also set the system voice to a French one.

Go to System Preferences > Dictation & Speech > Text to Speech and set the system voice to Thomas for example.

Then:

  1. Select any text in any application
  2. Control+Click to reveal the context menu
  3. Choose Speech > Start Speaking

There is also an option to set a shortcut, so you can just select any text and press the shortcut to start speaking in French.

2
  1. Launch Automator.app

  2. Create a new Service

  3. Add a Speak Text action

  4. Select Samantha

  5. Save the service as SpeakSamantha

Add a Speak Text action

Setup a keyboard shortcut for the service

  1. Open System Preferences

  2. Select Keyboard

  3. Select Shortcuts

  4. Select Services

  5. Create a shortcut, Command + Alt + 1 for SpeakSamantha

Create a shortcut for SpeakSamantha

To use the service

  1. Open a browser

  2. Select some English texts

  3. Press Command + Alt + 1

To stop the speech (Method 1)

  1. Press Alt + ESC

To stop the speech (Method 2)

  1. Click the spinning cog icon in the menu bar

  2. Click the

Click the spinning cog icon in the menu bar

To add a second voice

  1. Repeat the process above adding the following minor changes

  2. Select a second voice, for example, Anna, a German voice

  3. Save the service as SpeakAnna

  4. Create a keyboard shortcut, Command + Alt + 2 for SpeakAnna

A known small issue: Don't press a shortcut again before you end the speech or the speech ends. Otherwise, you will get an error message like the following.

enter image description here

1

Using a custom service with the standard Speak Text action to speak selected text with a specific alternative voice has one major drawback, as detailed in Mikofox's answer:

You cannot easily stop playback the way you can with the built-in TTS service simply by pressing the keyboard shortcut again.

There are two solutions:

Disclosure: I created the prepackaged services and the voices CLI

  • Build a custom service with a Run Shell Script action instead, in which you use the say CLI, which allows implementing a playback toggle (stopping speech if invoked while still speaking from previous invocation)

    • See below for a simple implementation that works, but it won't honor any custom speaking rates (words per minute) that you may have configured for individual voices via System Preferences.
    • A solution that honors the custom speaking rates requires quite a bit more work; you can find a prepackaged service here; or use the direct download link (will stay current)..
  • Alternatively, create a service that switches the default voice on demand, which then allows you to use the built-in TTS service with its playback toggle feature.

    • While OSX offers no programmatic way to change the default voice, you can use a prepackaged service built on the voices CLI:
      Follow the instructions here or use the direct download link (will stay current).

Simple implementation of a service with playback toggle:

As stated, this won't honor custom speaking rates configured for the chosen voice.

  • Create a new service in Automator
  • Leave the defaults (service receives text in any application)
  • Add a Run Shell Script action and paste the following:
#  ------- BEGIN: CUSTOMIZE
 # Specify the voice to speak with.
voice=Vicki
#  ------- END: CUSTOMIZE

  # If `say` is running, we assume that a previous invocation is still speaking  
  # and speaking should be *stopped*.
  # Caveat: This will only work if either the original app from which speaking was initiated is still
  #         frontmost with text selected, or, coincidentally, a now different frontmost app also has
  #         text selected. Otherwise, this service won't be active.
pgrep -x say && { pkill -x say; exit; }

  # Read the text to speak into a variable.
txt=$(</dev/stdin)

  # Speak, using the standard `say` CLI.
say -v "$voice" "$txt"
0

As Mikofox mentioned, you can make an Automator service for speaking text:

There is a bug in 10.8 and 10.7 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 when speaking text.

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

try -- if the clipboard is empty, trying to get it results in an error
    set old to the clipboard as record
end try
try
    tell application "System Events" to keystroke "c" using command down
    delay 0.05
    set input to the clipboard
    try
        set the clipboard to old
    end try
    say input using "Kyoko"
end try

Another option is to just run something like pbpaste | say -v kyoko.

2
  • 1
    Is there a way to select Siri's voice in your tools? Thank you for creating the switch default voice utility!
    – SuperSpy
    Sep 30, 2019 at 19:56
  • This pbpaste technique is excellent! Thanks! echo 'Guten Tag. Wie geht es?' | pbcopy && pbpaste | say -v Anna Jan 25, 2020 at 15:48

You must log in to answer this question.

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