Android TTS speaks 0 as "oh" -
when using android texttospeech speak messages have digits, android speaking 0 (zero) "oh" rather "zero". other digits spoken expected.
i've tried couple different ways speak, of them result in issue. first, tried in normal way:
mtts = new texttospeech(mcontext, this); string text= "this test"; string digits= "0 0 0 1"; string finalstring= text+digits; // speak using google tts bundle lparams = new bundle(); lparams.putint(texttospeech.engine.key_param_stream, constants.tts_audio_stream); mtts.speak(finalstring, texttospeech.queue_flush, lparams, "");
i tried digits
"0001" (no spaces). both ended spoken "this test oh oh oh one". next, tried using ttsspans:
mtts = new texttospeech(mcontext, this); string text= "this test"; string digits= "0 0 0 1"; string finalstring= text+digits; spannable lspannedmsg = new spannablestring( finalstring ); ttsspan lspan = new ttsspan.digitsbuilder(digits).build(); ttsspan lspantext = new ttsspan.textbuilder(text).build(); lspannedmsg.setspan(lspan, finalstring.indexof(digits), finalstring.indexof(digits) + digits.length(),spannable.span_exclusive_exclusive); lspannedmsg.setspan(lspantext, finalstring.indexof(text), finalstring.indexof(text) + text.length(),spannable.span_exclusive_exclusive); // speak using google tts bundle lparams = new bundle(); lparams.putint(texttospeech.engine.key_param_stream, constants.tts_audio_stream); mtts.speak(lspannedmsg, texttospeech.queue_flush, lparams, "");
even spanned string, engine still spoke "this test oh oh oh one". there way force google speak 0 "zero"? avoid investigating string sent in , replacing 0 "zero" cause issues other languages.
Comments
Post a Comment