deinterleave
v1.0.0
Published
Deinterleave interleaved array[-ish] object
Downloads
34
Maintainers
Readme
deinterleave
Deinterleaves elements in an array.
const deinterleave = require('deinterleave')
let array = [1,0,1,0,1,0,1,0]
deinterleave(array, 2)
// array is [1,1,1,1,0,0,0,0]
API
deinterleave(source, stride=2)
Rearrange source elements so that it has planar layout:
[a,b,c, a,b,c, ...]
→ [a,a,a,..., b,b,b,..., c,c,c]
Source can be an Array, TypedArray or any array-like object. stride
indicates number of elements per group, eg. in case of audio buffer it is number of channels.
License
© 2017 Dima Yv. MIT License