第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

安卓中的文本到語音轉(zhuǎn)換離線工作

安卓中的文本到語音轉(zhuǎn)換離線工作

ibeautiful 2022-09-28 09:48:22
我和我的朋友正在開發(fā)一個(gè)應(yīng)用程序,使用深度學(xué)習(xí)和神經(jīng)網(wǎng)絡(luò)來幫助視障人士。我們正在尋找一種方法,通過語音將神經(jīng)網(wǎng)絡(luò)通過智能手機(jī)攝像頭獲得的信息帶回給用戶,因此我們需要做TextToSpeech。但是,對(duì)于用戶來說,讓應(yīng)用程序離線工作是一個(gè)巨大的,巨大的交易,并且由于應(yīng)用程序的所有其他部分都能夠在沒有互聯(lián)網(wǎng)連接的情況下運(yùn)行(神經(jīng)網(wǎng)絡(luò)等),我們正在尋找一種離線進(jìn)行TextToSpeech的方法。該應(yīng)用程序也是俄語的,因此可以支持多種語言的東西會(huì)很棒。我們非常感謝任何關(guān)于從哪里開始在Android工作室的安卓上離線文本的提示,謝謝!
查看完整描述

1 回答

?
12345678_0001

TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超5個(gè)贊

試試這個(gè)。確保在 xml 布局中添加文本輸入框和按鈕


    import java.util.Locale;

    import android.speech.tts.TextToSpeech;


public class TextToSpeech{


    private EditText write;

    private TextToSpeech t1;

    private Button speakbtn;


@Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate ( savedInstanceState );

        setContentView ( R.layout.activity_text_to_speech );


        write = (EditText) findViewById ( R.id.editText );

        speakbtn = (Button) findViewById ( R.id.board );


  t1 = new TextToSpeech ( getApplicationContext () , new TextToSpeech.OnInitListener () {

            @Override

            public void onInit(int status) {


                if (status != TextToSpeech.ERROR) {

                    t1.setLanguage ( Locale.ENGLISH );


                }


            }

        } );


 speakbtn.setOnClickListener ( new View.OnClickListener () {

            @Override

            public void onClick(View v) {


                String toSpeak = write.getText ().toString ();

                Toast.makeText ( getApplicationContext () , toSpeak , Toast.LENGTH_SHORT ).show ();

                t1.speak ( toSpeak , TextToSpeech.QUEUE_FLUSH , null );


            }

        } );


  }

    @Override

    public void onDestroy() {

        //Dont forget to shut down text to speech

        if (t1 != null) {

            t1.stop ();

            t1.shutdown ();

        }

        super.onDestroy ();

    }


}


查看完整回答
反對(duì) 回復(fù) 2022-09-28
  • 1 回答
  • 0 關(guān)注
  • 77 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)