Quantcast
Viewing all articles
Browse latest Browse all 4676

Beginners • pyaudio doesnt like 16000 sampling rate

terminal command works so its not a limitation of my mic
>> arecord -D plughw:2,0 -r 16000 -f S16_LE -c1 test.wav

Pyaudio python script works when i use a sample rate=44100 but throws this error when I am trying to sample at 16 kHZ rate
>> OSError: [Errno -9997] Invalid sample rate

here are the other inputs in my python script...

Code:

    format = pyaudio.paInt16     channels = 1    rate = 16000    frames_per_buffer = 2048    mic_card = 1 # USB mic hw:2,0, but pyaudio device 1    p = pyaudio.PyAudio()    stream = p.open(format=format,                    channels=channels,                    rate=rate,                    input=True,                    frames_per_buffer=frames_per_buffer,                    input_device_index=mic_card)  
any ideas? i could downsample from 44.1 kHZ > 16 kHZ but would like to avoid the unnecessary steps if possible

Statistics: Posted by SmagicSman — Wed Mar 06, 2024 10:11 pm — Replies 0 — Views 21



Viewing all articles
Browse latest Browse all 4676

Trending Articles