From a quick glance, this is what I see:
If the global setting readDataFrom = INPUT_FROM_TEST_DATA, then draw will call fillTimeSignalWithTestData. What that does is:
- shift everthing in the timeSignal array left by one
- add a number to the end of the timeSignalArray
So, as draw loops, you timeSignal array is doing this each frame:
[0001]
[0012]
[0123]
[1234]
[2345]
[3456]
…only it is shifting and filling an array of 240 numbers (not 4 as in my example above) and rather than counting those numbers are floats generated by (counter & 0xff) / 255.0
. This looks like a sawtooth wave – you can inspect the output in a separate sketch this:
void draw(){
println((frameCount & 0xff) / 255.0);
}
The thing to change is for that value to be loaded from your numerical time series data. So, for example, if you loaded a column of numbers from a csv into
float myEEGRecording[];
…then each frame, your would be playing it back into the existing minim apparatus like this:
void fillTimeSignalWithRECORDEDData() {
shiftNtimes(timeSignal, 1);
timeSignal[timeLength - 1] = myEEGRecording[counter];
}
This will fail as soon as the counter is higher than your recording data -1. You can check at that point and stop the program, or check and then just provide 0s from then on with
int idx = counter;
if(counter >= myEEGRecording.length){
idx = 0;
}
timeSignal[timeLength - 1] = myEEGRecording[idx];
or if you want it to keep playing forever and have it wrap around to the beginning, you can do that with %:
timeSignal[timeLength - 1] = myEEGRecording[counter%myEEGRecording.length]