﻿# PortAudio status flags: input overflow and output underflow describe different gaps

PortAudio status flags: input overflow and output underflow describe different gaps. A focused voice-infrastructure guide with the documented mechanism, a reproducible validation scenario, evidence and operational li.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/voice-portaudio-input-overflow-output-underflow/
Language: en

Input overflow and output underflow describe different failures in a voice pipeline. Collapsing them into one generic audio-error counter hides whether the model missed captured material or the listener lacked generated output. PortAudio callback status flags provide direction-specific evidence, but they do not automatically quantify every missing sample or identify the root cause.

## The audio contract

The input-overflow flag reports discarded input data under the documented buffering mode, whereas output underflow concerns the output path lacking timely data. Exact wording and placement depend on the stream configuration, including whether frames-per-buffer is unspecified. These are bit flags that can coexist, not mutually exclusive error categories. A flag indicates an observed stream condition; treating it as an exact acoustic gap duration without additional evidence would exceed the interface contract.

## Implementation details

Maintain separate counters for capture loss and playback starvation, with the relevant stream and callback configuration. When flags combine, increment the corresponding observations rather than keeping only the first matching branch. Define how downstream ASR sees an input discontinuity and how playback fills an output shortage. Keep synthetic replacement or inserted silence distinguishable from genuine source samples. Collect lightweight evidence in the callback and export it outside the real-time path so diagnostics do not create additional deadline failures themselves.

## A constructed validation case

Construct separate capture-pressure and playback-starvation cases, then a case in which both flags are observed together. Verify that counters and downstream discontinuity handling preserve the direction of each event. Compare source duration, valid captured samples and any explicit replacement rather than assuming all missing time is known from a flag. Acceptance requires direction-specific evidence and no silent loss of a combined flag. Review the test under the actual buffering mode; a result from one host and buffer configuration should not be generalized to every audio backend.

## Operational limits

These observations support reliability diagnosis, not a direct score for speech intelligibility. An ASR model may react differently to different loss locations, and output starvation can affect the user without changing model execution. Keep operational gap evidence alongside, rather than inside, model-quality claims.

## Primary references

[Portaudio Api](https://portaudio.com/docs/v19-doxydocs/portaudio_8h.html); [Portaudio Header](https://raw.githubusercontent.com/PortAudio/portaudio/master/include/portaudio.h).

This is a proposed voice-system validation, not an executed Retrivium benchmark. Preserve the implementation version and unresolved outcomes; interface documentation does not establish the quality or timing of a deployed voice service.

## Related reading

[VoiceGuard and AASIST: latency is not live-call detection evidence](/journal/voiceguard-aasist-streaming-latency-weight-readiness/); [Audio resampling for datasets: keep timestamps aligned when sample counts change](/journal/data-guide-audio-resample-time-labels/).
