Adding color to a spectrogram and making it round

here is an example where you have data and angle and radius

No sound though…

PVector center;

int[] data = { 
  9, 5, 8, 2, 7, 6, 1, 5, 2, 8
};


void setup() {
  size(1100, 900);
  center = new PVector(width/2, height/2);
}

void draw() {
  background(0);
  stroke(255); 
  ellipse(center.x, center.y, 9, 9);

  float angle = 0;
  stroke(255, 0, 0); 
  for (int i : data) {

    float x1= cos(radians(angle)) * i * 40 + center.x; 
    float y1= sin(radians(angle)) * i * 40 + center.y; 

    line (center.x, center.y, 
      x1, y1); 

    angle += (float) 360.0 /  (float) data.length;
  }//for
}
//

3 Likes