PaddlePaddle / PaddleSpeech

Easy-to-use Speech Toolkit including Self-Supervised Learning model, SOTA/Streaming ASR with punctuation, Streaming TTS with text frontend, Speaker Verification System, End-to-End Speech Translation and Keyword Spotting. Won NAACL2022 Best Demo Award.
https://paddlespeech.readthedocs.io
Apache License 2.0
11.12k stars 1.85k forks source link

ASR Websocket方式是否支持mp3音频 #3714

Open GiterRUOK opened 7 months ago

GiterRUOK commented 7 months ago

使用ASR Websocket方式(ws://{server}:{port}/paddlespeech/asr/streaming)传入MP3音频数据返回一两次result:“”后websocket直接断开,{status:1006, reason: ""}。 但是发送{ "name": "test.mp3", "signal": "start", "nbest": 1 } 又是返回 {status: 'ok', signal: 'server_ready' }。 同样方式,换成 .wav,没有问题。 所以是不支持 mp3,还是bug?

相关关键代码如下(uniapp小程序)

this.recorder.start({
    duration: 20000,
    numberOfChannels: 1,
    format: 'mp3',
    frameSize: 5, // 乱取的
    sampleRate: 16000
})
rd.onFrameRecorded(res => {
    console.log('recorder frame', res)
    if (!this.asrUseHttp) {
        const { isLastFrame, frameBuffer } = res
        this.wsSendData(this.asrWs,
            frameBuffer,
            isLastFrame
        )
    }
})
this.wsSendData(this.asrWs, {
    name: '123.mp3',
    signal: 'end',
    nbset: 1
})
this.wsSendData(this.asrWs, {
        task: '123.mp3',
    signal: 'start',
    nbset: 1,
})
Ray961123 commented 7 months ago

开发者你好,感谢关注 PaddleSpeech 开源项目,抱歉给你带来了不好的开发体验,目前开源项目维护人力有限,你可以尝试通过修改 PaddleSpeech 源码的方式自己解决,或请求开源社区其他开发者的协助。飞桨开源社区交流频道:飞桨AI Studio星河社区-人工智能学习与实训社区