Skip to content

Does CPAL add any latency? #560

Closed
Closed

Description

@Be-ing

Does CPAL add any latency for any of the backends? PortAudio has a major issue with doubling the latency with its JACK implementation and I am hoping CPAL has no such problems. Regardless of the answer, it would be good to document it.

Activity

  1. LastExceed commented on Aug 16, 2026

    @LastExceed
    Collaborator

    There shouldn't be any.

    In many cases, cpal directly forwards the hardware buffers provided by the underlying API to the user callback. For instance, on Windows, WASAPI signals a waitable object on every period, and cpal maps WASAPI's buffer as the slice that is passed to the data callback, which means you are reading from/writing to WASAPIs buffer directly. The current ASIO implementation does funnel everything through a staging buffer because it needs to (de-)interleave multi-channel streams, but this happens entirely within the same buffer cycle, so it doesn't affect total latency.

    I'm personally not familiar with the other platforms, so I can't make any guarantees there, but if one of cpal's backends increases latency by queueing up stream data, then I'd consider that a bug.

  2. locked and limited conversation to collaborators on Sep 8, 2026
  3. converted this issue into a discussion #1364 on Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions