Return a value
in
Integration and Hardware
•
2 years ago
I am trying to return a array from processing and display it in html page.
void draw()
{
background(0);
stroke(255);
float[] leftChannel = jingle.getChannel(BufferedAudio.LEFT);
//Calculating length********
int len=jingle.getChannel(BufferedAudio.LEFT).length;
//println("This is length"+len);
//length on frame calculations.
int lfrm=len/500;
//println("N Th value pick"+lfrm);
// Drawing the median*******
//line(0,54,width,54);
//selecting perticular points from total buffer.*******
//it is for 500 (frame length)
for(int i=0;i<500;i++)
{
select[i]=leftChannel[i*lfrm];
//println(select[i]);
}
//println("End of all");
// Draw the line********
for(int j=0;j<500;j++)
{
//line(j,100-leftChannel[j+20000]*100,j+1,100-leftChannel[j+20000+1]*100);
line(j,50-select[j]*100,j+1,50-select[j+1]*100);
}
//println("end");
did();
}
void stop()
{
jingle.close();
minim.stop();
}
float[] did()
{
//println(select);
return
select;
}
and..
<script type="text/javascript">
document.write(document.applets[0].did());
</script>
i am getting junk values..
1