Problem with minim audio
in
Core Library Questions
•
1 year ago
Hi everyone!
I'm totally new to processing and now need some help. I tried to fix it on my own but i have no clue what's going on.
My problem is, that i try to play a mp3 in my sketch, but it plays it in a very strange way. It's like it's starting it a lot of times in a distance of some milliseconds.
This is my code so far. I'm really tired and it needs to be finished soon. I really hope you can help me see what I have to fix there =)
Thank you in advance!
Eve
I'm totally new to processing and now need some help. I tried to fix it on my own but i have no clue what's going on.
My problem is, that i try to play a mp3 in my sketch, but it plays it in a very strange way. It's like it's starting it a lot of times in a distance of some milliseconds.
This is my code so far. I'm really tired and it needs to be finished soon. I really hope you can help me see what I have to fix there =)
Thank you in advance!
Eve
- int amount = 100;
int[] posX = new int[amount];
int[] posY = new int[amount];
int[] sizeX = new int[amount];
int[] sizeY = new int[amount];
import ddf.minim.analysis.*;
import ddf.minim.*;
Minim minim;
AudioPlayer song1;
FFT fft;
void setup() {
background(0);
size(1000,1000);
smooth();
for (int i = 0; i < amount; i++) {
posX[i] = int(random(0,1000));
posY[i] = int(random(0,1000));
sizeX[i] = int(random(5,100));
sizeY[i] = int(random(5,100));
minim = new Minim(this);
song1 = minim.loadFile("Song1.mp3", 2048);
song1.loop(2);
fft = new FFT(song1.bufferSize(), song1.sampleRate());
fft.linAverages(128);
}
}
void draw() {
for (int i = 0; i < amount; i++) {
noStroke();
fill(150);
rect(posX[i],posY[i],sizeX[i],sizeY[i]);
}
}
1