Im a newbie in python and im trying to do an app convert wav file but i dont know why my code cant run and it report this My code:
import speech_recognition as sr
r = sr.Recognizer()
with sr.AudioFile('idk.wav') as source:
audio = r.record(source)
try:
s = r.recognize_google(audio)
print(s)
except:
print("try again")
Report
Traceback (most recent call last):
File "D:\Trans wav to text\venv\lib\site-packages\speech_recognition\__init__.py", line 203, in __enter__
self.audio_reader = wave.open(self.filename_or_fileobject, "rb")
File "D:\Python\lib\wave.py", line 510, in open
return Wave_read(f)
File "D:\Python\lib\wave.py", line 164, in __init__
self.initfp(f)
File "D:\Python\lib\wave.py", line 131, in initfp
raise Error('file does not start with RIFF id')
wave.Error: file does not start with RIFF id
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Trans wav to text\venv\lib\site-packages\speech_recognition\__init__.py", line 208, in __enter__
self.audio_reader = aifc.open(self.filename_or_fileobject, "rb")
File "D:\Python\lib\aifc.py", line 917, in open
return Aifc_read(f)
File "D:\Python\lib\aifc.py", line 352, in __init__
self.initfp(file_object)
File "D:\Python\lib\aifc.py", line 316, in initfp
raise Error('file does not start with FORM id')
aifc.Error: file does not start with FORM id
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Trans wav to text\venv\lib\site-packages\speech_recognition\__init__.py", line 234, in __enter__
self.audio_reader = aifc.open(aiff_file, "rb")
File "D:\Python\lib\aifc.py", line 917, in open
return Aifc_read(f)
File "D:\Python\lib\aifc.py", line 358, in __init__
self.initfp(f)
File "D:\Python\lib\aifc.py", line 314, in initfp
chunk = Chunk(file)
File "D:\Python\lib\chunk.py", line 63, in __init__
raise EOFError
EOFError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/Trans wav to text/main.py", line 4, in <module>
with sr.AudioFile('idk.wav') as source:
File "D:\Trans wav to text\venv\lib\site-packages\speech_recognition\__init__.py", line 236, in __enter__
raise ValueError("Audio file could not be read as PCM WAV, AIFF/AIFF-C, or Native FLAC; check if file is corrupted or in another format")
ValueError: Audio file could not be read as PCM WAV, AIFF/AIFF-C, or Native FLAC; check if file is corrupted or in another format
Can someone help me please, i searched this on google but it's not work :( ignore this :ygwydgwdfgwtfgdyuwhdiugwtfduiwjdiugwyudhwhdfywfyuwwwwwwyuagdujwabdyufsayudbajwndyfavyufbwaudbwygdfyabwfuwagfyvawdfaw