-1

On my Raspberry Pi I added an audio device to ALSA by adding the following to ~/.asoundrc:

pcm_slave.usb16 {
    pcm "hw:1,0"
    format S16_LE
    channels 1
}

pcm.rate_convert {
    type plug
    slave usb16
}

When calling arecord -L the device rate_convert is listed but when listing all devices in PyAudio this device is not listed. Why is this? And how can I use this device in python?

embie27
  • 96
  • 5

1 Answers1

0

Try below code to find device and their index

import pyaudio

po = pyaudio.PyAudio()
for index in range(po.get_device_count()): 
    desc = po.get_device_info_by_index(index)
    print ("DEVICE: {0} \t INDEX: {1} \t RATE: {2}".format(desc["name"],index,int(desc["defaultSampleRate"])))
g10dras
  • 399
  • 2
  • 11