Skip to content

Conversation

@drzraf
Copy link

@drzraf drzraf commented Apr 1, 2021

sox -t pulseaudio depends upon pulseaudio buffering.
By default buffer size computation leads to (very) significant latencies (up to 2 sec)
A confidential solution for the happy fews is to rely on the PULSE_LATENCY_MSEC environment variable.

This commit publicly exposes pulseaudio in/out buffers by binding them to sox --[input]-buffer options.
With sox --input-buffer=40000 -t pulseaudio default -t pulseaudio default you now get a low-latency pipeline.

Notes:

  • Since --input-buffer defaults to 0, the default (high-latency) behavior stays unchanged
    (if PULSE_LATENCY_MSEC isn't set)

  • Since --buffer default to 8192 and can't be set to 0, it'll now have priority over
    PULSE_LATENCY_MSEC (for the playback stream)

@drzraf
Copy link
Author

drzraf commented Jul 15, 2025

ping?

By default buffer size computation leads to (very) significant latencies (up to 2 sec)
A confidential solution for the happy fews is to rely on the PULSE_LATENCY_MSEC environment variable.

This commit publicly exposes pulseaudio in/out buffers by binding them to `sox --[input]-buffer` options.
With `sox --input-buffer=40000  -t pulseaudio default -t pulseaudio default` you now get a low-latency pipeline.

Notes:
* Since --input-buffer defaults to 0, the default (high-latency) behavior stays unchanged
  (if PULSE_LATENCY_MSEC isn't set)

* Since --buffer default to 8192 and can't be set to 0, it'll now have priority over
  PULSE_LATENCY_MSEC (for the playback stream)
@drzraf drzraf force-pushed the pa-buffer-from-cmdline branch from b8076e1 to f26391b Compare July 15, 2025 01:47
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.

1 participant