The "best" audio constraints supported by the client. In this case, "best" is defined as "the constraints that will produce the highest-quality audio." That means disabling Echo Cancellation, disabling Noise Suppression, and disabling Automatic Gain Control.
preciseInterval()
is a version of setInterval()
for NodeJS that does not spin CPUs nor drift.
The returned value is an object with a clear()
methods that stops the interval.
In the browser context, preciseInterval()
is simply a wrapper for setInterval()
.
We do three things:
setTimeout()
.For a 10ms interval, we measured an average error per interval of:
1.67 ms
for setInterval()
(so SOMETHING is ticking at 60 Hz).~1 ms
for this code WITHOUT #3, using Date.getTime()
~1 ms
for this code WITHOUT #3, using perf_hooks.performance.now()
0.86 ms
for this code using Date.getTime()
0.03 ms
for this code using perf_hooks.performance.now()
The function to call when the precise interval expires.
The number of milliseconds to wait between each interval.
Returns a JS Object containing the differences between the two passed objects.
This function was adapted from this very helpful document on GoMakeThings. The original function is licensed under the MIT license.
This Module contains a number of useful utility functions that API users can use in their applications if they wish. Some of them are also used internally in API code.