let ascii_chars = ["@", "#", "$", "%", "^", "&", "*", "(", ")", "-", "_", "=", "+", ":", ";", ",", ".", "<", ">", "?", "/", "\\", "|", "~", "`", "'", "\"", "{", "}", "[", "]"];
font = loadFont('arial.ttf');
createCanvas(600, 600, WEBGL);
let spectrum = fft.analyze();
pointLight(255, 255, 255, lightX, lightY, lightZ);
ambientLight(50, 50, 50);
rotateX(frameCount * 0.01);
rotateY(frameCount * 0.01);
for (let i = 0; i < cols; i++) {
for (let j = 0; j < rows; j++) {
let d = dist(x, y, width / 2, height / 2);
let offset = map(d, 0, dist(0, 0, width / 2, height / 2), 0, PI);
let a = map(spectrum[i], 0, 255, 0, 255);
let ascii_index = floor(map(a, 0, 255, 0, ascii_chars.length));
let ascii_char = ascii_chars[ascii_index];
translate(x - width / 2, y - height / 2, 0);
let vertexZ = sin(frameCount * 0.02 + offset) * 20;
let charSize = map(spectrum[i], 0, 255, 3, 50);
translate(0, 0, vertexZ);
torus(torusRadius, holeRadius, 48, 16);