Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These PR adds two tools that I've found basic enough, to debug latency problems in the graph:
jack_lset: Corrects the latency reported by a (possibly buggy, or oblivious) client.
It opens one or more input-output port pairs which pipe audio unchanged, but report a different latency at the other end.
By default, the client adds the specified offset to the source latency, but it can also be made to replace the value entirely with the provided one (
-A, --absolute
).For cases where the input range has a width (min != max), the
-j, --join
option allows flattening it out into a single value. This uses the midpoint by default, but can be controlled (-l, --coefficient
defaults to 0.5, setting it to 0 weights fully towards min, etc.).jack_lsync: Delays each input-output pair as appropriate so that the latencies are aligned on the other end.
This can be used to avoid unwanted de-syncs when a client in the pipeline introduces a delay that isn't introduced in another pathway, or for playback / recording across multiple devices.
More precisely, the client looks at the input latencies across each port and chooses the maximum, which is called the "alignment latency". It then sets each delay line to the subtraction of the alignment latency minus that port's latency. It will dynamically adapt to changes in the latencies (due to e.g. reconnections), but it comes with a special mode (
-k, --keep
) that will never decrease the alignment latency, only increase it. The current implementation mutes the inputs while the delay lines are being resized, and it is careful to only do that if the delays have actually changed.The tool ultimately needs to pick a single value for the delay lines, so if min != max, it will flatten the range into a single value. Just like lset, it will use the midpoint by default but the
-l, --coefficient
option allows changing this.Each instance of either of these tools can be made to operate either on playback latencies (
-P, --playback
) or capture latencies (-C, --capture
). The amount of audio port pairs is variable (-a, --audio-ports
), and so is the server and client name, as usual.This PR is mainly to see if there would be interest in shipping these tools. They have been very valuable to me (and other people who have written emails thanking me).
(I actually wrote them 6 years ago on the
tools
repo, but didn't get to open the PR.)