Figured out a solution but not sure why it works... Instead of specifying the audio collection device I let pyaudio choose dynamically by removing input_device_index=mic_card when opening my stream. Not sure why this worked, as I only have one audio collection device (when i use >> arecord -l), i fear i may run into issues with this down the line as I add other modules, it would be good to know what the problem is when I specify a device! Again, the same script worked at 44.1 kHZ but threw the invalid sampling rate at 16 kHZ until i removed the device specification.
this is the python script i used to identify which device numbers pyaudio was assigning
this is the python script i used to identify which device numbers pyaudio was assigning
Code:
import pyaudiop = pyaudio.PyAudio()for i in range(p.get_device_count()): info = p.get_device_info_by_index(i) print(info['index'], info['name'], info['maxInputChannels'])p.terminate()Statistics: Posted by SmagicSman — Thu Mar 07, 2024 7:37 pm