Dismiss Notice

REGISTRATION IS AFTER ADMIN ACTIVATION

DONATIONS WITH PAYPAL CLICK TO BUTTON

1 MONTH VIP - 5$; 3 MONTHS VIP - 10$; 6 MONTHS VIP - 20$; 1 YEAR VIP - 30$; 2 YEARS VIP - 50$; GOLD USER FOR LIFE VIP - 150$

DONATIONS WITH Bitcoin Address:3NRs3CK3fhXifrNYxHEZKpETDd9vNLMsMD

Dismiss Notice
The registration is approved by the Administrator. It takes about 1 day to approve your registration
Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

Text To Speech (TTS) Wrapper For Android

Discussion in 'Delphi Android And IOS' started by N0body, Feb 2, 2014.

  1. N0body
    Online

    N0bodyN0body is a Verified Member DelphiFan Administrator Staff Member DF Staff

    Embarcadero has a blog post from September 2013 that highlights a Text To Speech (TTS) unit that was created by Jeff Overcash. The TTS unit wraps the native Android Text to Speech API and gives you access to it from your Delphi XE5 Firemonkey application. You can take a look at the Android SDK information for android.speech.tts to see the full help on using the API. The interfaces that are implemented in the wrapper are listed below:

      JSynthesisCallback = interface; // android.speech.tts.SynthesisCallback
    JSynthesisRequest = interface; // android.speech.tts.SynthesisRequest
    JTextToSpeech = interface; // android.speech.tts.TextToSpeech
    JTextToSpeech_Engine = interface; // android.speech.tts.TextToSpeech$Engine
    JTextToSpeech_EngineInfo = interface; //android.speech.tts.TextToSpeech$EngineInfo
    JTextToSpeech_OnInitListener = interface; // android.speech.tts.TextToSpeech$OnInitListener
    JTextToSpeech_OnUtteranceCompletedListener = interface; // android.speech.tts.TextToSpeech$OnUtteranceCompletedListener
    JTextToSpeechService = interface; // android.speech.tts.TextToSpeechService
    JUtteranceProgressListener = interface; // android.speech.tts.UtteranceProgressListener

    And here is a sample from the demo that is included with the wrapper:

    procedure TForm1.TttsOnInitListener.onInit(status: Integer);
    var
    Result : Integer;
    begin
    if (status = TJTextToSpeech.JavaClass.SUCCESS) then
    begin
    result := FParent.tts.setLanguage(TJLocale.JavaClass.US);
    if (result = TJTextToSpeech.JavaClass.LANG_MISSING_DATA) or
    (result = TJTextToSpeech.JavaClass.LANG_NOT_SUPPORTED) then
    ShowMessage(‘This Language is not supported’)
    else
    begin
    FParent.Button1.Enabled := true;
    FParent.button2.Enabled := false;
    end;
    end
    else
    ShowMessage(‘Initilization Failed!’);
    end;

    procedure TForm1.SpeakOut;
    var
    text : JString;
    begin
    text := StringToJString(Memo1.Lines.Text);
    tts.speak(text, TJTextToSpeech.JavaClass.QUEUE_FLUSH, nil);
    end;

    [​IMG]

    Download Source Code
     
    arty likes this.
  2. ilsouza
    Offline

    ilsouza DF Junior

    RE:

    How to say in portuguese Brazil?
     
  3. racehv
    Offline

    racehv Guest

    RE:

    Thanks
     
  4. vedatpala
    Offline

    vedatpala DF Junior

    RE:

    thanks
     
  5. peek_c
    Offline

    peek_c DF Member

    thanks
     

Share This Page

Laws
Our website, law, laws, copyright and aims to be respectful of individual rights. Our site, as defined in the law of 5651 serves as a provider of space. According to the law, contrary to the law of site management has no obligation to monitor content. Therefore, our site has adopted the principle of fit and remove. Works are subject to copyright laws and is shared in a manner that violated their legal rights, or professional associations, rights holders who, adsdelphi@gmail.com I can reach us at e-mail address. Complaints considered to be infringing on the examination of the content will be removed from our site.
Donate Help To Us and Be VIP
DONATIONS WITH PAYPAL CLICK TO BUTTON
6 MONTHS VIP - 20$; 1 YEAR VIP - 30$; 2 YEARS VIP - 50$; GOLD USER FOR LIFE VIP - 150$
Social Block