Storing data into an array (processing.sound)

You may try out an ArrayList of float[]:

import java.util.List;

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

void draw() {
  final float[] amps = new float[SAMPLE];
  ampHist.add(amps);
  print(ampHist.size(), TAB);

  for (int i = 0; i < SAMPLE; ++i) {
    amps[i] = random(20, 350);
  }
}
1 Like