Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a sound to Android pico TTS engine?

I'm using the pico default android TTS engine with IPA caracters doing this

String text3 = "<speak xml:lang=\"fr-FR\"> <phoneme alphabet=\"ipa\" ph=\"+"+words+"\"/>.</speak>";
        myTTS.speak(text3, TextToSpeech.QUEUE_ADD, null);

It's generally working, but for some letters it doesn't like "ã" or "ɑ" etc.

So my question is, How can I add theses letters/sounds, to this TTS engine ?

like image 338
Laurent Russier Avatar asked Nov 12 '22 05:11

Laurent Russier


1 Answers

Hey you can use addEarcon() to add sounds to testToSpeech link. This medthod is used to add earcons.It will link a text to a speecific sound file. You can also find example on this.

mTts = new TextToSpeech(this, new OnInitListener() {
        @Override
        public void onInit(int status) {
            mTts.addEarcon("[tock]", "com.ideal.itemid", R.raw.tock_snd);
            showRecordingView();
        }
    });

There is also a very good explanation on addEarcon in book Professional Android Sensor Programming by Greg Milette, Adam Stroud at page no 366 and 367.

You can also find example on this link.

like image 105
Ayush Avatar answered Nov 14 '22 22:11

Ayush