Not able to use .Microphone() from speech_recognition on Raspberry Pi 4

The Raspberry Pi is a series of credit card-sized single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and developing countries.

Post Reply
User avatar
/RaspberryPi
Corporate
Posts: 2449
Joined: Wed Jun 05, 2019 1:29 am

Not able to use .Microphone() from speech_recognition on Raspberry Pi 4

Post by /RaspberryPi »


I tried to install speech_recognition on my Raspberry pi 4. After only a few lines of code I've got a bunch of errors pop up. Everything should be installed properly. I even cleared my raspberry pi and reinstalled everything to make sure everything is properly downloaded. Sadly the error stayed the same.

This is my code: (I'm using python 3.11.2)

import speech_recognition as sr



with sr.Microphone() as source:

print("test")



Those are the errors (& output) (it's mostly the same over and over again):

ALSA lib pcm_plug.c:933:(snd_pcm_plug_hw_refine_cchange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:835:(snd_pcm_plug_hw_refine_schange) Unable to find an usable slave format for 'plug:hw'

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S16_LE

ALSA lib pcm_plug.c:844:(snd_pcm_plug_hw_refine_schange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:924:(snd_pcm_plug_hw_refine_cchange) Unable to find an usable client format

ALSA lib pcm_plug.c:928:(snd_pcm_plug_hw_refine_cchange) Format: S16_LE

ALSA lib pcm_plug.c:933:(snd_pcm_plug_hw_refine_cchange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:835:(snd_pcm_plug_hw_refine_schange) Unable to find an usable slave format for 'plug:hw'

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S16_LE

ALSA lib pcm_plug.c:844:(snd_pcm_plug_hw_refine_schange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:924:(snd_pcm_plug_hw_refine_cchange) Unable to find an usable client format

ALSA lib pcm_plug.c:928:(snd_pcm_plug_hw_refine_cchange) Format: S16_LE

ALSA lib pcm_plug.c:933:(snd_pcm_plug_hw_refine_cchange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:835:(snd_pcm_plug_hw_refine_schange) Unable to find an usable slave format for 'plug:hw'

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S16_LE

ALSA lib pcm_plug.c:844:(snd_pcm_plug_hw_refine_schange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:924:(snd_pcm_plug_hw_refine_cchange) Unable to find an usable client format

ALSA lib pcm_plug.c:928:(snd_pcm_plug_hw_refine_cchange) Format: S16_LE

ALSA lib pcm_plug.c:933:(snd_pcm_plug_hw_refine_cchange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:835:(snd_pcm_plug_hw_refine_schange) Unable to find an usable slave format for 'plug:hw'

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S16_LE

ALSA lib pcm_plug.c:844:(snd_pcm_plug_hw_refine_schange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:924:(snd_pcm_plug_hw_refine_cchange) Unable to find an usable client format

ALSA lib pcm_plug.c:928:(snd_pcm_plug_hw_refine_cchange) Format: S16_LE

ALSA lib pcm_plug.c:933:(snd_pcm_plug_hw_refine_cchange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:835:(snd_pcm_plug_hw_refine_schange) Unable to find an usable slave format for 'plug:hw'

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S16_LE

ALSA lib pcm_plug.c:844:(snd_pcm_plug_hw_refine_schange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:924:(snd_pcm_plug_hw_refine_cchange) Unable to find an usable client format

ALSA lib pcm_plug.c:928:(snd_pcm_plug_hw_refine_cchange) Format: S16_LE

ALSA lib pcm_plug.c:933:(snd_pcm_plug_hw_refine_cchange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:835:(snd_pcm_plug_hw_refine_schange) Unable to find an usable slave format for 'plug:hw'

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S16_LE

ALSA lib pcm_plug.c:844:(snd_pcm_plug_hw_refine_schange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:924:(snd_pcm_plug_hw_refine_cchange) Unable to find an usable client format

ALSA lib pcm_plug.c:928:(snd_pcm_plug_hw_refine_cchange) Format: S16_LE

ALSA lib pcm_plug.c:933:(snd_pcm_plug_hw_refine_cchange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:835:(snd_pcm_plug_hw_refine_schange) Unable to find an usable slave format for 'plug:hw'

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S16_LE

ALSA lib pcm_plug.c:844:(snd_pcm_plug_hw_refine_schange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:924:(snd_pcm_plug_hw_refine_cchange) Unable to find an usable client format

ALSA lib pcm_plug.c:928:(snd_pcm_plug_hw_refine_cchange) Format: S16_LE

ALSA lib pcm_plug.c:933:(snd_pcm_plug_hw_refine_cchange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:835:(snd_pcm_plug_hw_refine_schange) Unable to find an usable slave format for 'plug:hw'

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S16_LE

ALSA lib pcm_plug.c:844:(snd_pcm_plug_hw_refine_schange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:924:(snd_pcm_plug_hw_refine_cchange) Unable to find an usable client format

ALSA lib pcm_plug.c:928:(snd_pcm_plug_hw_refine_cchange) Format: S16_LE

ALSA lib pcm_plug.c:933:(snd_pcm_plug_hw_refine_cchange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:835:(snd_pcm_plug_hw_refine_schange) Unable to find an usable slave format for 'plug:hw'

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S16_LE

ALSA lib pcm_plug.c:844:(snd_pcm_plug_hw_refine_schange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:924:(snd_pcm_plug_hw_refine_cchange) Unable to find an usable client format

ALSA lib pcm_plug.c:928:(snd_pcm_plug_hw_refine_cchange) Format: S16_LE

ALSA lib pcm_plug.c:933:(snd_pcm_plug_hw_refine_cchange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:835:(snd_pcm_plug_hw_refine_schange) Unable to find an usable slave format for 'plug:hw'

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S16_LE

ALSA lib pcm_plug.c:844:(snd_pcm_plug_hw_refine_schange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:924:(snd_pcm_plug_hw_refine_cchange) Unable to find an usable client format

ALSA lib pcm_plug.c:928:(snd_pcm_plug_hw_refine_cchange) Format: S16_LE

ALSA lib pcm_plug.c:933:(snd_pcm_plug_hw_refine_cchange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:835:(snd_pcm_plug_hw_refine_schange) Unable to find an usable slave format for 'plug:hw'

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S16_LE

ALSA lib pcm_plug.c:844:(snd_pcm_plug_hw_refine_schange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:924:(snd_pcm_plug_hw_refine_cchange) Unable to find an usable client format

ALSA lib pcm_plug.c:928:(snd_pcm_plug_hw_refine_cchange) Format: S16_LE

ALSA lib pcm_plug.c:933:(snd_pcm_plug_hw_refine_cchange) Slave format: IEC958_SUBFRAME_LE

ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card

ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'

ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card

ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'

ALSA lib pcm_direct.c:1258:(snd1_pcm_direct_initialize_slave) requested or auto-format is not available

ALSA lib pcm_dmix.c:1011:(snd_pcm_dmix_open) unable to initialize slave

Cannot connect to server socket err = No such file or directory

Cannot connect to server request channel

jack server is not running or cannot be started

JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock

JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock

ALSA lib pcm_asym.c:105:(_snd_pcm_asym_open) capture slave is not defined

ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.front.0:CARD=0'

ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM front

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side

ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround51.0:CARD=0'

ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround21

ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround51.0:CARD=0'

ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround21

ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround40.0:CARD=0'

ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround40

ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround51.0:CARD=0'

ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround41

ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround51.0:CARD=0'

ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround50

ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround51.0:CARD=0'

ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround51

ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround71.0:CARD=0'

ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround71

ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'

ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM iec958

ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'

ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM spdif

ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'

ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM spdif

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline

ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline

ALSA lib pcm_plug.c:835:(snd_pcm_plug_hw_refine_schange) Unable to find an usable slave format for 'plug:hw'

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S8

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: U8

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S16_LE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S16_BE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: U16_LE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: U16_BE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S24_LE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S24_BE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: U24_LE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: U24_BE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S32_LE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S32_BE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: U32_LE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: U32_BE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S20_LE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S20_BE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: U20_LE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: U20_BE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S24_3LE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S24_3BE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: U24_3LE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: U24_3BE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S20_3LE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S20_3BE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: U20_3LE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: U20_3BE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S18_3LE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: S18_3BE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: U18_3LE

ALSA lib pcm_plug.c:839:(snd_pcm_plug_hw_refine_schange) Format: U18_3BE

ALSA lib pcm_plug.c:844:(snd_pcm_plug_hw_refine_schange) Slave format: IEC958_SUBFRAME_LE

ALSA lib pcm_plug.c:924:(snd_pcm_plug_hw_refine_cchange) Unable to find an usable client format

ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card

ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'

ALSA lib confmisc.c:160:(snd_config_get_card) Invalid field card

ALSA lib pcm_usb_stream.c:482:(_snd_pcm_usb_stream_open) Invalid card 'card'

ALSA lib pcm_direct.c:1258:(snd1_pcm_direct_initialize_slave) requested or auto-format is not available

ALSA lib pcm_dmix.c:1011:(snd_pcm_dmix_open) unable to initialize slave

Cannot connect to server socket err = No such file or directory

Cannot connect to server request channel

jack server is not running or cannot be started

JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock

JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock

test

Does anybody know how to fix this problem?

Thx a lot

Sidney




submitted by /u/SidneySpring
[link] [comments]

Source: https://www.reddit.com/r/raspberry_pi/c ... om_speech/
/RaspberryPi
Post Reply

Return to “Raspberry Pi Forum”