Get the App
SLTechnology News&Howtos  ›  Development  › 

How does Mini Program implement iFLYTEK Interface

Shulou Source: shulou.com Published: 2022-06-01 06:45:56 09月30日 Update

This article mainly introduces "how Mini Program implements iFLYTEK interface". In daily operation, I believe many people have doubts about how Mini Program implements iFLYTEK interface. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts about "how Mini Program realizes iFLYTEK interface". Next, please follow the editor to study!

The following is developed for the iFLYTEK voice interface of java. Post the code directly.

Package com.example.utils

Import java.io.BufferedReader

Import java.io.InputStream

Import java.io.InputStreamReader

Import java.util.ArrayList

Import java.util.List

/ * *

* the transcoding tool class packaged by Created by songzs on 201712Compact 12.*

* /

Public class FFMPEGUtil {

Public static String silk2Pcm (String inputfile,String outputfile) {

Listcommend = new ArrayList ()

Commend.add ("/ usr/local/silk2pcm_tool/SILKCodec/SILK_SDK_SRC_ARM/./decoder")

Commend.add (inputfile)

Commend.add (outputfile)

StringBuffer test=new StringBuffer ()

For (int iTuno Bandi)

Test.append (commend.get (I) + "")

System.out.println ("decoder command:" + test+ "")

Exec (test)

Return outputfile

}

Public static String pcm2Wav (String inputfile,String outputfile) {

/ / ffmpeg-f s16le-ar 12k-ac 2-I / path/to/pcm-f wav-ar 16k-ac 1 / path/to/wav

Listcommend = new ArrayList ()

Commend.add ("ffmpeg")

Commend.add ("- f")

Commend.add ("s16le")

Commend.add ("- ar")

Commend.add ("12k")

Commend.add ("- ac")

Commend.add ("2")

Commend.add ("- I")

Commend.add (inputfile)

Commend.add ("- f")

Commend.add ("wav")

Commend.add ("- ar")

Commend.add ("16k")

Commend.add ("- ac")

Commend.add ("1")

Commend.add (outputfile)

StringBuffer test=new StringBuffer ()

For (int iTuno Bandi)

Test.append (commend.get (I) + "")

System.out.println ("ffmpeg command:" + test+ "")

Exec (test)

Return outputfile

}

Public static String silk_remove_word (String filepath) {

Listcommend = new ArrayList ()

Commend.add ("/ home/workspace/./test.sh")

Commend.add (filepath)

StringBuffer test=new StringBuffer ()

For (int iTuno Bandi)

Test.append (commend.get (I) + "")

System.out.println ("test command:" + test+ "")

Exec (test)

Return filepath

}

Private static void exec (StringBuffer test) {

Try {

Runtime rt = Runtime.getRuntime ()

Process proc = rt.exec (test.toString ())

InputStream stderr = proc.getErrorStream ()

InputStreamReader isr = new InputStreamReader (stderr)

BufferedReader br = new BufferedReader (isr)

String line = null

While (line = br.readLine ())! = null)

} catch (Exception e) {

E.printStackTrace ()

}

}

}

At this point, the study on "how Mini Program implements iFLYTEK interface" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Interfaces iFLYTEK programs learning commands more help practical next code tools articles methods theory knowledge articles websites voice materials follow Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Shulou Information Linux Xiaomi Apple