Python Forum
Am trying to use speech_recognition module but getting error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Am trying to use speech_recognition module but getting error
#1
Hi Guys,
Am using Ubuntu 20.04 OS, Phython 3.8
While am running below basic program am getting error. Could you please some one guide me to fix this issue.
Error:
/home/nagaphani/PycharmProjects/Voice_Project/venv/Voice_Project/bin/python /home/nagaphani/PycharmProjects/Voice_Project/MainVoice.py ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:869:(find_matching_chmap) Found no matching channel map ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card Say somthing Traceback (most recent call last): File "/home/nagaphani/PycharmProjects/Voice_Project/MainVoice.py", line 11, in <module> audio= r.listen(source) File "/home/nagaphani/PycharmProjects/Voice_Project/venv/Voice_Project/lib/python3.8/site-packages/speech_recognition/__init__.py", line 620, in listen buffer = source.stream.read(source.CHUNK) File "/home/nagaphani/PycharmProjects/Voice_Project/venv/Voice_Project/lib/python3.8/site-packages/speech_recognition/__init__.py", line 161, in read return self.pyaudio_stream.read(size, exception_on_overflow=False) File "/home/nagaphani/PycharmProjects/Voice_Project/venv/Voice_Project/lib/python3.8/site-packages/pyaudio.py", line 608, in read return pa.read_stream(self._stream, num_frames, exception_on_overflow) KeyboardInterrupt Process finished with exit code 130 (interrupted by signal 2: SIGINT)
import speech_recognition as sr
r = sr.Recognizer()
mic = sr.Microphone()
with mic as source:
    r.adjust_for_ambient_noise(source)
    print('Say somthing')
    audio= r.listen(source)

voice_data = r.recognize_google(audio)
print(voice_data)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  vlc module error pythonprogrammer 1 2,820 Apr-23-2020, 04:16 AM
Last Post: Larz60+
  pyhton error there is no PIL module error help! pokeboss235 1 2,874 Feb-22-2018, 03:03 AM
Last Post: Larz60+
  Strings with speech_recognition hello_its_me 7 3,518 Nov-26-2017, 11:00 AM
Last Post: heiner55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020