Reference > map
Wave
Spectrum
map is a function associated with the Wave class that lets you apply any function you want to transform a wave.
Usage
wave.map(() => 0)fills a wave with zeroeswave.map(() => Math.random())fills a wave with random numberswave.map(e => e * e)squares the output of a wavewave.map(e => Math.abs(e))returns the absolute value of a wavewave.map((e, i) => i / 128)returns a wave whose entries linearly increase from 0 to 1
map allows you to build any effect you like. All the other wave manipulation functions are built using this function. Read more about map here.
You can find the code for map in the synthesine library.