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

[Feature] Continuous auto-calibration using audio timestamps #24

Open
xyzzy42 opened this issue Jan 26, 2021 · 0 comments
Open

[Feature] Continuous auto-calibration using audio timestamps #24

xyzzy42 opened this issue Jan 26, 2021 · 0 comments

Comments

@xyzzy42
Copy link
Contributor

xyzzy42 commented Jan 26, 2021

The audio buffers as supplied by PortAudio should have timestamps. If the computer's clock is being synchronized with NTP, then these timestamps should be very accurate. More accurate than a typical quartz watch.

So it should be possible to use these timestamps to calibrate tg. The number of samples received vs the timestamps between those samples should give the actual sampling rate.

This can be done continuously, so that as the sampling rate changes with temperature the calibration changes too.

For this to work, it requires:

  • PortAudio's timestamps are based on the computer's system clock and not PortAudio synthetically constructing them based on the samples received since the previous timestamp. On Linux, ALSA does provide real timestamps, generated in the kernel from the audio driver's interrupt code. PortAudio would need to use these.
  • The system clock is more accurate over the τ of interest than the audio hardware's clock. With NTP, even with an internet based NTP server, this should be the case.
  • That there is not a source of error (over the appropriate τ) prior to the timestamp of the audio. An example would be buffering in the microcontroller used in a USB audio device, to buffer data between each isochronous USB frame, which allows for unmeasured error on the computer's side of the USB interface. USB audio devices shouldn't do this.
@xyzzy42 xyzzy42 changed the title Feature Idea: Continuous auto-calibration using audio timestamps [Feature] Continuous auto-calibration using audio timestamps Jan 26, 2021
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

No branches or pull requests

1 participant