Transforming this repo from a documentation to a code repo #9
Replies: 6 comments 11 replies
-
Any thoughts on that @danielweck, @chocolatkey, @oscar-rivera-demarque and @mickael-menu? |
Beta Was this translation helpful? Give feedback.
-
That was the first thing I was searching here, since the demo did not order the voices I was feeling like I was missing something. While implementing my own sorting, I started to think about the next issue: how to get notified if the json structure changes? For that reason, code would be much better. I would only need Then I could get the following voice list:
I currently don't have a solution for apple high quality voices. "Lee (Premium)" could end up at the end of our your suggestions, since Lee is the last apple voice in your list. I didn't think about a solution for that, since Apply premium voices are basically dead, since market share of MacOS non safari browsers is nearly nothing. |
Beta Was this translation helpful? Give feedback.
-
I did start to implement more features of your json, but I didn't like having even more code dependent on an external JSON structure. But my biggest issue was managing more lines of code, which aren't the focus of my project. As soon as I started to think about putting the voice selection in a 2nd JS file, I stopped and reverted everything. Instead of implementing it in my proof of concept project. I will be patiently waiting for either your next step or somebody complaining about my not so user-friendly voice selection instead of getting distracted hunting for the perfect centrally managed voice attributes. So I can't give you feedback for the implementation of the new ideas, which is a bit rude since I was the one mentioning new topics. I keep my one-liner as long as I am only in the proof of concept state. If you go for an JS lib, I would recommend sticking to parts used by the demo. Without expending the demo, just the most simple thing, documented voices filtered by language.
|
Beta Was this translation helpful? Give feedback.
-
Here's a quick update on this matter:
|
Beta Was this translation helpful? Give feedback.
-
This repo is very useful. I was wondering if you could create a more detailed code example of how it's intended to select good voices, taking into account different quality levels and different localised names. |
Beta Was this translation helpful? Give feedback.
-
With the on-going work on Readium Speech and a working demo, I can safely close that discussion for now. |
Beta Was this translation helpful? Give feedback.
-
Proposal
As the number of languages supported by this repo increases, it makes it more and more relevant to explore going beyond a documentation repo.
Handling localization through code makes also more sense than documenting hundreds of different alt names (see #38 and #29).
In terms of scope, I believe that providing a utility class for voices could be the right approach to kickstart things. While there are already projects focusing on the entire Web Speech API such as Easy Speech, there's nothing yet with voice selection as a focus.
API
Output
Voices
When calling
voices()
, the API will return an array of voice objects where:label
using the label documented in recommended voices with a fallback on thename
returned bygetVoices()
voiceURI
using the same property returned bygetVoices()
language
using thelang
value returned bygetVoices()
gender
as documented in recommended voices, this property is omitted if this information is missingage
as documented in recommended voices, this property is omitted if this information is missingofflineAvailability
using a boolean based onlocalService
, as returned bygetVoices()
quality
based on the best available quality that can be detected, this property is omitted if this information is missingpitchControl
using a boolean which defaults totrue
if it's undocumentedrecommendedPitch
using thepitch
value documented in recommended voices, this property is omitted if this information is missingrecommendedRate
using therate
value documented in recommended voices, this property is omitted if this information is missingWhen grouped by another criteria,
voices()
will instead return a list of languages, regions, genders or recommended/others that will themselves contain an array of voice objects.Languages
When calling
languages()
, the API will return an array of language objects where:language
is a BCP-47 language tagcount
is the number of available voices for that language, based on filters that were appliedExamples
Example 1: Return a list of recommended voices for English
VoiceSelector.voices.filterByLanguage("en").recommended
which would return a list of all recommended voices available on the current device, ranked by position in the list of recommended voices.Example 2: Return a list of languages and list all voices per language
A dropdown selector where the user can override the language used to read aloud their publication would use:
VoiceSelector.languages()
which would return a list of all available languages.A second dropdown selector would list voices available to the user based on a given language. Recommended voices would be displayed on top, followed by every other voice available, grouped by region:
VoiceSelector.voices.filterByLanguage("en").sortByRecommended().groupByRegion()
which would return all voices available in English, grouped by region and sorted according to the list of recommended voices, with the remaining voices listed below in each region.Beta Was this translation helpful? Give feedback.
All reactions