Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

low-latency pulseaudio pipeline using --input-buffer #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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)

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)
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.

2 participants