Closed stephen-soltesz closed 11 months ago
@ken107 -- this is a first attempt to add the functionality mentioned in https://github.com/ken107/read-aloud/issues/351. I'm not very familiar with javascript or jQuery -- if there are preferable ways to do this, please let me know. I'm happy to make revisions.
In an early draft I placed the filtering in options.js:populateVoices
, however accessing the gcpCreds
felt unnatural here. So, I moved the filtering to GoogleWavenetTtsEngine.updateVoices
, where the credentials make sense in context. While the first way correctly updated the displayed list after returning to options.html
, unfortunately, the second approach does not. Is there a better way?
1) The checkbox should be unchecked by default
2) If you do the filtering in the getVoices()
function right above the updateVoices()
, I think that would be best. Don't worry about getFreeVoices()
.
Other than that, looks good.
getVoices()
, that's a better choice. It appears to solve the refresh issues when returning to options.html.So, I think this is feature complete.
This change adds a new checkbox configuration option to the "Enable Custom Voices" dialog to enable GCP Studio voices.
Changes
custom-voices.html
&js/custom-voices.js
js/defaults.js
includes two changes:isGoogleWavenet()
is modified to generally recognize any Google voice, including Studio, to minimize other changes.isGoogleStudio()
is new, so thatGoogleWavenetTtsEngine.updateVoices()
can filter Studio voices based on configuration.js/tts-engines.js
isGoogleStudio
filtering step toupdateVoices()
based on the new configuration setting.Testing
Since the authoritative set of Google voices supported by Read Aloud are returned by https://support.readaloud.app/read-aloud/list-voices/google (which do not currently return Studio voices), I temporarily modified
GoogleWavenetTtsEngine.updateVoices()
to use the static list of voices that now include some Studio examples. This final PR reverts the changes used for testing.UI Changes
The "Enable Custom Voices" dialog, that allows registration of API keys, now includes a GCP checkbox and warning.