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

1st

in what you posted, your function loadData(); has moved into draw() - not good.

2nd

don’t call loadData from draw() (1st line)

3rd

draw in itself runs 60 times per second, but you want to hear the note longer than 1/60 of a second

hence make draw like this:

  if (millis()-timer > 1000) {
    timer = millis();
     i++;
     load=true; 
  }

 if(load) {
    TableRow row = seisCsv.getRow(i);
    freqValuesLoaded = row.getFloat(0);
    out.playNote(freqValuesLoaded);  // Variable from the loadData() that I need 
    println(freqValuesLoaded);            // to access to hear notes in realtime.
    load = false; 
}

with this before setup()

int timer; 
int i;
boolean load=true;
3 Likes