void genNoiseWave(XYscope xy) {
  // set new noiseSeed

  noiseSeed(frameCount);
  
  // get bufferSize() of output  
  // initialize array for storing values
  yWave = new float[xy.waveSize()];
  xWave = new float[xy.waveSize()];
  float nx = random(1);
  float ny = random(1);
  
  // add noise walker to waveform
  for (int i=0; i<yWave.length; i++) {
    xWave[i] = noise(nx)*1;
    yWave[i] = noise(ny)*1;
    nx+=.01;
    ny+=.01;
  }
}

void    draw_shape(XYscope xy, int note, int i)
{
    if (timbre == 0)
    {
        xy.ellipse(map(note, 0, 11, 2 * width / 15, 13 * width / 15), height / 2, height/5, height/5);
        for (int j = height / 5; j > filling; j--)
        {
            xy.ellipse(map(note, 0, 11, 2 * width / 15, 13 * width / 15), height / 2, j, j);
        }
    }
    if (timbre == 1)
    {
       C_point p0 = new C_point(map(note, 0, 11, 2 * width / 15, 13 * width / 15), height / 2);
       C_point p1 = new C_point(map(note, 0, 11, 2 * width / 15, 13 * width / 15) + cos(t[i] / 1f) + 150 + noise(t[i] / 100f) * 100f, + sin(t[i] / 1f) + height / 2  + noise(t[i] / 10f) * 100f );
       C_point p2 = new C_point(map(note, 0, 11, 2 * width / 15, 13 * width / 15) - cos(t[i] / 1f) + 150 * 2, - sin(t[i] / 10f) + 200 + height / 2 + noise(t[i] / 1f) * 100f);
       C_point p3 = new C_point(map(note, 0, 11, 2 * width / 15, 13 * width / 15), height / 2);
       
       C_point p4 = new C_point(map(note, 0, 11, 2 * width / 15, 13 * width / 15), height / 2);
       C_point p5 = new C_point(map(note, 0, 11, 2 * width / 15, 13 * width / 15) - cos(t[i] / 1f) - 150 - noise(t[i] / 100f) * 100f, - sin(t[i] / 1f) + height / 2  - noise(t[i] / 10f) * 100f );
       C_point p6 = new C_point(map(note, 0, 11, 2 * width / 15, 13 * width / 15) + cos(t[i] / 1f) - 150 * 2, + sin(t[i] / 10f) - 200 + height / 2 - noise(t[i] / 1f) * 100f);
       C_point p7 = new C_point(map(note, 0, 11, 2 * width / 15, 13 * width / 15), height / 2);
       xy.beginShape();
       for (float tt = 0; tt < 1; tt+= 0.01)
       {
           C_point pFinal = cubicBezier(p0, p1, p2, p3, tt);
           C_point pFinal2 = cubicBezier(p4, p5, p6, p7, tt);
           xy.vertex(pFinal.x, pFinal.y);
       }
        xy.endShape();

        xy.beginShape();
       for (float tt = 0; tt < 1; tt+= 0.01)
       {
           C_point pFinal = cubicBezier(p4, p5, p6, p7, tt);
           xy.vertex(pFinal.x, pFinal.y);
       }        
       xy.endShape();
       for (int j = -3; j < 4; j++)
       {
       xy.line(map(note, 0, 11, 2 * width / 15, 13 * width / 15)- 200 +j, height / 2 + 200+j, map(note, 0, 11, 2 * width / 15, 13 * width / 15) + 50+j, height / 2 - 50+j);
       }
    }
    if (timbre == 2)
    {
        xy.beginShape();
       xy.vertex(map(note, 0, 11, 2 * width / 15, 13 * width / 15), height / 2 - height / 4);
       xy.vertex(map(note, 0, 11, 2 * width / 15, 13 * width / 15), height / 2 + height / 4);
       xy.vertex(map(note, 0, 11, 2 * width / 15, 13 * width / 15) + height / 2, height / 2 - height / 4);
       xy.vertex(map(note, 0, 11, 2 * width / 15, 13 * width / 15), height / 2 - height / 4);
       xy.endShape();;
    }
    if (timbre == 3)
    {
        xy.ellipse(map(note, 0, 11, 2 * width / 15, 13 * width / 15) + t[i], height / 4, height/10, height/10);
        xy.beginShape();
        xy.vertex(map(note, 0, 11, 2 * width / 15, 13 * width / 15) + t[i], height / 4 + height/10);
        xy.vertex(map(note, 0, 11, 2 * width / 15, 13 * width / 15) + t[i], height / 4 + 2 * height / 6);
        xy.vertex(map(note, 0, 11, 2 * width / 15, 13 * width / 15) + t[i] + height / 6, height / 4 + height / 2);
        xy.vertex(map(note, 0, 11, 2 * width / 15, 13 * width / 15) + t[i], height / 4 + 2 * height / 6);
        xy.vertex(map(note, 0, 11, 2 * width / 15, 13 * width / 15) + t[i] - height / 6, height / 4 + height / 2);
        xy.vertex(map(note, 0, 11, 2 * width / 15, 13 * width / 15) + t[i], height / 4 + 2 * height / 6);
        xy.vertex(map(note, 0, 11, 2 * width / 15, 13 * width / 15) + t[i], height / 4 + 1 * height / 6);
        xy.vertex(map(note, 0, 11, 2 * width / 15, 13 * width / 15) + t[i] + height / 6, height / 4 + 1 * height / 6);
        xy.vertex(map(note, 0, 11, 2 * width / 15, 13 * width / 15) + t[i], height / 4 + 1 * height / 6);
        xy.vertex(map(note, 0, 11, 2 * width / 15, 13 * width / 15) + t[i] - height / 6, height / 4 + 1 * height / 6);
        xy.endShape();
    }
    if (timbre == 4)
    {
        xy.rect(map(note, 0, 11, 2 * width / 15, 13 * width / 15) - height / 10, height / 2 - height / 10, height/5, height/5);
        
        for (int j = height / 5; j > filling; j--)
        {
            xy.rect(map(note, 0, 11, 2 * width / 15, 13 * width / 15) + filling - j, height / 2 + filling - j, j, j);
        }
    }
}

public interface Draw_notes {
    void draw_(XYscope xy, int i);
}

class C {
    void draw_C(XYscope xy, int i) { draw_shape(xy, 0, i); }
}

class C_sharp {
    void draw_C_sharp(XYscope xy, int i) { draw_shape(xy, 1, i); }
}

class D {
    void draw_D(XYscope xy, int i) { draw_shape(xy, 2, i); }
}

class D_sharp {
    void draw_D_sharp(XYscope xy, int i) { draw_shape(xy, 3, i); }
}

class E {
    void draw_E(XYscope xy, int i) { draw_shape(xy, 4, i); }
}

class F {
    void draw_F(XYscope xy, int i) { draw_shape(xy, 5, i); }
}

class F_sharp {
    void draw_F_sharp(XYscope xy, int i) { draw_shape(xy, 6, i); }
}

class G {
    void draw_G(XYscope xy, int i) { draw_shape(xy, 7, i); }
}

class G_sharp {
    void draw_G_sharp(XYscope xy, int i) { draw_shape(xy, 8, i); }
}

class A {
    void draw_A(XYscope xy, int i) { draw_shape(xy, 9, i); }
}

class A_sharp {
    void draw_A_sharp(XYscope xy, int i) { draw_shape(xy, 10, i); }
}

class B {
    void draw_B(XYscope xy, int i) { draw_shape(xy, 11, i); }
}
