GoogleSTT.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:project-bianca 作者:
public void captureAudio() {
    try {
        audioFormat = getAudioFormat();
        log.info("sample rate         " + sampleRate);
        log.info("channels            " + channels);
        log.info("sample size in bits " + sampleSizeInBits);
        log.info("signed              " + signed);
        log.info("bigEndian           " + bigEndian);
        log.info("data rate is " + sampleRate * sampleSizeInBits / 8 + " bytes per second");
        // create a data line with parameters
        DataLine.Info dataLineInfo = new DataLine.Info(TargetDataLine.class, audioFormat);
        // attempt to find & get an input data line with those parameters
        targetDataLine = (TargetDataLine) AudioSystem.getLine(dataLineInfo);
        targetDataLine.open(audioFormat);
        targetDataLine.start();

        // create buffer for root mean square level detection
        buffer = new FloatSampleBuffer(targetDataLine.getFormat().getChannels(), bufferSize, targetDataLine.getFormat().getSampleRate());

        // capture from microphone
        captureThread = new CaptureThread(this);
        captureThread.start();
    } catch (Exception e) {
        log.error(Service.stackToString(e));
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号