Hello! Quick Question:
I’m building a program that visualizes multiple audio files together at once.
My program was working fine with just 3 audio files, but now that I’m loading and playing 7 audio files at once, the program fails to play all of my audio files simultaneously. Instead, some audio files start playing slightly earlier/later than others which disrupts the song.
For context, each audio file is a part of one song i.e. the drums, bass, vocals, etc. so if one file is off beat then the whole song sounds off.
Any clues as to how I can work around this? Does Processing have some limitation to the number of files that I can start playing at once? And if so, should I process the visualizer in batches and then combine after (complex)? Or, am I missing some easier way to load and play the audio files simultaneously in the setup()
function?
Happy to clarify and thank you in advance for any help!
Dylan
How I’m loading and playing audio files:
void setup(){
size(800,800);
file = new SoundFile[numsounds];
amp = new Amplitude[numsounds];
//for loop to load files named 1.wav, 2.wav, etc.
for (int i = 0; i < numsounds; i++) {
file[i] = new SoundFile(this, (i+1) + ".wav");
amp[i] = new Amplitude(this);
amp[i].input(file[i]);
}
//I've found playing each file individually like this to be
// more effective than the for loop method like above.
file[0].play();
file[1].play();
file[2].play();
file[3].play();
file[4].play();
file[5].play();
file[6].play();
}