Jump to content
Sign in to follow this  
shmuel

Say (text-to-speech) with option of voices.

Recommended Posts

Hey all,

 

I've created a text-to-speech workflow based on Mac OS's 'say' command. With it you type 'say' followed by 'what you want to say'. You are then given a list of installed voices to pick from. Select a voice with the arrows or simply hit enter to have your phrase spoken aloud.

 

I've also included an additional novelty command 'sayslow' which will speak your phrase in your chosen voice at a veeerryy slow rate. I don't know why but I find this incredibly comical.

 

https://github.com/shmuel/alfred-say/archive/master.zip

 

- I made the script much more stable in the way it is handling escaping special characters.

- The code is much more DRY.

- It is now easier to extend with more voice styles (i.e. sayfast would be possible as well).

 

-Samuel

Edited by shmuel

Share this post


Link to post

Never used the text-to-speech of my mac, but I believe it will be useful to make sure of the pronounciation of English words (I'm not a native speaker).
Plus, there are fun voices to pick :)

 

Thanks for that !

 

Edit : I noticed that it's necessary to use a simple quote (') to spell more than one word. Without quotes or with double quotes (") it doesn't work.

Edit2 : would it be possible for the worflow to remember the last used voice, and put it in first choice?

Edited by Cedric

Share this post


Link to post

Hey Cedric,

 

I'm glad you found it useful (or at least entertaining). If you select the same voice a few times in a row it should rise to the top of the list. Over time Alfred will prioritize the list based on how frequently you use each voice. It should work fine without quotes (single or double). There is a known bug with apostrophes. If you type "didn't" (no quotes) it will do nothing. This is a problem with how I am escaping this string (or not escaping it). I'll try to figure out how to improve that and post it when I have it sorted.

Share this post


Link to post

OK Cedric,

 

I've updated the workflow. It now works correctly with single quotes / apostrophes. It does not work with double quotes. In fact a double quote will still cause it to fail but I think that is preferable to the way it was perviously. Let me know if it works for you now.

Share this post


Link to post

Hi,

 

When you mean double quote, you mean (") right ? Because, now the behaviour is the opposite as what it used to be.

I used to have to enter 'hello world', else the voices wouldn't load (it would be stuck on keep loading).
Now I have to enter "hello world", as the voices won't load with a single quote.

If I try "I don't know", it will go fine until the ('), then i alfred will display the default search fallbacks instead of the voices.

 

Is it the expected behaviour?

Share this post


Link to post

Cedric,

 

Sorry for the confusion. If you can't tell I'm pretty new to this. Anyway, I think I fixed. Could you download it again and try once more? This time don't wrap the phrase in quotes or double quotes. It should work without being quoted.

Share this post


Link to post

Ok, I've improved it again. This wont change the function of the script much at all but it should be more stable and it's definitely prettier to look at (the code anyway). It's now stored on Github.

Share this post


Link to post

This is a good idea :)

 

I tried it but im having a problem. When i type the first character of the query, it shows the fallback result (eg google searches).

 

Here's what's in the log:

 

Starting debug for 'Say Something'

 

[ERROR: alfred.workflow.input.scriptfilter] Code 1: -e:4:in `split': invalid byte sequence in US-ASCII (ArgumentError)

from -e:4:in `<main>'

[ERROR: alfred.workflow.input.scriptfilter] Code 1: -e:4:in `split': invalid byte sequence in US-ASCII (ArgumentError)

from -e:4:in `<main>'

[ERROR: alfred.workflow.input.scriptfilter] Code 1: -e:4:in `split': invalid byte sequence in US-ASCII (ArgumentError)

from -e:4:in `<main>'

 

Please help. Eager to use your workflow :)

 

 

 

- Jayson

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  
×
×
  • Create New...