I am trying to add background music that auto-starts when i run the processing sketch
...........continues
i followed a simple instruction online and i added codes at line 6 , 26, 27,40,46 ,48, and from 75 to 82
but i keep getting the error "duplicate field name.player" at line 26 .
that said, can i use any mp3 file by specifying the file or does it have to be at a specific bitrate ?
here's my code ,what am i doing wrong
- import processing.serial.*;
- import processing.opengl.*;
- import ddf.minim.*;
- Serial serial;
- int serialPort = 1; // << Set this to be the serial port of your Arduino - ie if you have 3 ports : COM1, COM2, COM3
- // and your Arduino is on COM2 you should set this to '1' - since the array is 0 based
- int sen = 3; // sensors
- int div = 3; // board sub divisions
- Normalize n[] = new Normalize[sen];
- MomentumAverage cama[] = new MomentumAverage[sen];
- MomentumAverage axyz[] = new MomentumAverage[sen];
- float[] nxyz = new float[sen];
- int[] ixyz = new int[sen];
- float w = 256; // board size
- boolean[] flip = {
- false, true, false};
- AudioPlayer player;
- Minim minim;
- int player = 0;
- boolean moves[][][][];
- PFont font;
- PImage b;
- void setup() {
- size(1026, 770, P3D);
- frameRate(25);
- minim = new Minim(this);
- // load a file, give the AudioPlayer buffers that are 1024 samples long
- // player = minim.loadFile("groove.mp3");
- // load a file, give the AudioPlayer buffers that are 2048 samples long
- player = minim.loadFile("groove.mp3", 2048);
- // play the file
- player.play();
- b = loadImage("data/3.jpg");
- font = loadFont("TrebuchetMS-Italic-20.vlw");
- textFont(font);
- textMode(SCREEN);
- println(Serial.list());
- serial = new Serial(this, Serial.list()[serialPort], 115200);
- for(int i = 0; i < sen; i++) {
- n[i] = new Normalize();
- cama[i] = new MomentumAverage(.01);
- axyz[i] = new MomentumAverage(.15);
- }
- reset();
- }
- void draw() {
- background(b);
- updateSerial();
- drawBoard();
- }
- void stop()
- {
- player.close();
- minim.stop();
- super.stop();
- }
...........continues
any form of help would be much appreciated
1