Skip to content

Fix: Make WASAPI loopback buffer size adaptive to device capabilities#344

Open
anshul23102 wants to merge 1 commit into
SamXop123:mainfrom
anshul23102:fix/issue-331-adaptive-buffer-size
Open

Fix: Make WASAPI loopback buffer size adaptive to device capabilities#344
anshul23102 wants to merge 1 commit into
SamXop123:mainfrom
anshul23102:fix/issue-331-adaptive-buffer-size

Conversation

@anshul23102

@anshul23102 anshul23102 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the WASAPI loopback buffer being hardcoded to a fixed size that's incompatible with high-performance audio devices. The buffer duration is now dynamically determined based on the device's minimum supported period with a 10ms floor.

Changes

  • Modified WasapiLoopbackCapture constructor to query device period capabilities via GetDevicePeriod
  • Compute buffer duration as Math.Max(minimumPeriod, 10ms) to adapt to hardware capabilities
  • Pass computed duration to AudioClient.Initialize instead of fixed 0

Testing

Verified on high-performance audio interfaces that visualization no longer exhibits stuttering artifacts. The buffer now respects device latency constraints while maintaining compatibility across different hardware setups.

Related

Closes #331

The WASAPI loopback buffer was using a fixed size that could be incompatible
with high-performance audio devices. This caused audio stuttering and irregular
visualization spikes on systems with low-latency hardware.

Now the buffer duration is determined dynamically based on the device's minimum
supported period, with a minimum floor of 10ms to ensure compatibility across
different hardware setups.

Fixes SamXop123#331

Signed-off-by: Anshul Jain <aj.ts1758@gmail.com>
@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

@anshul23102 is attempting to deploy a commit to the Dot_NotSam's projects Team on Vercel.

A member of the Team first needs to authorize it.

@anshul23102

Copy link
Copy Markdown
Contributor Author

@SamXop123 /assign /claim

I've assigned this issue to myself and claimed it as part of GSSoC 2026. Please apply the gssoc:approved label when ready.

This PR addresses the WASAPI loopback buffer size limitation that was causing audio stuttering on high-performance systems by making the buffer duration adaptive to the device's capabilities.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6c94a424-6054-4156-9e3f-49152721ce68

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: C# WASAPI loopback buffer size fixed at 100ms, causes stuttering at low latency

1 participant