A more accessible way to set up latency correction

This read-only archive contains discussions from the Adding Feature forum.
New feature request may be posted to the Adding Feature forum.
Technical support is available via the Help forum.
Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: A more accessible way to set up latency correction

Post by Gale Andrews » Tue Jan 21, 2014 8:00 pm

Robert J. H. wrote:
Gale Andrews wrote:Do you get noise at the start for WASAPI with real source like stereo mix or line-in?
Hard to tell, my sound card has a terrible DC-offset of about -0.2. I can't judge if there's additional noise, apart from the faulty USB voltage.
It seems that the actual Audio starts after 3697 samples, as opposed to 1395 from the loop back.
That's of course the latency. However, It is rather strange that the recorded material is longer than the generated track but less than the Audio + latency.
I'm not too sure what you mean, Robert.

With WASAPI loopback or WASAPI stereo mix, overdub-recording playback of a selection, I get about 1300 samples of absolute silence at the start, about 200 samples of latency (noise) then the recording which is slightly truncated (though the whole recorded track is longer than the generated track).

Actually WDM-KS has absolute silence at the start too, but the recordings under MME and Windows DirectSound have noise at the start.


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

Robert J. H.
Posts: 3633
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 10

Re: A more accessible way to set up latency correction

Post by Robert J. H. » Tue Jan 21, 2014 8:54 pm

Gale Andrews wrote:
Robert J. H. wrote:
Gale Andrews wrote:Do you get noise at the start for WASAPI with real source like stereo mix or line-in?
Hard to tell, my sound card has a terrible DC-offset of about -0.2. I can't judge if there's additional noise, apart from the faulty USB voltage.
It seems that the actual Audio starts after 3697 samples, as opposed to 1395 from the loop back.
That's of course the latency. However, It is rather strange that the recorded material is longer than the generated track but less than the Audio + latency.
I'm not too sure what you mean, Robert.

With WASAPI loopback or WASAPI stereo mix, overdub-recording playback of a selection, I get about 1300 samples of absolute silence at the start, about 200 samples of latency (noise) then the recording which is slightly truncated (though the whole recorded track is longer than the generated track).

Actually WDM-KS has absolute silence at the start too, but the recordings under MME and Windows DirectSound have noise at the start.


Gale
I can't tell the silence from the noise due to the faulty power supply for the usb card, that's what I mean.
I've absolute trust in your values.
Have you already addressed the development department with this issue or should we first gather more data?

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: A more accessible way to set up latency correction

Post by Gale Andrews » Wed Jan 22, 2014 3:23 pm

Robert J. H. wrote:
Gale Andrews wrote:With WASAPI loopback or WASAPI stereo mix, overdub-recording playback of a selection, I get about 1300 samples of absolute silence at the start, about 200 samples of latency (noise) then the recording which is slightly truncated (though the whole recorded track is longer than the generated track).
Have you already addressed the development department with this issue or should we first gather more data?
After reboot and repeating a WASAPI loopback overdub recording of a tone, I only got the small bit of preceding noise on one attempt of six. Otherwise the preceding latency was entirely absolute silence. So it isn't completely consistent.

If WASAPI and WDM-KS present the latency as silence padding (or mostly silence and some noise), is that better or worse than presenting it entirely as noise?

Truncation of overdub recordings is a longstanding issue: http://bugzilla.audacityteam.org/show_bug.cgi?id=77 .


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

Robert J. H.
Posts: 3633
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 10

Re: A more accessible way to set up latency correction

Post by Robert J. H. » Wed Jan 22, 2014 9:40 pm

Gale Andrews wrote:
Robert J. H. wrote:
Gale Andrews wrote:With WASAPI loopback or WASAPI stereo mix, overdub-recording playback of a selection, I get about 1300 samples of absolute silence at the start, about 200 samples of latency (noise) then the recording which is slightly truncated (though the whole recorded track is longer than the generated track).
Have you already addressed the development department with this issue or should we first gather more data?
After reboot and repeating a WASAPI loopback overdub recording of a tone, I only got the small bit of preceding noise on one attempt of six. Otherwise the preceding latency was entirely absolute silence. So it isn't completely consistent.

If WASAPI and WDM-KS present the latency as silence padding (or mostly silence and some noise), is that better or worse than presenting it entirely as noise?
Digital silence can of course be detected in the easiest manner.

The question is which latency the digital silence represents. It seems to be the total amount for Wasapi loop back. However, this may be different for other sources that are eventually the only ones that make sense in a overdub context.

Intermediate summary:
- An automatic latency correction is primerly used for overdubbing with real sources such as line-in and microphone.
- We don't know the exact onset of the recorded source.
- The output does not leak into the input.
- Backing track and recording are therefore not correlated (e.g. click track and ocarina)
- We don't know the signal to noise ratio of the recording.
- The latency can vary from recording to recording and from configuration to configuration.
- A general latency correction in preferences isn't reliable.
- The recording is sometimes truncated and additionally extended by presumably one buffer length.
- A lot of Tracks produce a very long latency and cpu load.

All would be simple if we could "emulate" an impulse that goes from (before) the play back directly to the input side as if it came from the mic for example, i.e. the first sample of the play back would produce a click on the input side.

In my opinion, we have still to evaluate a time measurement scheme. We have already track of the current audio position, how reliable is this value during recording?
I have to look where this value is taken from.

Robert J. H.
Posts: 3633
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 10

Re: A more accessible way to set up latency correction

Post by Robert J. H. » Thu Jan 23, 2014 7:34 am

(Update)
I've looked into AudioIO.cpp
It's not very motivating, one has to scan 150000 characters or 136 pages. There's really nothing doing without an expert.

There is some interesting information about synchronized midi and audio playback though. Roughly the scheme for play back and record that spins around in my brain.

waxcylinder
Forum Staff
Posts: 14684
Joined: Tue Jul 31, 2007 11:03 am
Operating System: Windows 10

Re: A more accessible way to set up latency correction

Post by waxcylinder » Mon Mar 17, 2014 5:52 pm

Bump I can see Gales succinct summary from 16Jan:

There are three "features" to vote on:
•Polishing and Wiki-publishing Robert's plug-in to measure time difference between clicks in two selected tracks (I think there are still some confusions in that plug-in that users could trip over, but it would be much better than not having the tool published).
•A built-in tool that can adjust the latency correction setting according to clicks being recorded from a track that is playing.
•"Automatic" correction that takes into account latency variability.
◦This could be an "improved" version of the disabled PortAudio correction that tries to detect the current round trip latency then corrects for it.
◦It could alternatively try to time-shift the recorded audio "intelligently" by looking for the first "audio" in the recording and aligning the point where that audio starts with the position of the cursor or selection start. So it would be looking for and pushing preceding recorded noise behind the align point. I think it if could be done it could be useful in some scenarios and could be an alternative "option" to the latency detection method.



But I don't see any votes ...

Peter
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * FAQ * * * * * Tutorials * * * * * Audacity Manual * * * * *

Robert J. H.
Posts: 3633
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 10

Re: A more accessible way to set up latency correction

Post by Robert J. H. » Mon Mar 17, 2014 8:18 pm

As for me, I vote for all three options with the latter as the ultimate goal.
The user should eventually be freed from any latency worries--it's all done in the back ground.

Locked