unixcorn
unixcorn

Reputation: 440

ALSA lib pcm_hw.c:1829:(_snd_pcm_hw_open) Invalid value for card

I'm currently trying to use the ALSA lib to emit sounds. However, I'm getting this following error:

Setting random seed to 345.
Adding stimulus TestBeep...
ALSA lib pcm_hw.c:1829:(_snd_pcm_hw_open) Invalid value for card
Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "../soundstimulus.py", line 36, in run_playback_process
    raise e
  File "../soundstimulus.py", line 32, in run_playback_process
    playback_system = ALSAPlaybackSystem(device_name, config, file_dir, control_pipe, log_directory)
  File "../alsainterface.py", line 214, in __init__
    self.adevice = alsaaudio.PCM(device=device)
alsaaudio.ALSAAudioError: No such device [hw:CARD=SoundCard,DEV=0]

I think I do have a sound card as seen in the following:

$ cat /proc/asound/card0/pcm0p/info
card: 0
device: 0
subdevice: 0
stream: PLAYBACK
id: ALC269VC Analog
name: ALC269VC Analog
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 1

So what does it mean that there is an invalid value for the card? Is there a way I can edit it so that the value is valid?

I'm not sure if the following is relevant, but a lot of the stackOverflow posts suggested OPs run aplay -l. My result is

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC269VC Analog [ALC269VC Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Upvotes: 2

Views: 2505

Answers (0)

Related Questions