diff --git a/js/accessibility/voicing/voicingManager.js b/js/accessibility/voicing/voicingManager.js index 8d15ad803..1f7c98651 100644 --- a/js/accessibility/voicing/voicingManager.js +++ b/js/accessibility/voicing/voicingManager.js @@ -195,6 +195,21 @@ class VoicingManager extends Announcer { this.voicesChangedEmitter.emit(); } + /** + * Returns an array of voices where "Google" voices are prioritized. Google voices generally sound the best so they + * can be promoted if desired. Returns an array of SpeechSynthesisVoices where "Google" voices are at the top of the + * list. + * @public + */ + getVoicesWithGooglePrioritized() { + assert && assert( this.initialized, 'No voices available until the voicingManager is initialized' ); + assert && assert( this.voices.length > 0, 'No voices available to provided a prioritized list.' ); + + return this.voices.slice( 0 ).sort( ( a, b ) => { + return b.name.includes( 'Google' ) ? 1 : -1; + } ); + } + /** * Implements announce so the voicingManager can be a source of output for utteranceQueue. * @public