Storing data into an array (processing.sound)

Sorry - back again. Just one more question if that’s ok so that I can try and understand what’s happening.

I have the isplaying function and the array list but at the end of the draw function (and outwit the if isplaying function), I’ve queried the size of the array. I assumed it would be 165 (as the loop would have collected all the data and I now have a static array. but the console counts up to 165 - so the array is still dynamic even outwith the function that I’m collecting the data. Is that right?

Thanks again

Becky

import processing.sound.*;
import java.util.List;

// Declare the processing sound variables
SoundFile sample;
Amplitude rms;

static final int SAMPLE = 165;
final List<float[]> ampHist = new ArrayList<float[]>();

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()) {
        
  float rms_scaled = map(rms.analyze(),0.0,1.0,20.0,350.0);

  i += ceil(rms.analyze());
  
    final float[] amps = new float[SAMPLE];
    ampHist.add(amps);
    
    //print(ampHist.size(), TAB);
    
    for (int i = 0; i < SAMPLE; ++i) {
    amps[i] = rms_scaled;
  }
}
  println(ampHist.size());
}