[Android SDK] Text-To-Speech addSpeech not working properly
- by arcoraven
Hi, I'm trying to get my Android app to play a .wav file recording of the word "Spinach Salad" whenever it sees that phrase being spoken by TTS. Here's the relevant code:
spinach_salad.wav is located in /res/raw
prodName = "Spinach Salad"
mTts.addSpeech(prodName, "com.example.textextractor", R.raw.spinach_salad);
...and later in the code:
mTts.speak("blah blah blah " + prodName, TextToSpeech.QUEUE_ADD, null);
I've also tried:
mTts.speak("blah blah blah Spinach Salad", TextToSpeech.QUEUE_ADD, null);
and
mTts.speak("blah blah blah", TextToSpeech.QUEUE_ADD, null);
mTts.speak(productName_str, TextToSpeech.QUEUE_ADD, null);
In both cases, I'm just hearing the TTS synthesized audio, rather than my custom .wav file. (On a related note, the last chunk of code sometimes speaks out of order, saying the second line before the first).