PortAudio / portaudio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
Other
1.43k stars 296 forks source link

Win32/WASAPI loopback: distorted audio while capturing via sync API #945

Open arkadijs opened 1 month ago

arkadijs commented 1 month ago

Mono audio captured as paInt16 on WASAPI loopback device via sync Pa_ReadStream() API is distorted, while the callback capture works without problem. It sounds like wrong format or clipped. Sampling rate and duration are correct. Capturing mic with the same program works fine. Reproduced by @dmitrykos here.

dmitrykos commented 1 month ago

Thank you for opening this issue.

I managed to reproduce garbled output with just writing sine. So there must be some common issue in PA WASAPI in relation to 1 channel I/O which I will investigate.

Here is my test bench: https://gist.github.com/dmitrykos/872c2014f60662324d6e4893b4e8e55f

dmitrykos commented 1 month ago

@arkadijs I created #948 PR related to the issue you noticed. Loopback capturing works well for me. I used modified patest_read_record to test loopback capturing. In general sync API was broken to all 1-channel I/O of WASAPI backend, so now it is fixed.

Will be waiting for your further feedback.