Prefer natural voices for read aloud
Rank platform voice quality and select the most natural automatic voice while keeping explicit voice choices intact. Surface natural labels, hide novelty voices in the picker, and guide Apple users to download enhanced voices when needed.
This commit is contained in:
@@ -22,6 +22,12 @@ class FlutterTtsSpeechEngine extends SpeechEngine {
|
||||
TargetPlatform.linux || TargetPlatform.fuchsia => false,
|
||||
};
|
||||
|
||||
@override
|
||||
bool get supportsVoiceDownloadHint =>
|
||||
!kIsWeb &&
|
||||
(defaultTargetPlatform == TargetPlatform.iOS ||
|
||||
defaultTargetPlatform == TargetPlatform.macOS);
|
||||
|
||||
/// AVSpeechSynthesizer's normal rate is 0.5 on a 0..1 scale; Android's
|
||||
/// TextToSpeech and the Web Speech API use 1.0 as normal.
|
||||
bool get _appleScale =>
|
||||
@@ -106,7 +112,7 @@ class FlutterTtsSpeechEngine extends SpeechEngine {
|
||||
return [
|
||||
for (final item in raw is List ? raw : const [])
|
||||
if (item is Map && item['name'] != null && item['locale'] != null)
|
||||
SpeechVoice(name: '${item['name']}', locale: '${item['locale']}'),
|
||||
SpeechVoice.fromPlatform(item.cast<Object?, Object?>()),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user