Sublime Forum

Problem with OS X's text to speech

#1

I would love to switch to using Sublime Text 2. However, I have one issue that I need help with before I can use it. I’m visually impaired and use Apple’s “Speak selected text when key is pressed” option in the Speech preference pane. When I hit my key combo it only reads back the title bar of the current window, not the text that’s selected. Is there anyway this could be fixed? I use the text to speech quite frequently.

Thanks,
Scott Martin

0 Likes

OS X's Text to Speech feature isn't working properly in SB 3
#2

I have the same problem (though I did buy a license). It would be very helpful to have this fixed for people that require this feature.

0 Likes

#3

Have you tried the version 3 beta? Does it still have this problem?

0 Likes

#4

I just released a plugin for Sublime Text 2 that will take care of this for the most part. If anyone needs this functionality, check it out at:

github.com/scottmartin/speak-se … xt-sublime

0 Likes

#5

Thanks scottm,

This works great in ST3 beta (3062) under OS X 10.9.

I assigned a different key binding as the default OS X one ignores the selected text and reads from the top of the document.

0 Likes

#6

can one use this plugin without a mouse? say, just to read the current sentence i am typing?

0 Likes

#7

Hi there,

Any chance of getting TTS to work properly in Sublime ?

I use Sublime all the time to code and to keep notes, but I cannot use it for language-learning for lack of this TTS feature.

Note: the plugin mentioned works with Sublime 2, not Sublime 3, and the author is not going to port it to the new version (he moved to Atom.)

What can we do to help?

Best –
Fabien

0 Likes

#8

The package seems to support ST3, it is just not in package control speak-selected-text-sublime#3. Just install it from github.

0 Likes

#9
0 Likes

#10

speak-selected-text-sublime doesn’t work for me in ST3 (see thread referenced by r-stein, while the plugin’s author has no plan to provide official support for ST3.

One could argue that it’s a feature that’s supposed to work through the operating system.

What usually happens to such bugs/limitations in ST?

0 Likes

#11

Works for me. You may want to look more closely at how you install it and whether the “say” command is working correctly on your machine (using terminal). I’m running Dev Build 3125.

My install process: went to the github page and created a zip using the green button on the right. Unpacked that zip into a folder in my Packages directory (select Preferences > Browse Packages to get there) which I renamed “Speak Selected Text.”

I went to a window and right clicked some selected text and selected “Speak Select Text.”

0 Likes

#12

I would argue that this issue is mostly Apple’s fault. The way this feature use to work is that it would just copy the selected text into the clipboard and read it from there. This meant that it worked in every application that didn’t actively prevent you from copying text. Now that they changed it to be a part of the OS’ API, it means developers have to go the extra step to support this API unless they’re using nothing but built in text controls.

I finally got tired of dealing with it across multiple applications. If you use, or are willing to get Keyboard Maestro https://www.keyboardmaestro.com/main/ I was able to reproduce Apple’s old TTS behavior using the clipboard. You can find the macro at https://github.com/scottmartin/talking-maestro.

I know it doesn’t directly fix the issue in Sublime Text, but it should work on any version of Sublime and it does seem to fix the issue across most applications I’ve needed it in.

I hope it helps.

0 Likes

#13

I now realize the plugin per se works. What doesn’t work is the system-wide keyboard shortcut (as configured in Preferences › Speech.)

As a workaround, I considered going the extra mile and tried duplicating my shortcut in Sublime in Key Bindings, something like:

  {
      "keys": ["alt+`"],
      "command": "speak_selected_text"
  }

…unfortunately, the key I want to use (the backtick) is not supported by Sublime (but is very convenient when switching between multiple languages all the time.)

Any chance to hear from the lead developers on this, and to get support for the OS’s TTS?

I’m a coder, writer and linguist / constant language-learner, and I’d like to be able to keep using Sublime Text for taking notes. Until this is fixed, I’m condemned to using Google Doc.

0 Likes

#14

Open the console View > Show Console and write sublime.log_input(True) to log the key inputs. Then press your keybinding and look at the output.

0 Likes

#15

It’s definitely supported by Sublime; if it doesn’t work for you, either the command name is not correct or there is something OS level that’s eating the key before Sublime gets a chance to see it.

0 Likes

#16

You’re more likely to get abducted by aliens than either of those two outcomes.

0 Likes

#17

@OdatNurd: I use U.S. International - PC as the keyboard layout, as it lets me input accented characters (French, Spanish, Hungarian) very easily. i.e.: I first press the backtick key, then the vowel I want to produce (resulting in e.g. è, ù.) In those conditions, with sublime.log_input(True), the console doesn’t return anything on that first keypress of the backtick, only after the second one.

@nutjob2: why?

0 Likes

#18
  • there’s already a workable solution
  • a solution could be scripted if there wasn’t
  • the developer would implement it as a script anyway
  • only relates to a single platform
  • the developer is probably at the beach
0 Likes