Save png function keyPressed not working!

hey guys,
silly question: I am not able to save a png in this sketch, I cannot understand why…

saveCount = 0;
var mic, fft, spectrum = [];
var X,Y;
var spectrumBuffer = [];
var depth = 20;
var length = 40;
var spacing = 10;
var girth = 30;

function setup() {
  pixelDensity(5);
  X = windowWidth;
  Y = windowHeight;
  mic = new p5.AudioIn();
  mic.start();
  fft = new p5.FFT();
  fft.setInput(mic);
  createCanvas(X, Y,WEBGL);
  background(0);
  setFrameRate(60);
  spectrum = fft.analyze();
  
  //Nested array declaration
  for(var k=0; k<depth;k++){
   		 spectrumBuffer[k] = [];
  }
 ambientLight(100);
 pointLight(250, 250, 250, 100, 100, 0);
}

function draw() {
  orbitControl();
  spectrum = fft.analyze();
  spectrumBuffer[0] = subset(spectrum, 0, length);
  //Array shift
  for(var k=depth-1; k>0;k--){
    spectrumBuffer[k] = spectrumBuffer[k-1];
  }
  translate(spacing*length/2,0);
  rotateX(.5);
  rotateY(0);
  for(var k=0; k<depth;k++){
    rotateX(-.0005);
    translate(-1* spacing * length, 0, -spacing);
      for (var i = 0; i<length; i++)
      {
          rotateZ(.0000003*(X/2-mouseX));
          rotateX(.0000003*(Y/2-mouseY));
          var curr = spectrumBuffer[k][i];
          ambientMaterial(exp(curr/25),exp(curr/25),curr);
          translate(0,-1*curr/2);
          //box(girth, curr, 0);
          box(exp(curr/150));
          translate(spacing, curr/2);
      }
    }
}


function mouseWheel(event) {
  if(length+event.delta/10<=500 && length+event.delta/10>0){
   length += floor(event.delta/10);
  }
}
function keyPressed() {
  if (key == 'z') {
    save("screenshot" + saveCount + ".png");
    saveCount++;
  }
}

Where do run this, in the p5 editor?

Not sure about save() here

I run it on Firefox, it usually works on other sketches!

Reading the docs on save() it works on DOM elements, images, JSON, tables, and sounds. I would expect it to work on a 2D Canvas, which is basically a drawable image, but would be kind of surprised if it worked on WEBGL content (or at least, not surprised if it doesn’t). Were your sketches that worked with save() also using WEBGL?