Var not iterating problem • Use all row values to iterate CSV column with for loop to playNote()

Hola @Chrisir, and thank you for your help. I am implementing your solution, but in an OOP way since I am learning, my code was very messy and needed to organize and transition into OOP so that I can continue to develop this prog.
I believe this is an OOP question…

I am declaring and initializing an object in the main prog, and I am calling (from main) a method/function that has a timer within that object/class. The timing defined inside the function in that object has no effect in main.
I am trying to apply OOP like in the Learning Processing example,

myCar.drive();   
myCar.display();

Is this related to inheritance?
Following is only the relevant code for my problem.
In my main prog draw I have this:

void draw() {
  background(0);
  stroke(255);
  seisData.iterate();   // calling the iterate method, start iterating i
  println(seisData.i);  // When I print i from the main tab  I get faster crazy 
                        //iteration. does not adhere to the method 'iterate' timing
  float freqValuesLoaded = seisData.freqValuesLoaded;
  freqValues = freqValuesLoaded;   
  ToneInstrument myNote = new ToneInstrument(freqValues, 0.5, out); 
  out.playNote(0.5, 2.6, myNote);

and inside the class I have this:

class SeisData {

boolean load = true;
  int i = 0;
  float interval = 5000; 
  long timer;

SeisData() {
    timer = millis();
  }

void iterate() {
    if (seisCsv==null) return;
    timer = 0;    
    if (millis() - timer > interval ) {
      timer = millis();
      i++;
      println(i);  // When I print i from here I get the correct interval of iteration this correct timing . 
      load=true;
    }
  }
}

Summing it up:
When I print i from main program the timing is crazy, I get repeating values of i for the duration of my interval, and then once the interval is done, the values go at top speed. However, when I print i from within the class_method, the timing of the iteration of i is the correct one and I see it in printed the console. For this to work I need to iterate i at a specific rate in order to synthesize sound from the Table values. I really have tried to find a solution but I have been unsuccessful :frowning:

I also wanted to ask about your previous post , to really see if I understand correctly. You start if (seisCsv==null) return;
is this an exit condition? in case seisCsv is not ready?

At the end you set load=true; but at the top load is already initialized as true, why would you need to do it again?

Thank you for taking the time to read this and for your help.