Reputation: 1161
I am trying to use alsaaudio in my python code.
inp = alsaaudio.PCM(alsaaudio.PCM_CAPTURE, alsaaudio.PCM_NONBLOCK, card)
For the third parameter card
, what should I put?
root@abc:~/Desktop# arecord --list-devices
**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC269VB Analog [ALC269VB Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 1: H340 [Logitech USB Headset H340], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
I want to input audio from the Logitech USB Headset.
Should it be hw:1,0
????
Thanks
Upvotes: 1
Views: 733
Reputation: 180020
The documentation says:
class alsaaudio.PCM(type=PCM_PLAYBACK, mode=PCM_NORMAL, device='default', cardindex=-1)
This class is used to represent a PCM device (either for playback and recording). The arguments are:
[…]
- device - the name of the PCM device that should be used (for example a value from the output of
pcms()
). The default value is'default'
.[…]
Changed in 0.8:
- The
card
keyword argument is still supported, but deprecated. Please usedevice
instead.- The keyword argument
cardindex
was added.The
card
keyword is deprecated because it guesses the real ALSA name of the card. This was always fragile and broke some legitimate usecases.
Upvotes: 2