У меня есть аудио файл типа wav, который мне необходимо перевести в текст с помощью SpeechRecognition.
import speech_recognition as sr
r = sr.Recognizer()
sample_audio = sr.AudioFile('voice.wav')
print(type(sample_audio))
with sample_audio as audio_file:
audio_content = r.record(audio_file)
print(type(audio_content))
q = r.recognize_google(audio_content)
print(f"You've said: {q}")
Однако выходит ошибка:
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