xxxxxxxxxx
// create a variable to store function generator object
var g;
function setup(){
// function generator object
g = new p5.Gen();
// harmonics(x, [h1… hn]): periodic function of harmonic strengths defined by an Array passed as the second argument. x is 0 to 1. Returns f(x).
// evaluate the value 20% (0.2) into a wavetable
// defined by harmonic strengths 1., 0.5, and 0.3:
var a = g.harmonics(0.2, [1.0, 0.5, 0.3]);
console.log(a);
// breakpoint function of line segments defined in time, amplitude pairs in the Array passed as the second argument. x is 0 to 1. returns f(x).
// evaluate the value halfway (0.5) into a breakpoint function
// rising from 0 to 1 then falling to 0:
var b = g.bpf(0.5, [0, 0, 1, 1, 2, 0]);
console.log(b);
// window(x, type, args): generates window functions by type. Some functions have optional args. x is 0 to 1. Returns f(x).
// evaluate the value 3/4ths (0.75) into a hamming window function:
var c = g.window(0.75, "hamming");
console.log(c);
}