How do I get a list of my device's audio sample rates using PyAudio or PortAudio?

后端 未结 3 1800
忘了有多久
忘了有多久 2020-12-19 06:46

I\'d like to query my audio device and get all its available sample rates. I\'m using PyAudio 0.2, which runs on top of PortAudio v19, on an Ubuntu machine with Python 2.6.

3条回答
  •  醉酒成梦
    2020-12-19 07:04

    Directly using Portaudio you can run the command below:

    for (int i = 0, end = Pa_GetDeviceCount(); i != end; ++i) {
        PaDeviceInfo const* info = Pa_GetDeviceInfo(i);
        if (!info) continue;
        printf("%d: %s\n", i, info->name);
    }
    

    Thanks to another thread

提交回复
热议问题