【问题标题】:Audio and DeepSpeech音频和 DeepSpeech
【发布时间】:2021-06-14 06:08:40
【问题描述】:

我为 wav 文件测试了 DeepSpeech,它工作正常。当我尝试使用无法识别单个单词的音频流时,我的深度语音问题就出现了。音频流是 PCM 48khz 立体声签名的 16 位小端序。我一直在尝试将流转换为其他格式、sampleRate 和频道,但完全没有成功。我在 nodejs 上使用 DeepSpeech

 modelStream = englishModel.createStream();

    let chunks = [];
    stream.on('data', chunk => {
        chunks.push(chunk);

    }).on('close', () => {
        const buffer = Buffer.concat(chunks);


        let stream = new Duplex();
        stream.push(buffer);
        stream.push(null);
        let audioStream = new MemoryStream();
        stream.pipe(Sox({
            global: {
                'no-dither': true,
            },
            output: {
                bits: 16,
                rate: desiredSampleRate,
                channels: 1,
                encoding: 'signed-integer',
                endian: 'little',
                compression: 0.0,
                type: 'raw'
            }
        })).
        pipe(audioStream);

        audioStream.on('finish', () => {
            let audioBuffer = audioStream.toBuffer();

            const audioLength = (audioBuffer.length / 2) * (1 / desiredSampleRate);
            console.log('audio length', audioLength);

            let result = englishModel.stt(audioBuffer);

            console.log('result:', result);
        });

【问题讨论】:

  • 请添加一些代码,你尝试了什么?
  • 用代码更新帖子

标签: node.js mozilla-deepspeech


【解决方案1】:

您正在尝试将流提供给需要 wav 文件的方法...

请改用modelStream.feedAudioContent();Check the example.

【讨论】:

  • modelStream = englishModel.createStream(); stream.on('data', data => { modelStream.feedAudioContent(data); }).on('end', () => { let text = modelStream.finishStream(); console.log(text, 'works'); }); 更新了我的代码,但深度语音识别真的关闭了
  • 你为什么不和作者讨论一下呢? github.com/coqui-ai/STT/discussions
猜你喜欢
  • 2021-11-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-01-30
  • 1970-01-01
  • 2017-12-31
  • 1970-01-01
相关资源
最近更新 更多