Sample rate error in pyaudio

Hi! It seems that my Mycroft installation (on Fedora 38) does not get the mic input because

2023-08-06 22:50:14.305 | INFO     | 47497 | __main__:on_ready:179 | Speech client is ready.
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2050
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2721
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2845
Exception in thread Thread-8:
Traceback (most recent call last):
  File "/usr/lib64/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/home/adrian/mycroft-core/mycroft/client/speech/listener.py", line 79, in run
    with self.mic as source:
  File "/home/adrian/mycroft-core/mycroft/client/speech/mic.py", line 140, in __enter__
    return self._start()
           ^^^^^^^^^^^^^
  File "/home/adrian/mycroft-core/mycroft/client/speech/mic.py", line 147, in _start
    self.stream = MutableStream(self.audio.open(
                                ^^^^^^^^^^^^^^^^
  File "/home/adrian/mycroft-core/.venv/lib64/python3.11/site-packages/pyaudio.py", line 750, in open
    stream = Stream(self, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/adrian/mycroft-core/.venv/lib64/python3.11/site-packages/pyaudio.py", line 441, in __init__
    self._stream = pa.open(**arguments)
                   ^^^^^^^^^^^^^^^^^^^^
OSError: [Errno -9997] Invalid sample rate

Does anyone have any idea what could be wrong?
On Fedora38 Pulse is pipewire implemented…
Thanks a lot!!

for reference the details of my sources:

pactl list sources
Source #46
        State: SUSPENDED
        Name: alsa_output.pci-0000_08_00.4.analog-stereo.monitor
        Description: Monitor of Starship/Matisse HD Audio Controller Analog Stereo
        Driver: PipeWire
        Sample Specification: s32le 2ch 48000Hz
        Channel Map: front-left,front-right
        Owner Module: 4294967295
        Mute: no
        Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
                balance 0.00
        Base Volume: 65536 / 100% / 0.00 dB
        Monitor of Sink: alsa_output.pci-0000_08_00.4.analog-stereo
        Latency: 0 usec, configured 0 usec
        Flags: HARDWARE DECIBEL_VOLUME LATENCY 
        Properties:
                alsa.card = "1"
                alsa.card_name = "HD-Audio Generic"
                alsa.class = "generic"
                alsa.device = "0"
                alsa.driver_name = "snd_hda_intel"
                alsa.id = "ALC887-VD Analog"
                alsa.long_card_name = "HD-Audio Generic at 0xfcb00000 irq 72"
                alsa.name = "ALC887-VD Analog"
                alsa.resolution_bits = "16"
                alsa.subclass = "generic-mix"
                alsa.subdevice = "0"
                alsa.subdevice_name = "subdevice #0"
                api.alsa.card.longname = "HD-Audio Generic at 0xfcb00000 irq 72"
                api.alsa.card.name = "HD-Audio Generic"
                api.alsa.path = "front:1"
                api.alsa.pcm.card = "1"
                api.alsa.pcm.stream = "playback"
                audio.channels = "2"
                audio.position = "FL,FR"
                card.profile.device = "5"
                device.api = "alsa"
                device.class = "monitor"
                device.id = "43"
                device.profile.description = "Analog Stereo"
                device.profile.name = "analog-stereo"
                device.routes = "2"
                factory.name = "api.alsa.pcm.sink"
                media.class = "Audio/Sink"
                device.description = "Starship/Matisse HD Audio Controller"
                node.name = "alsa_output.pci-0000_08_00.4.analog-stereo"
                node.nick = "ALC887-VD Analog"
                node.pause-on-idle = "false"
                object.path = "alsa:pcm:1:front:1:playback"
                priority.driver = "1009"
                priority.session = "1009"
                factory.id = "18"
                clock.quantum-limit = "8192"
                client.id = "33"
                node.driver = "true"
                factory.mode = "merge"
                audio.adapt.follower = ""
                library.name = "audioconvert/libspa-audioconvert"
                object.id = "46"
                object.serial = "46"
                node.max-latency = "16384/48000"
                api.alsa.period-size = "1024"
                api.alsa.period-num = "32"
                api.alsa.headroom = "0"
                api.acp.auto-port = "false"
                api.acp.auto-profile = "false"
                api.alsa.card = "1"
                api.alsa.use-acp = "true"
                api.dbus.ReserveDevice1 = "Audio1"
                device.bus = "pci"
                device.bus_path = "pci-0000:08:00.4"
                device.enum.api = "udev"
                device.icon_name = "audio-card-analog-pci"
                device.name = "alsa_card.pci-0000_08_00.4"
                device.nick = "HD-Audio Generic"
                device.plugged.usec = "5742851"
                device.product.id = "0x1487"
                device.product.name = "Starship/Matisse HD Audio Controller"
                device.subsystem = "sound"
                sysfs.path = "/devices/pci0000:00/0000:00:08.1/0000:08:00.4/sound/card1"
                device.vendor.id = "0x1022"
                device.vendor.name = "Advanced Micro Devices, Inc. [AMD]"
                device.string = "1"
        Formats:
                pcm

Source #47
        State: SUSPENDED
        Name: alsa_input.pci-0000_08_00.4.analog-stereo
        Description: Starship/Matisse HD Audio Controller Analog Stereo
        Driver: PipeWire
        Sample Specification: s32le 2ch 48000Hz
        Channel Map: front-left,front-right
        Owner Module: 4294967295
        Mute: no
        Volume: front-left: 44564 /  68% / -10.05 dB,   front-right: 44564 /  68% / -10.05 dB
                balance 0.00
        Base Volume: 6554 /  10% / -60.00 dB
        Monitor of Sink: n/a
        Latency: 0 usec, configured 0 usec
        Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY 
        Properties:
                alsa.card = "1"
                alsa.card_name = "HD-Audio Generic"
                alsa.class = "generic"
                alsa.device = "0"
                alsa.driver_name = "snd_hda_intel"
                alsa.id = "ALC887-VD Analog"
                alsa.long_card_name = "HD-Audio Generic at 0xfcb00000 irq 72"
                alsa.name = "ALC887-VD Analog"
                alsa.resolution_bits = "16"
                alsa.subclass = "generic-mix"
                alsa.subdevice = "0"
                alsa.subdevice_name = "subdevice #0"
                api.alsa.card.longname = "HD-Audio Generic at 0xfcb00000 irq 72"
                api.alsa.card.name = "HD-Audio Generic"
                api.alsa.path = "front:1"
                api.alsa.pcm.card = "1"
                api.alsa.pcm.stream = "capture"
                audio.channels = "2"
                audio.position = "FL,FR"
                card.profile.device = "0"
                device.api = "alsa"
                device.class = "sound"
                device.id = "43"
                device.profile.description = "Analog Stereo"
                device.profile.name = "analog-stereo"
                device.routes = "3"
                factory.name = "api.alsa.pcm.source"
                media.class = "Audio/Source"
                device.description = "Starship/Matisse HD Audio Controller"
                node.name = "alsa_input.pci-0000_08_00.4.analog-stereo"
                node.nick = "ALC887-VD Analog"
                node.pause-on-idle = "false"
                object.path = "alsa:pcm:1:front:1:capture"
                priority.driver = "2009"
                priority.session = "2009"
                factory.id = "18"
                clock.quantum-limit = "8192"
                client.id = "33"
                node.driver = "true"
                factory.mode = "split"
                audio.adapt.follower = ""
                library.name = "audioconvert/libspa-audioconvert"
                object.id = "47"
                object.serial = "47"
                node.max-latency = "16384/48000"
                api.alsa.period-size = "1024"
                api.alsa.period-num = "32"
                api.alsa.headroom = "32"
                api.acp.auto-port = "false"
                api.acp.auto-profile = "false"
                api.alsa.card = "1"
                api.alsa.use-acp = "true"
                api.dbus.ReserveDevice1 = "Audio1"
                device.bus = "pci"
                device.bus_path = "pci-0000:08:00.4"
                device.enum.api = "udev"
                device.icon_name = "audio-card-analog-pci"
                device.name = "alsa_card.pci-0000_08_00.4"
                device.nick = "HD-Audio Generic"
                device.plugged.usec = "5742851"
                device.product.id = "0x1487"
                device.product.name = "Starship/Matisse HD Audio Controller"
                device.subsystem = "sound"
                sysfs.path = "/devices/pci0000:00/0000:00:08.1/0000:08:00.4/sound/card1"
                device.vendor.id = "0x1022"
                device.vendor.name = "Advanced Micro Devices, Inc. [AMD]"
                device.string = "1"
        Ports:
                analog-input-front-mic: Front Microphone (type: Mic, priority: 8500, availability group: Legacy 1, not available)
                analog-input-rear-mic: Rear Microphone (type: Mic, priority: 8200, availability group: Legacy 2, available)
                analog-input-linein: Line In (type: Line, priority: 8100, availability group: Legacy 3, not available)
        Active Port: analog-input-rear-mic
        Formats:
                pcm

Source #334
        State: SUSPENDED
        Name: echo-cancel-source
        Description: Echo-Cancel Source
        Driver: PipeWire
        Sample Specification: float32le 2ch 48000Hz
        Channel Map: front-left,front-right
        Owner Module: 4294967295
        Mute: no
        Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
                balance 0.00
        Base Volume: 65536 / 100% / 0.00 dB
        Monitor of Sink: n/a
        Latency: 0 usec, configured 0 usec
        Flags: DECIBEL_VOLUME LATENCY 
        Properties:
                node.name = "echo-cancel-source"
                device.description = "Echo-Cancel Source"
                media.class = "Audio/Source"
                node.group = "echo-cancel-12286-12"
                node.link-group = "echo-cancel-12286-12"
                node.virtual = "true"
                audio.channels = "2"
                audio.position = "[ FL, FR ]"
                resample.prefill = "true"
                node.latency = "480/48000"
                media.name = "Echo-Cancel Source"
                stream.is-live = "true"
                node.want-driver = "true"
                adapt.follower.spa-node = ""
                object.register = "false"
                factory.id = "6"
                clock.quantum-limit = "8192"
                factory.mode = "split"
                audio.adapt.follower = ""
                library.name = "audioconvert/libspa-audioconvert"
                client.id = "78"
                object.id = "63"
                object.serial = "334"
        Formats:
                pcm

Source #335
        State: SUSPENDED
        Name: echo-cancel-sink.monitor
        Description: Monitor of Echo-Cancel Sink
        Driver: PipeWire
        Sample Specification: float32le 2ch 48000Hz
        Channel Map: front-left,front-right
        Owner Module: 4294967295
        Mute: no
        Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
                balance 0.00
        Base Volume: 65536 / 100% / 0.00 dB
        Monitor of Sink: echo-cancel-sink
        Latency: 0 usec, configured 0 usec
        Flags: DECIBEL_VOLUME LATENCY 
        Properties:
                node.name = "echo-cancel-sink"
                device.description = "Echo-Cancel Sink"
                media.class = "Audio/Sink"
                node.group = "echo-cancel-12286-12"
                node.link-group = "echo-cancel-12286-12"
                node.virtual = "true"
                audio.channels = "2"
                audio.position = "[ FL, FR ]"
                resample.prefill = "true"
                node.latency = "480/48000"
                media.name = "Echo-Cancel Sink"
                stream.is-live = "true"
                node.want-driver = "true"
                adapt.follower.spa-node = ""
                object.register = "false"
                factory.id = "6"
                clock.quantum-limit = "8192"
                factory.mode = "merge"
                audio.adapt.follower = ""
                library.name = "audioconvert/libspa-audioconvert"
                client.id = "78"
                object.id = "71"
                object.serial = "335"
                device.class = "monitor"
        Formats:
                pcm

No, unfortunately, but the Mycroft software is unmaintained and crumbling now: FAQ: OVOS, Neon, and the Future of the Mycroft Voice Assistant

I’d recommend OVOS to install something Mycroft-like on Fedora. Unfortunately there are not currently any reference implementations on Fedora, but ovos-docker should work regardless of distro.

Thanks a lot for info!!!

1 Like