mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 21:39:47 +00:00
SpeechSynthesis.java: expose the different voice options from eSpeak
This makes the following changes:
1. setVoice takes a Voice object instead of a language string.
This is to make the API cleaner and allows SpeechSynthesis
to pass the correct parameter (identifier for SetVoiceByName,
or name for SetVoiceByProperties) to espeak.
2. The espeak_SetVoiceByName API is also exposed to support passing
the voice variant to use.
3. The age parameter has been re-added with the constants:
* SpeechSynthesis.AGE_ANY
* SpeechSynthesis.AGE_YOUNG
* SpeechSynthesis.AGE_OLD
based on the behaviour of the eSpeak voice selection algorithm.
NOTE: Due to the way that voice selection is implemented in eSpeak,
if variant is specified, the age and gender cannot be specified and
vice versa.
This commit is contained in:
@@ -221,7 +221,7 @@ public class TtsService extends TextToSpeechService {
|
||||
mCallback.start(mEngine.getSampleRate(), mEngine.getAudioFormat(),
|
||||
mEngine.getChannelCount());
|
||||
|
||||
mEngine.setVoice(mMatchingVoice.name, gender);
|
||||
mEngine.setVoice(mMatchingVoice, null, gender, SpeechSynthesis.AGE_ANY);
|
||||
mEngine.setRate(rate);
|
||||
mEngine.setPitch(pitch);
|
||||
mEngine.synthesize(text, text.startsWith("<speak"));
|
||||
|
||||
Reference in New Issue
Block a user