Analyzing two SoundFile objects at the same time

Hi there, I was setting up a test scene to, well, test stuff, when I stumbled across this problem : it would seem that I can’t analyze two SoundFile objects at the same time. I’ve tried with a WhiteNoise and an AudioIn and it works well with those, but using two SoundFile seems to make the sound library pouty. Here’s a simplified version of the code:

int bands = 512;
float[] lS = new float[bands];
float[] rS = new float[bands];
FFT lFft;
FFT rFft;
SoundFile left;
SoundFile right;

void setup()
  /*Things that weren't of particular interest were omitted*/
  lFft = new FFT(this, bands);
  rFft = new FFT(this, bands);

  left = new SoundFile("left.wav");;
  right = new SoundFile("right.wav");;


void draw()
  for(int i = 0; i < bands; i++)
    line(i, height, i, height - lS[i]*height*5 );
    line(i, 0, i, rS[i]*height*5);

The output, which should consist of moving black lines at the top and bottom, ends up looking like this:

Thanks in advance for your help :slight_smile:

did you include “size”. in setup?

Yep, else I wouldn’t have a visual output at all, that’s why I omitted it.

actually here no problem:

but i used .loop() ? your song 2 is short?