Expecting EOF error, can't find out where im going wrong

Hi,
new to the forums so sorry if this is formatted wrong. But I’m trying to set up an array with sounds but I’m just getting error after error and don’t know where I’m going wrong

import processing.sound.*; // this calls up the library that handles sound
import processing.serial.*;

Serial myPort;  // Create object from Serial class
String val ;     // Data received from the serial port
float convertedVal=1; //  where we store the value as a number
int counter;

soundFiles = new SoundFile[20];

void setup() {
  
  //setup happens once and is where everything is set up
  
   // I know that the first port in the serial list on my mac
  // is always my  FTDI adaptor, so I open Serial.list()[0].
  // On Windows machines, this generally opens COM1.
  // Open whatever port is the one you're using.
  printArray (Serial.list());
  String portName = Serial.list()[0];
  myPort = new Serial(this, portName, 9600);
  

  
  soundFiles[0] = new SoundFile(this, "1.wav");  // fill soundfile0 with this file
  soundFiles[1] = new SoundFile(this, "2.wav");  // fill soundfile1 with this file
  soundFiles[2] = new SoundFile(this, "3.wav");  // fill soundfile2 with this file
  soundFiles[3] = new SoundFile(this, "4.wav");  // fill soundfile3 with this file
  soundFiles[4] = new SoundFile(this, "5.wav");  // fill soundfile0 with this file
  soundFiles[5] = new SoundFile(this, "6.wav");  // fill soundfile0 with this file
  soundFiles[6] = new SoundFile(this, "7.wav");  // fill soundfile1 with this file
  soundFiles[7] = new SoundFile(this, "8.wav");  // fill soundfile2 with this file
  soundFiles[8] = new SoundFile(this, "9.wav");  // fill soundfile3 with this file
  soundFiles[9] = new SoundFile(this, "10.wav");  // fill soundfile0 with this file
  soundFiles[10] = new SoundFile(this, "11.wav");  // fill soundfile0 with this file
  soundFiles[11] = new SoundFile(this, "12.wav");  // fill soundfile1 with this file
  soundFiles[12] = new SoundFile(this, "13.wav");  // fill soundfile2 with this file
  soundFiles[13] = new SoundFile(this, "14.wav");  // fill soundfile3 with this file
  soundFiles[14] = new SoundFile(this, "15.wav");  // fill soundfile0 with this file
  soundFiles[15] = new SoundFile(this, "16.wav");  // fill soundfile0 with this file
  soundFiles[16] = new SoundFile(this, "17.wav");  // fill soundfile1 with this file
  soundFiles[17] = new SoundFile(this, "18.wav");  // fill soundfile2 with this file
  soundFiles[18] = new SoundFile(this, "19.wav");  // fill soundfile3 with this file
  soundFiles[19] = new SoundFile(this, "20.wav");  // fill soundfile0 with this file


  

} 


void draw(){
  
    // Load the soundfiles
  

  
  selectSound = (int) random(20);
  soundFiles[selectSound].loop();
}

not my whole code but this is the only parts not working

SoundFile[] soundFiles = new SoundFile[20];
You will need to declare the type of data. Same goes with selectSound

1 Like

never mind, that’s working perfectly. Thank you :slight_smile:
Do you know of a way to have a sound file to play for a minimum amount of time?