alphacep / vosk-api

Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node
Apache License 2.0
7.43k stars 1.04k forks source link

Error: file does not start with RIFF id #1384

Closed Abonia1 closed 1 year ago

Abonia1 commented 1 year ago
audio_file = "/Users/sojasingarayar/Documents/ProjetIA-Client/speech-analysis/audio/audio.pcm"
wf = wave.open(audio_file, 'rb')

Error Traceback (most recent call last)

in 1 audio_file = "/Users/sojasingarayar/Documents/ProjetIA-Client/speech-analysis/audio/audio.pcm" ----> 2 wf = wave.open(audio_file, 'rb') ~/opt/anaconda3/lib/python3.8/wave.py in open(f, mode) 508 mode = 'rb' 509 if mode in ('r', 'rb'): --> 510 return Wave_read(f) 511 elif mode in ('w', 'wb'): 512 return Wave_write(f) ~/opt/anaconda3/lib/python3.8/wave.py in __init__(self, f) 162 # else, assume it is an open file object already 163 try: --> 164 self.initfp(f) 165 except: 166 if self._i_opened_the_file: ~/opt/anaconda3/lib/python3.8/wave.py in initfp(self, file) 129 self._file = Chunk(file, bigendian = 0) 130 if self._file.getname() != b'RIFF': --> 131 raise Error('file does not start with RIFF id') 132 if self._file.read(4) != b'WAVE': 133 raise Error('not a WAVE file') Error: file does not start with RIFF id Thanks in advance!
nshmyrev commented 1 year ago

Use vosk directly without speech-recognition wrapper

Abonia1 commented 1 year ago

Iam not using any wrapper.It was because there was some issue with audio file. it works fine now.

Thanks