draw = (state) => {
const samples = 2 ** settings.samples;
p8g.colorMode(p8g.HSB);
p8g.rectMode(p8g.CENTER);
p8g.background(0, 0, 0);
p8g.fill(0, 0, 0);
p8g.rect(0, 0, width * 2, width);
p8g.stroke(0);
const step = Math.max(1, width / samples);
for (let i = 0; i < samples; ++i) {
let x = p5.map(i, 0, samples, 0, width);
let y = p5.map(state.data[i], 0, 1, 0, width / 2);
let h = p5.map(i, 0, samples, 0, 360);
p8g.fill(h, 100, 100);
p8g.rect(x, width / 4, step, y);
}
}