src/AudioRecorder.js
function getValueAt(audioData, t) {

        // Convert [0, 1] range to [0, audioData.length - 1]
        var index = (audioData.length - 1) * t;

        // Determine the start and end points for the summation used by the
        // Lanczos interpolation algorithm (see: https://en.wikipedia.org/wiki/Lanczos_resampling)
        var start = Math.floor(index) - LANCZOS_WINDOW_SIZE + 1;
        var end = Math.floor(index) + LANCZOS_WINDOW_SIZE;

        // Calculate the value of the Lanczos interpolation function for the
        // required range
        var sum = 0;
        for (var i = start; i <= end; i++) {
            sum += (audioData[i] || 0) * lanczos(index - i, LANCZOS_WINDOW_SIZE);
        }

        return sum;

    }
function getValueAt(audioData, t) {

        // Convert [0, 1] range to [0, audioData.length - 1]
        var index = (audioData.length - 1) * t;

        // Determine the start and end points for the summation used by the
        // Lanczos interpolation algorithm (see: https://en.wikipedia.org/wiki/Lanczos_resampling)
        var start = Math.floor(index) - LANCZOS_WINDOW_SIZE + 1;
        var end = Math.floor(index) + LANCZOS_WINDOW_SIZE;

        // Calculate the value of the Lanczos interpolation function for the
        // required range
        var sum = 0;
        for (var i = start; i <= end; i++) {
            sum += (audioData[i] || 0) * lanczos(index - i, LANCZOS_WINDOW_SIZE);
        }

        return sum;

    }
function getValueAt ( audioData , t ) { // Convert [0, 1] range to [0, audioData.length - 1] var index = ( audioData . length - 1 ) * t ; // Determine the start and end points for the summation used by the // Lanczos interpolation algorithm (see: https://en.wikipedia.org/wiki/Lanczos_resampling) var start = Math . floor ( index ) - LANCZOS_WINDOW_SIZE + 1 ; var end = Math . floor ( index ) + LANCZOS_WINDOW_SIZE ; // Calculate the value of the Lanczos interpolation function for the // required range var sum = 0 ; for ( var i = start ; i <= end ; i ++ ) { sum += ( audioData [ i ] || 0 ) * lanczos ( index - i , LANCZOS_WINDOW_SIZE ) ; } return sum ; }
Determines the value of the waveform represented by the audio data at
the given location. If the value cannot be determined exactly as it does
not correspond to an exact sample within the audio data, the value will
be derived through interpolating nearby samples.

@private
@param {Float32Array} audioData
An array of audio data, as returned by AudioBuffer.getChannelData().

@param {Number} t
The relative location within the waveform from which the value
should be retrieved, represented as a floating point number between
0 and 1 inclusive, where 0 represents the earliest point in time and
1 represents the latest.

@returns {Number}
The value of the waveform at the given location.
Determines the value of the waveform represented by the audio data at the given location . If the value cannot be determined exactly as it does not correspond to an exact sample within the audio data the value will be derived through interpolating nearby samples .