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

python3 -m sounddevice not listing pcms #446

Open
StuartIanNaylor opened this issue Dec 16, 2022 · 2 comments
Open

python3 -m sounddevice not listing pcms #446

StuartIanNaylor opened this issue Dec 16, 2022 · 2 comments

Comments

@StuartIanNaylor
Copy link

StuartIanNaylor commented Dec 16, 2022

Is there a method to list asound.conf pcms?

pcm.donglein {
    type=plug
    slave = {
    pcm "plughw:3,0"
    channels 1
    rate 4800}
}

It will list everything else but the pcm I want to use (rate change)

(venv) stuart@ubuntu:~/g-kws$ python3 -m sounddevice --help
   0 Loopback: PCM (hw:0,0), ALSA (32 in, 32 out)
   1 Loopback: PCM (hw:0,1), ALSA (32 in, 32 out)
   2 HDA Intel PCH: ALC221 Analog (hw:1,0), ALSA (2 in, 2 out)
   3 HDA Intel PCH: ALC221 Alt Analog (hw:1,2), ALSA (2 in, 0 out)
   4 HDA NVidia: HDMI 0 (hw:2,3), ALSA (0 in, 8 out)
   5 HDA NVidia: HDMI 1 (hw:2,7), ALSA (0 in, 2 out)
   6 HDA NVidia: HDMI 2 (hw:2,8), ALSA (0 in, 8 out)
   7 HDA NVidia: HDMI 3 (hw:2,9), ALSA (0 in, 8 out)
   8 HDA NVidia: HDMI 4 (hw:2,10), ALSA (0 in, 8 out)
   9 HDA NVidia: HDMI 5 (hw:2,11), ALSA (0 in, 8 out)
  10 HDA NVidia: HDMI 6 (hw:2,12), ALSA (0 in, 8 out)
  11 VIA USB Dongle: Audio (hw:3,0), ALSA (2 in, 2 out)
  12 USB Audio Device: - (hw:4,0), ALSA (1 in, 2 out)
  13 sysdefault, ALSA (128 in, 128 out)
  14 front, ALSA (0 in, 32 out)
  15 surround21, ALSA (32 in, 32 out)
  16 surround40, ALSA (0 in, 32 out)
  17 surround41, ALSA (0 in, 32 out)
  18 surround50, ALSA (0 in, 32 out)
  19 surround51, ALSA (0 in, 32 out)
  20 surround71, ALSA (0 in, 32 out)
  21 lavrate, ALSA (128 in, 128 out)
  22 samplerate, ALSA (128 in, 128 out)
  23 speexrate, ALSA (128 in, 128 out)
  24 pulse, ALSA (32 in, 32 out)
  25 speex, ALSA (1 in, 1 out)
  26 upmix, ALSA (8 in, 8 out)
  27 vdownmix, ALSA (6 in, 6 out)
  28 pipewire, ALSA (64 in, 64 out)
  29 dmix, ALSA (0 in, 2 out)
* 30 default, ALSA (32 in, 32 out)

Maybe it has something to do with Pulseaudio or there is a limit on devices returned?

Just tried a lite version on a pi3 that doesn't have pulseaudio running

* 0 VIA USB Dongle: Audio (hw:1,0), ALSA (2 in, 2 out)
  1 ladspa, ALSA (128 in, 128 out)
  2 deepfilter, ALSA (128 in, 128 out)
  3 donglein, ALSA (128 in, 128 out)

All those are alsa pcms that just don't show on my x86 machine with pulseaudio / desktop install, but list fine on the pi

@mgeier
Copy link
Member

mgeier commented Dec 17, 2022

Maybe it has something to do with Pulseaudio or there is a limit on devices returned?

Maybe. I don't know.

The list of devices comes directly from the underlying PortAudio library, which currently doesn't have a proper PulseAudio backend yet (PortAudio/portaudio#336), so I guess it uses the ALSA emulation of PulseAudio.

You could ask at the PortAudio project (http://portaudio.com/contacts.html) or at the PulseAudio project?

As an alternative, you could try using JACK or PipeWire, maybe those support your device from asound.conf?

@StuartIanNaylor
Copy link
Author

I think there must be a limit maybe its the standard 32 of the kernel and some how we lose one and it ends as 30 :)

I thought it was just hardware but maybe its pcms also and they are lost at the end of the list.

If the alsa pulseaudio emulation it makes quite a hash of things as these are not pcm's they are plugins that could be used in pcm's and have often wondered why they are listed.

14 front, ALSA (0 in, 32 out)
  15 surround21, ALSA (32 in, 32 out)
  16 surround40, ALSA (0 in, 32 out)
  17 surround41, ALSA (0 in, 32 out)
  18 surround50, ALSA (0 in, 32 out)
  19 surround51, ALSA (0 in, 32 out)
  20 surround71, ALSA (0 in, 32 out)
  21 lavrate, ALSA (128 in, 128 out)
  22 samplerate, ALSA (128 in, 128 out)
  23 speexrate, ALSA (128 in, 128 out)
  24 pulse, ALSA (32 in, 32 out)
  25 speex, ALSA (1 in, 1 out)
  26 upmix, ALSA (8 in, 8 out)
  27 vdownmix, ALSA (6 in, 6 out)
  28 pipewire, ALSA (64 in, 64 out)
  29 dmix, ALSA (0 in, 2 out)

The above is a whole lot of pointless as they can not be used alone as they need to be part of a PCM.

So prob you are right and there is a limit to the alsa pulseaudio device return which is strangely 32 -1 and the alsa pulseaudio returns pulse devices 1st but if you look it states everyone of those devices are alsa not pulseaudio?
Also when just running alsa they do list but the max list doesn't hold true as remove a usb card and now it lists only 29 so not a max :)

I think I will just have to find an alternative to sounddevice/portaudio

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

2 participants