Wednesday, December 21, 2011

Android TextToSpeech

Android TextToSpeech:

this example for text convert speech. ex: what you are passing value into texttospeech it convert speech.
android text to speech example code ;

Emulator this is working fine but mobile you have install external library speech synthesis..... form android android market.

Goto->mobile->settings->voice input and output->text-to-speech settings->install voice data.


public class TextToSpeachActivity extends Activity implements OnInitListener {
    /** Called when the activity is first created. */
    private TextToSpeech    textToSpeech;;
    EditText edt;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
         edt=(EditText)findViewById(R.id.edittext);
        Button btn =(Button)findViewById(R.id.button1);
        textToSpeech=new TextToSpeech(this, this);
      //  textToSpeech.setLanguage(Locale.US);
        btn.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                textToSpeech.speak(edt.getText().toString(), TextToSpeech.SUCCESS, null);
            }
        });
    }
    @Override
    public void onDestroy() {
        if (textToSpeech != null) {
            textToSpeech.stop();
            textToSpeech.shutdown();
        }
        super.onDestroy();
    }
    public void onInit(int status) {
    }
}

3 comments:

  1. Hi there, I discovered your blog by means of Google
    whilst searching for a similar topic, your website came up, it seems
    good. I've bookmarked it in my google bookmarks.
    Hi there, simply turned into alert to your weblog through Google, and found that it's really informative.
    I am going to be careful for brussels. I will be grateful when you proceed
    this in future. Lots of folks will probably be benefited out of your writing.
    Cheers!
    Also see my website > cigarettes online

    ReplyDelete
  2. Hello Sir ,
    i have a problem ,i create a application voice recogation password.voice not match this application .if u have appliction plz send me ..

    ReplyDelete
  3. Hey! I just wanted to ask if you ever have any trouble with hackers?
    My last blog (wordpress) was hacked and I ended up losing months of hard work due to no back up.
    Do you have any methods to protect against hackers?
    My web site - male breast reduction

    ReplyDelete

Check out this may be help you

Related Posts Plugin for WordPress, Blogger...