0

So when I connect the Bluetooth headset to the Zero 2 W the audio works, but whenever I attempt to select it as an audio input while being an audio output as well, it appears to work but when I run my Python code that uses the microphone it results in the following messages:

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:933:(snd_pcm_plug_hw_refine_cchange) Slave format: IEC958_SUBFRAME_LE
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
ALSA lib pcm_direct.c:1206:(snd1_pcm_direct_initialize_slave) requested or auto-format is not available
ALSA lib pcm_dmix.c:1087:(snd_pcm_dmix_open) unable to initialize slave

Here is my code:

with sr.Microphone() as source:
    r.adjust_for_ambient_noise(source, duration=0.2)
    while 1:
        try:
            audio = r.listen(source, phrase_time_limit=15, timeout=0.9)
        except sr.WaitTimeoutError:
            continue
        try:
            speech = r.recognize_google(audio)
        except:
            continue
        speech = str(speech)
        break
    return speech

Any help or advice would be appreciated!

Note: when I run “arecord -l”, it outputs nothing but “List of CAPTURE Hardware Devices

blevlabs
  • 11
  • 3

1 Answers1

0

I figured my issue was that I had not installed "flac" on my system, and my microphone was a bit too far away from my face. To make it fully work, I had to confirm the headset audio type in the Bluetooth bluez menu to make sure it was capable of audio input and output, and I had to add the import of the "pyttsx3" package.

blevlabs
  • 11
  • 3