#### Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

# Processing-3D shapes

edited December 2017

How can I create three-dimensional shapes whose sides are expanding based on the sound beats?

• What are you having trouble with?

Drawing 3D shapes?

Making their size depend on some other input?

Detecting beats in the sound?

What code do you have so far? POST IT.

• this is my code and i want to put smaller shapes inside the shpere

• please post code as text not as image

select code with mouse and press the small C in the command bar

• import ddf.minim.*;

Minim minim; AudioSample kick; AudioSample snare;

import peasy.*; import peasy.org.apache.commons.math.*; import peasy.org.apache.commons.math.geometry.*;

PeasyCam cam;

float kickHeight = 100;

void setup() { size (600, 600, P3D); cam = new PeasyCam(this, 500); minim = new Minim(this); kick = minim.loadSample( "tragoudi1.mp3",1024); // buffer size

}

void draw() { background(0); fill(200); lights();

float r = 200; int total = 50; for (int i = 0; i < total; i++) { float lon = map(i, 0, total, -PI, PI); for (int j = 0; j < total; j++) { float lat = map(j, 0, total, -HALF_PI, HALF_PI); float x = r * sin(lon) * cos(lat); float y = r * sin(lon) * sin(lat); float z = r * cos(lon); stroke(255); point(x, y, z); } }

for (int i = 0; i < kick.bufferSize() - 1; i++) { float x1 = map(i, 0, kick.bufferSize(), 0, width); float x2 = map(i+1, 0, kick.bufferSize(), 0, width); float y1 = kick.mix.get(i)kickHeight; float y2 = kick.mix.get(i+1)kickHeight; stroke(255,85,0); line(x1, 50 - kick.mix.get(i)kickHeight, x2, 50 - kick.mix.get(i+1)kickHeight); rect(x1,y1,20,40); } }

void keyPressed() { if ( key == 'k' ) kick.trigger(); }``