Getting text-to-speech to read in French?

Hi All,
On my Mac running Mojave 10.14.3, I’m trying to set up a way where I can keep the default English language text-to-speech but can toggle to French. In an AskDifferent post from 2016 someone provided this Apple-Script, which runs fine, except that I can’t find where to run it from; the author said it would be listed in the contextual menu under services, but it’s not there. I’m illiterate in AppleScript, but maybe this will illuminate it:
on run {input, parameters}
do shell script "say -v Thomas " & (quoted form of (input as string))
return input
end run
Once this mystery is solved, I’d also like to know if there’s a way to script in faster speech, and perhaps (dreaming big) set up a keyboard shortcut (I’m already using the option listed under speech preferences to have the voice read in English).

And if someone has a better way, that would be fabulous too!

On a funny -ahem side note, the window that pops up in MPU Talk discussion forum that says “Your topic is similar to” has “Getting Ready for Lion” and “Getting Ready for Mavericks,” etc.

Thanks friends!
-P

There are a few options for accessing the script.

You can set up a ‘script menu’ which displays in your menu bar and allows you to select scripts to run. Some instructions here

You can follow the instructions here to turn the AppleScript into a service which you could then access from the right-click menu.

If you have Keyboard Maestro you could use that to assign a keyboard shortcut very easily. I’m sure there are other options around but since I have KM I don’t know about them, haha.

I haven’t played around with text-to-speech in AppleScript much but looking here it looks like it’s pretty simple to set the speed. The easiest would be to copy the second AppleScript example pretty much. Let me get to a device that’s not an iPhone and I can type something out that should work!

Thanks! I actually do have KM, and wonder if there’s a way just to set the whole thing up as a macro. I’d like to say I’m new, but truth is, I’ve always just dabbled at the edges. :slight_smile:

Ah! Did some digging and KM actually has a built-in “Speak Text” action which even allows you to change the speed.

I have something working and will upload in a minute. :slight_smile:

Try this:

https://kaitlinsalzke.com/2019/02/03/keyboard-maestro-macro-speak-selected-text-aloud-in-french-or-another-language/

Thanks! This looks really promising, but I can’t get it to work. It just makes that dud KM noise. When I tried “try” the voice spoke in French, but I couldn’t tell what it was reading, and I’m a fluent speaker. So I attempted various other triggers (because the one supplied is one I use for something else), but none of these worked either. I’m pretty sure I’m just supposed to highlight text, then hit the trigger, right? Any theories about what I could be doing wrong? It’s possibly something with the temporary clipboard, but I wouldn’t know what to call another one. Thanks for finding this - I really appreciate it. (If you don’t have an obvious answer, I’ll take this over to the KM forum.)

Hmm, maybe it’s something to do with the temporary clipboard? It’s definitely working for me so perhaps it’s something in the import/export (which I haven’t tried before). Could you maybe take a screenshot and I’ll see if anything has changed?

Thanks! I changed the voice to Audrey because she was the one I have. :slight_smile:

(I see you fixed my typo in the name, too, haha. Sorry about that!)

Hmmm, no, it’s identical to mine apart from the name/speed and that shouldn’t matter. I have no idea why it wouldn’t be working. I assume the ‘try’ action is trying to read the actual token or something (with the % signs) so if so that would explain why it’s incomprehensible…

The only things I can think of:

  • Maybe it’s not copying to the clipboard fast enough; if you add in a pause of a few seconds between the two does that help?
  • You could try adding a status bar menu trigger and running it that way to rule out the issue of a conflicting key command, perhaps.
  • Or, if that fails, try just using the regular system clipboard? To do that you would just change the ‘Copy to named clipboard’ action to just ‘Copy’ and change the ‘Speak’ text to %SystemClipboard%. Obviously that would leave the text on your clipboard but you can always add another action to get rid of it if you need to—at the very least it might give you some sense of where the problem lies.

I tried all three, and none of them worked. But using the “status menu” trigger yielded something that could offer a clue: the items that came up were all bits of text that I’d copied and pasted, not just to read in French, but basically anything from the default clipboard. So I changed back to “temporary” and the same thing happens: the menu offers me a chance to paste whatever I copied in the currently open document. of course this could just mean the status menu trigger isn’t suited. But looking through the list, it seems like the only one even remotely possible for testing other than a hotkey.

Just to clarify: when it’s working fine for you, you highlight text, then your keyboard shortcut, and voilà?
t

Yep, that’s it; works like a charm on my end…