Hello everyone,
I have a spreadsheet with the first 1 million numbers in PI. The goal is to have different visuals displayed along with music tones in accordance with the numbers in the chart (0-9). The sound works, however I cannot get the program to show any visuals at the same time. Eg. I want the program to draw an ellipse whenever "0" is read from the .CSV file.
Here is my code:
Table data;
int[] row;
import ddf.minim.*;
Minim minim;
AudioPlayer DO;
AudioPlayer RE;
AudioPlayer MI;
AudioPlayer FA;
AudioPlayer SOL;
AudioPlayer LA;
AudioPlayer TI;
AudioPlayer DOO;
void setup() {
size(500, 500);
background(50);
minim = new Minim(this);
data = loadTable("pi.csv", "header");
DO = minim.loadFile("do.wav");
RE = minim.loadFile("re.wav");
MI = minim.loadFile("mi.wav");
FA = minim.loadFile("fa.wav");
SOL = minim.loadFile("sol.wav");
LA = minim.loadFile("la.wav");
TI = minim.loadFile("ti-WAV.wav");
DOO = minim.loadFile("do-octave.wav");
}
void draw() {
fill(250);
stroke(250);
row = new int[ data.getRowCount()]; //create an array for row
for (TableRow row : data.rows()) {
for (int i=0; i < 10; i++) { // for loop with an increasing "i" allows program go get info through the rows
int A = row.getInt(i); //intA is equal to the number in the row
delay(200);
ellipse(mouseX, mouseY, 100, 50);
if (A==0) {
delay(500);
ellipse(100, 100, 100, 50);
}
if (A==1) {
RE.rewind();
RE.play();
ellipse(200, 200, 50, 50);
}
if (A==2) {
MI.rewind();
MI.play();
}
if (A==3) {
FA.rewind();
FA.play();
}
if (A==4) {
SOL.rewind();
SOL.play();
}
if (A==5) {
LA.rewind();
LA.play();
}
if (A==6) {
TI.rewind();
TI.play();
}
if (A==7) {
DOO.rewind();
DOO.play();
}
if (A==8) {
delay(300);
}
if (A==9) {
DO.rewind();
DO.play();
}
}
}
}
What can I do? Thank you!!