Hello
Thanks again for you help. It’s not so much what I’m going to do at the end that I’m struggling with - it’s more the storing it within the array. Once I have the array I was just going to do a simple bezier line that will link up the array[i] with array[i - 1] etc, but I’m struggling with the array. I think it is my logic.
I’ve attached another bit of code. Essentially, I’m trying to get what I’m printing to the console (the i and the rms_scaled) into an array where each value of rms_scaled is positioned at it’s I value).
import processing.sound.*;
// Declare the processing sound variables
SoundFile sample;
Amplitude rms;
float[] ampHistory;
int i;
void setup() {
size(640, 360);
sample = new SoundFile(this, "pigeon1.mp3");
sample.play();
// Create and patch the rms tracker
rms = new Amplitude(this);
rms.input(sample);
}
void draw() {
background(125, 255, 125);
stroke(1);
noFill();
if (sample.isPlaying()) {
// for (int j = 0; j < 165; j++) {
float rms_scaled = map(rms.analyze()*10,0.0,10.0,20.0,350.0);
i += ceil(rms.analyze());
//ampHistory = new float[165];
//ampHistory[j] = rms_scaled;
println(i,rms_scaled);
ellipse(width/2 + i, height/2, rms_scaled, rms_scaled);
// }
}
//println(ampHistory[5]);
}
I’ve commented out what I was trying to do with the arrays as they’re not working but you can see my thinking. What seems to be happening is that instead of having an array of length 165 (as this is the max value of my i value (i.e. how many unique amp values I’m getting), I seem to have 165 arrays of length 165 (I think). As when I query the array at position 5 for example, I have 0 in all positions except position 5. I tried to treat it as a two dimensional array and went even further down the wrong track.
I really appreciate your time so not wanting you to have to do this for me, but even a pointer as where to look as feel I’m thinking about this incorrectly… I’ve looked at array lists over arrays but it’s almost as if, even though I have my i value that counts to 165, my frame rate must be counting to 12000 odd and I think I’m getting caught up between the two…