• Raymond Toy's avatar
    Better interpolation of oscillator at low frequencies · 65d50038
    Raymond Toy authored
    For low frequencies, use a 3-point or 5-point Lagrange interpolation
    scheme to improve the accuracy of the oscillator instead of using
    simple linear interpolation.
    
    For a typical context, the linear interpolator is used if the
    frequency >= 3.2 Hz; the 3-point, for 3.2 > frequency > 1.7 Hz; and
    the 5-point for all other cases.  Thus, typical use-cases are not
    impaired by this change.
    
    Some benchmark results from running an oscillator for 1000 seconds in an
    offline context.  This is the time measured from startRendering()
    until the promise is delivered.  The SNR is the measured SNR between
    the test signal and a reference 440 Hz signal.  The linear time was
    the same before and after this CL.
    
    linear:
    time: 1844.6 ms, stddev: 154.4
    SNR: 27.7 dB
    
    3-point:
    time: 2426.5 ms, stddev: 265.0
    SNR: 37.2 dB
    
    5-point:
    time: 2752.6 ms, stddev: 215.1
    SNR: 59.3 dB
    
    7-point (for reference, not used now):
    time: 3239.4 ms, stddev: 263.8
    SNR: 82.5 dB
    
    Bug: 773507
    Test: Oscillator/osc-440hz.html
    Change-Id: Ib49fab4fb27738f4f02bd41f8adcc2e3b2dd2137
    Reviewed-on: https://chromium-review.googlesource.com/713576
    Commit-Queue: Raymond Toy <rtoy@chromium.org>
    Reviewed-by: default avatarHongchan Choi <hongchan@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#510133}
    65d50038
osc-440hz.html 3.31 KB