I'm trying to use the speech recognition library to set up a voice assistant, but I keep receiving a permission denied error. I suppose that the error is that the file isn't saved at any location where Python can access it, but I'm not entirely sure how to change the directory where the file is stored using this library.
Code:
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
print("Say something!")
try:
audio = r.listen(source, timeout=5)
except sr.WaitTimeoutError:
print("You didn't say anything")
print("Did you say " + r.recognize_whisper(audio))
Traceback:
Traceback (most recent call last):
File "C:\Users\s\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\whisper\audio.py", line 42, in load_audio
ffmpeg.input(file, threads=0)
File "C:\Users\s\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ffmpeg\_run.py", line 325, in run
raise Error('ffmpeg', out, err)
ffmpeg._run.Error: ffmpeg error (see stderr output for detail)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\Users\s\projects\FinalProject\debugging.py", line 12, in <module>
print("Did you say " + r.recognize_whisper(audio))
libswresample 4. 9.100 / 4. 9.100 libpostproc 56. 7.100 / 56. 7.100
C:\Users\s\AppData\Local\Temp\tmpt5niak28.wav: Permission denied
I've used this library before successfully, so not sure what the issue is. Any suggestions?