int CHUNKED_SIZE = 8000;
public void recognizeText(byte[] data) throws InterruptedException, IOException {

        init();

        byte[] buffer = new byte[CHUNKED_SIZE];

        ByteArrayInputStream stream = new ByteArrayInputStream(data);

        while (stream.read(buffer) != -1)
        {
            send(buffer);
        }
        send("EOS");
    }

String fileName = "F:\\aaa.wav";
RandomAccessFile raf = new RandomAccessFile(fileName,"r");
raf.skipBytes(44);
byte [] audioData = new byte[(int)(raf.length() - 44)];
raf.readFully(audioData);
recognizeText(audioData);

每次读取8000字节

posted on 2019-11-07 12:51  你不知道的浪漫  阅读(788)  评论(0编辑  收藏  举报