Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--show_audio_devices not showing all audio devices #29

Closed
yezzer opened this issue May 3, 2022 · 7 comments
Closed

--show_audio_devices not showing all audio devices #29

yezzer opened this issue May 3, 2022 · 7 comments
Assignees

Comments

@yezzer
Copy link

yezzer commented May 3, 2022

I am unable to get PvRecorder to use a different device index. I believe this is because it cannot access the correct audio device. Might this be a problem with miniaudio not returning all devices?

I can correctly record sample audio using:

arecord -D plughw:3,0 ~/test.wav -d 3

Using PvRecorder to record audio using device 3 fails with error:

File "/home/pi/.virtualenvs/cv/lib/python3.9/site-packages/pvrecorder/pvrecorder.py", line 78, in __init__
    raise self._PVRECORDER_STATUS_TO_EXCEPTION[status]("Failed to initialize pv_recorder.")
ValueError: Failed to initialize pv_recorder.

Output of arecord -l (this is expected behaviour)

**** List of CAPTURE Hardware Devices ****
card 3: seeed2micvoicec [seeed-2mic-voicecard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [bcm2835-i2s-wm8960-hifi wm8960-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Output of --show_audio_devices (I believe i should be able to see the ReSpeaker capture device here)

index: 0, device name: Monitor of Built-in Audio Analog Stereo

Output of miniaudio get_captures()

[{'name': 'Monitor of Built-in Audio Analog Stereo', 'type': <DeviceType.CAPTURE: 2>, 'id': <cdata 'union ma_device_id *' owning 256 bytes>, 'formats': {2: '16-bit Signed Integer'}, 'minChannels': 2, 'maxChannels': 2, 'minSampleRate': 48000, 'maxSampleRate': 48000}]

Output of uname -r:

5.15.32-v7l+

Any ideas as to what I can try?

@ksyeo1010
Copy link
Contributor

This is most likely the same issue as #28. We will be releasing a fix in the coming weeks.

@ksyeo1010 ksyeo1010 self-assigned this May 3, 2022
@yezzer
Copy link
Author

yezzer commented May 4, 2022

As some kind of update, I installed a forked driver of ReSpeaker, as Seeed Studio seem to have abandoned it. This fixed this issue.
respeaker/seeed-voicecard#325

@ksyeo1010
Copy link
Contributor

I was trying to debug this issue. It turns out that the name of the card might be quite different from what you would expect. Can you run: pactl list sources and check the name of the device. See further down the output, and check in properties > alsa.card_name. You might find seeed-2mic-voicecard there. Can you confirm this? thanks.

@yezzerfv
Copy link

@ksyeo1010 not sure how much use it will be now, as in my previous comment I managed to get it working using an unofficial fork. But here's the output:

        State: SUSPENDED
        Name: alsa_output.platform-bcm2835_audio.analog-stereo.monitor
        Description: Monitor of Built-in Audio Analog Stereo
        Driver: module-alsa-card.c
        Sample Specification: s16le 2ch 48000Hz
        Channel Map: front-left,front-right
        Owner Module: 6
        Mute: no
        Volume: front-left: 32768 /  50% / -18.06 dB,   front-right: 32768 /  50% / -18.06 dB
                balance 0.00
        Base Volume: 65536 / 100% / 0.00 dB
        Monitor of Sink: alsa_output.platform-bcm2835_audio.analog-stereo
        Latency: 0 usec, configured 0 usec
        Flags: DECIBEL_VOLUME LATENCY 
        Properties:
                device.description = "Monitor of Built-in Audio Analog Stereo"
                device.class = "monitor"
                alsa.card = "0"
                alsa.card_name = "bcm2835 Headphones"
                alsa.long_card_name = "bcm2835 Headphones"
                alsa.driver_name = "snd_bcm2835"
                device.bus_path = "platform-bcm2835_audio"
                sysfs.path = "/devices/platform/soc/fe00b840.mailbox/bcm2835_audio/sound/card0"
                device.form_factor = "internal"
                device.string = "0"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card"
        Formats:
                pcm

Source #1
        State: SUSPENDED
        Name: alsa_output.platform-soc_sound.stereo-fallback.monitor
        Description: Monitor of Built-in Audio Stereo
        Driver: module-alsa-card.c
        Sample Specification: s16le 2ch 44100Hz
        Channel Map: front-left,front-right
        Owner Module: 9
        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.platform-soc_sound.stereo-fallback
        Latency: 0 usec, configured 0 usec
        Flags: DECIBEL_VOLUME LATENCY 
        Properties:
                device.description = "Monitor of Built-in Audio Stereo"
                device.class = "monitor"
                alsa.card = "3"
                alsa.card_name = "seeed-2mic-voicecard"
                alsa.long_card_name = "seeed-2mic-voicecard"
                alsa.driver_name = "snd_soc_simple_card"
                device.bus_path = "platform-soc:sound"
                sysfs.path = "/devices/platform/soc/soc:sound/sound/card3"
                device.form_factor = "internal"
                device.string = "3"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card"
        Formats:
                pcm

Source #2
        State: SUSPENDED
        Name: alsa_input.platform-soc_sound.stereo-fallback
        Description: Built-in Audio Stereo
        Driver: module-alsa-card.c
        Sample Specification: s16le 2ch 44100Hz
        Channel Map: front-left,front-right
        Owner Module: 9
        Mute: no
        Volume: front-left: 32845 /  50% / -18.00 dB,   front-right: 32845 /  50% / -18.00 dB
                balance 0.00
        Base Volume: 20724 /  32% / -30.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.resolution_bits = "16"
                device.api = "alsa"
                device.class = "sound"
                alsa.class = "generic"
                alsa.subclass = "generic-mix"
                alsa.name = "bcm2835-i2s-wm8960-hifi wm8960-hifi-0"
                alsa.id = "bcm2835-i2s-wm8960-hifi wm8960-hifi-0"
                alsa.subdevice = "0"
                alsa.subdevice_name = "subdevice #0"
                alsa.device = "0"
                alsa.card = "3"
                alsa.card_name = "seeed-2mic-voicecard"
                alsa.long_card_name = "seeed-2mic-voicecard"
                alsa.driver_name = "snd_soc_simple_card"
                device.bus_path = "platform-soc:sound"
                sysfs.path = "/devices/platform/soc/soc:sound/sound/card3"
                device.form_factor = "internal"
                device.string = "hw:3"
                device.buffering.buffer_size = "10576"
                device.buffering.fragment_size = "2644"
                device.access_mode = "mmap"
                device.profile.name = "stereo-fallback"
                device.profile.description = "Stereo"
                device.description = "Built-in Audio Stereo"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card"
        Ports:
                analog-input: Analog Input (type: Analog, priority: 10000, availability unknown)
        Active Port: analog-input
        Formats:
                pcm```

@ksyeo1010
Copy link
Contributor

ksyeo1010 commented May 11, 2022

so running the official driver, using --show_output_devices does not show Source 2 from above correct?

@ksyeo1010
Copy link
Contributor

We have released a new version: #31. Can you try it out with latest changes?

@kenarsa
Copy link
Member

kenarsa commented May 26, 2022

closing due to inactivity. please re-open if needed.

@kenarsa kenarsa closed this as completed May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants