Hi everyone,
I am trying to define a scripting that calculates the sound wave and then whenever it is more than an amount, it creates random points and then it connects the points with line. I developed the scripting and was wondering if anyone has any idea about the error that I am getting.
</**
* This sketch demonstrates how to play a file with Minim using an AudioPlayer. <br />
* It's also a good example of how to draw the waveform of the audio. Full documentation
* for AudioPlayer can be found at http://code.compartmental.net/minim/audioplayer_class_audioplayer.html
* <p>
* For more information about Minim and additional features,
* visit http://code.compartmental.net/minim/
*/
import ddf.minim.*;
Minim minim;
AudioPlayer player;
ArrayList stpoints=new ArrayList();
stpoint.add(new PVecor(xp,yp,zp));
float hvalue;
float threshold;
float xr;
float yr;
float zr;
void setup()
{
size(512, 200, P3D);
// we pass this to Minim so that it can load files from the data directory
minim = new Minim(this);
// loadFile will look in all the same places as loadImage does.
// this means you can find files that are in the data folder and the
// sketch folder. you can also pass an absolute path, or a URL.
player = minim.loadFile("rec20190723151425-46119.mp3");}}
}
void Draw(){
background(0);
pushMatrix();
///simulated camera//////////////////
translate(width/2,height/2);
rotateY(PI*2*mouseX/width);
rotateX(PI*2*mouseY/height);
///end camera//
stroke(255);
for(int i = 0; i < player.mix. size () - 1; i++)
{
if(hvalue <abs(player.mix.get(i))){hvalue = abs(player.mix.get(i));
}
if(hvalue>threshold){
float xp = random(-300,300);
float yp = random(-300,300);
float zp=random(-300,300);
stpoints.add(new PVector(xp,yp,zp));
//The processing script reads the audio file and calculates the sound-wave. A height threshold was applied to the wave lenghts, if the sound-wave exceeded the limit, a vector point was created.
//vector connects the points into a larger tessellation.
{
PVector newcoor=stpoints.get(i);
xr=xr+newcoor.x;
yr=yr+newcoor.y;
zr=zr+newcoor.z;
}
for (int j=0; j<stpoints.size();j++){
PVector coor1=stpoints.get(j);
PVector coor2=stpoints.get(j);
line (coor1.x,coor1.y,coor1.z,coor2.x,coor2.y,coor2.z);
}
}
```>