0

I want to make an app that speaks while it highlights text (like karaoke songs).

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • Here's a [simple text-to-speech example](http://stackoverflow.com/questions/32936077/googles-text-to-speech-api-from-android-app/32936643#32936643). A "custom voice" is a separate issue then and either easy, difficult or practically impossible depending on what you mean by a "custom voice". You might find some help from [older discussions about highlighting text](http://stackoverflow.com/search?q=android+highlight+text) for the highlighting part. – Markus Kauppinen Oct 29 '16 at 15:59
  • i want to make an app like this video.......... https://www.youtube.com/watch?v=0qE3egNettY – Minhazul Kabir Oct 29 '16 at 16:12

2 Answers2

0

First of all, here you have an additional resource you maybe will need:

I think you are looking for a Text to Speech functionality.

Just try this (you must adapt this to your particular case):

TextToSpeech tts = new TextToSpeech(this,this);
if (txtText.getText().toString().length() == 0){
      tts.speak("You", TextToSpeech.QUEUE_FLUSH, null);
      /*Change size or color of "You" in your TextView for e.g.*/
      tts.speak("haven't", TextToSpeech.QUEUE_FLUSH, null);
      /*Change size or color of "haven't" in your TextView for e.g.*/
      tts.speak("typed", TextToSpeech.QUEUE_FLUSH, null);
      /*Change size or color of "typed" in your TextView for e.g.*/
} else
        tts.speak(txtText.getText().toString(), TextToSpeech.QUEUE_FLUSH,null);

You could change your TextView color with setSpan() method.

Have a good day!

Community
  • 1
  • 1
0
  1. Start speaking first word.

    mTts.speak("first word", TextToSpeech.QUEUE_FLUSH, null);

  2. Highlight first word.

    String first = "This word is "; String next = "<font color='#EE0000'>red</font>"; t.setText(Html.fromHtml(first + next));

Or Use Spannable link

  1. Detect first word has finished.

    public void onUtteranceCompleted(String utteranceId) { //Next word start }

Community
  • 1
  • 1
Ahmad Aghazadeh
  • 16,571
  • 12
  • 101
  • 98