Hey i got a problem with my visualizer
When i use this code I can select a MP3 file but the Visualizer didn´t show the line and only play the Sound
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;
String path;
Minim minim;
AudioPlayer Player;
int farbe;
PImage playPause;
PImage hintergrund;
void setup() {
size(500,400);
background(0);
minim = new Minim(this);
//Player = minim.loadFile(path); // Spielt die Mp3 datei ab
//Player.loop(); // Wiederholt den aktuellen Song
farbe = 0;
smooth();
playPause = loadImage("play3.jpg");
hintergrund = loadImage("hintergrund2.jpg");
}
void selected(File song){
path = song.getAbsolutePath();
}
void interrupt(){
while (path == null){
loop();
}
noLoop();
}
void draw() {
selectInput("Suche einen Song aus","selected");
interrupt();
background(0);
Player = minim.loadFile(path); // Spielt die Mp3 datei ab
Player.play();
image(hintergrund,0,0);
image(playPause,25,25);
translate(width/2, height/2);
rotate(radians(frameCount % 360 * 2));
colorMode(HSB);
stroke(farbe, 255, 255);
colorMode(RGB);
for(int j = 0; j < 360; j++){
if(Player.mix.get(j)*200 > 50) {
colorMode(HSB);
stroke(farbe, 255,255);
colorMode(RGB);
}
else {
colorMode(HSB);
stroke(farbe,255,255);
colorMode(RGB);
}
line(cos(j)*100, sin(j)*100, cos(j)*abs(Player.left.get(j))*250 + cos(j)*100, sin(j)*abs(Player.right.get(j))*250 + sin(j)*100);
}
//for(int i = 0; i < fft.avgSize(); i++){
//line((i * w)*3, height/1.1, (i * w)*3, height/1.1 - fft.getAvg(i) * 0.5);
farbe += 2;
if( farbe > 255)
{
farbe = 0;
}
// #########MOUSE############
if (mousePressed && (mouseButton == LEFT)) {
Player.pause();
} else if (mousePressed && (mouseButton == RIGHT)) {
Player.play();
}
}
But when i use this code Visualizer show me lines and effects why? here the visualizer got a MP3 in the loadFile but i need a way to choose the mp3 file
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;
String path;
Minim minim;
AudioPlayer Player;
int farbe;
PImage playPause;
PImage hintergrund;
void setup() {
size(500,400);
background(0);
minim = new Minim(this);
Player = minim.loadFile("bla.mp3"); // Spielt die Mp3 datei ab
Player.loop(); // Wiederholt den aktuellen Song
farbe = 0;
smooth();
playPause = loadImage("play3.jpg");
hintergrund = loadImage("hintergrund2.jpg");
}
/* void selected(File song){
path = song.getAbsolutePath();
}
void interrupt(){
while (path == null){
loop();
}
noLoop();
} */
void draw() {
//selectInput("Suche einen Song aus","selected");
//interrupt();
background(0);
// Player = minim.loadFile(path); // Spielt die Mp3 datei ab
// Player.play();
image(hintergrund,0,0);
image(playPause,25,25);
translate(width/2, height/2);
rotate(radians(frameCount % 360 * 2));
colorMode(HSB);
stroke(farbe, 255, 255);
colorMode(RGB);
for(int j = 0; j < 360; j++){
if(Player.mix.get(j)*200 > 50) {
colorMode(HSB);
stroke(farbe, 255,255);
colorMode(RGB);
}
else {
colorMode(HSB);
stroke(farbe,255,255);
colorMode(RGB);
}
line(cos(j)*100, sin(j)*100, cos(j)*abs(Player.left.get(j))*250 + cos(j)*100, sin(j)*abs(Player.right.get(j))*250 + sin(j)*100);
}
//for(int i = 0; i < fft.avgSize(); i++){
//line((i * w)*3, height/1.1, (i * w)*3, height/1.1 - fft.getAvg(i) * 0.5);
farbe += 2;
if( farbe > 255)
{
farbe = 0;
}
// #########MOUSE############
if (mousePressed && (mouseButton == LEFT)) {
Player.pause();
} else if (mousePressed && (mouseButton == RIGHT)) {
Player.play();
}
}
Please help me guys i need the filepath way for my university plx plx plx :(