On 20.03.2016 19:13, Alexander E. Patrakov wrote: > 20.03.2016 22:41, Georg Chini пиÑ?еÑ?: >> Hello, >> >> I am still working on module-loopback and hit a problem that I cannot >> explain. >> When running a HDA card with long latency (333ms) I see that the >> resulting >> latency is not stable but varies around 300 usec. What is worse, the >> changes >> in latency are not even reported, module-loopback sees a completely >> stable >> value ( +/-10 usec). >> My setup: I have a bitscope dual channel USB oscilloscope attached to >> another >> machine. This device also has a function generator that I set to 1kHz >> rectangle. >> The signal is input to the HDA card and fed to the output of the same >> card via >> module-loopback. Input and output signal are measured using the >> oscilloscope. >> The movement of the edge of the output signal now shows the "latency >> jitter" >> which can be made visible by using the overlay mode of the oscilloscope. >> >> The result for HDA (module-loopback running with 500ms adjust time >> and 1s >> latency) is shown at http://georg.chini.tk/hda_333ms_3.png. Some of the >> original >> input signal is somehow fed into the output signal, don't know where >> this happens, >> so please ignore it as it has no impact on the result. > > No idea either, just some blind pokes... > > 1. Are you using the trivial resampler? Does anything change if you > change the resampler type? > 2. Do you get the same trace with a "weird" latency (not something > that can be derived from one second by multiplication or division by > small factors)? E.g. something like 318 ms. > > To me, it looks like something is sometimes creating an > off-by-one-sample error when copying the data. Which is exactly the > job of the trivial resampler, that's why the question. > Hi Alexander, no, I am working with speex-float-5. I just re-tested zitaj-bridge, and I was wrong, it shows the same behavior. I am also seeing double lines, so it is probably deeper down in the alsa driver. I also tested your 318 ms - same result. To rule out artifacts produced by the oscilloscope I fed the input signal directly to the second channel - this looks fine. The choice of the resampler does no longer have any impact on the performance of module-loopback. For small latencies (70ms - 100ms) I can keep the latency jitter now well below 100 usec for HDA -> USB on my system, this corresponds to a difference of 35 mm in hearing distance. When the USB device is run in batch mode the result is even better but less robust to changes in system load. zitaj-bridge is still somewhat better for HDA -> USB and USB -> HDA (~50 usec) but always fails after a few minutes complaining about excessive timing errors even for HDA -> HDA on the same card.