sox icon indicating copy to clipboard operation
sox copied to clipboard

low-latency pulseaudio pipeline using --input-buffer

Open drzraf opened this issue 3 years ago • 0 comments

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 avatar Apr 01 '21 06:04 drzraf