alphacep / vosk-server

WebSocket, gRPC and WebRTC speech recognition server based on Vosk and Kaldi libraries
Apache License 2.0
918 stars 248 forks source link

Empty response from russian model #65

Closed DmitryHCL closed 4 years ago

DmitryHCL commented 4 years ago

Hi, I am trying to transcribe couple of phonecalls wav files with russian model. However if I try to pass whole audio to transcribe the response is empty. Now, if I manually split audio on phrases it gives me proper result, but only if there is no pause after the phrase. If there is a pause after phrase, the response would be empty. If there are multiple phrases separated by pause, I would only get transcribe of the last phrase and only if there is no pause after it. What could be the issue here? Here is the code I'm using

async def hello(filename, uri):
    async with websockets.connect(uri) as websocket:
        wf = open(filename, "rb")
        while True:
            data = wf.read(8000)
            if len(data) == 0:
                break
            await websocket.send(data)
            await websocket.recv()
        await websocket.send('{"eof" : 1}')
        data = await websocket.recv()
        return data
nshmyrev commented 4 years ago

You should not ignore return of of await websocket.recv() inside the loop, it contains the results.