1

When I have an audiodevice like a focusrite scarlett or a behringer UCG 102 connected to my computer, I can use a control panel to change parameters like the samplerate and the size of the audiobuffer. You can see an example of such a control panel in the screenshot.

ASIO-USB Control Panel

Now when I use that device with pyaudio, I have to specify the samplerate and the size of the audiobuffer.

pyaudio_instance.open(
        format=FORMAT,
        channels=CHANNELS,
        rate=RATE, # samplerate is specifyed here
        input=True,
        output=True,
        frames_per_buffer=CHUNK, # audiobuffer is specifyed here
        input_device_index=13,
        output_device_index=13,
        stream_callback=self._on_stream_tick,
        start=True,
    )

Is there any way, I can read the size of the audiobuffer and what samplerate is selected from the controlpanel? Because I want PyAudio to always use the samplerate and the audiobuffer, which is selected in the controlpanel ...

0 Answers0