Typed Array

JavaScript has several iterable arrays defined for storing various pieces of information in traditional memory stores. The following arrays are most common:

The JS-Xtract library can operate on these arrays as normal. JavaScript operates all numbers as double precision calculations and stores them as such provided the destination can support it. This means that the following is true:

var N = 32;
var a = new Float64Array(N);
var b = new Uint8Array(N);

for (var n=0; n<N; n++) {
a[n] = b[n] = n;

// Have two arrays iterating from 0 to 31 in different types

var meanA = xtract_mean(a);
var meanB = xtract_mean(b);

console.log(meanA === meanB); // True

Manipulating Arrays

Typed arrays are used extensively thoughout JS-Xtract to ensure a high resolution data store that is efficient on memory. Web audio also uses the Float32Array for transfering audio buffers around. To aid in manipulating these sometimes quite large arrays, the following functions are available.