Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ddf.minim.*;
- import processing.serial.*;
- Serial myPort;
- Minim minim;
- AudioPlayer player;
- int previousMillis = 0;
- int interval = 10000;
- boolean daFare = true;
- void setup()
- {
- size(512, 200, P3D);
- // we pass this to Minim so that it can load files from the data directory
- minim = new Minim(this);
- myPort = new Serial(this, Serial.list()[0], 9600);
- // loadFile will look in all the same places as loadImage does.
- // this means you can find files that are in the data folder and the
- // sketch folder. you can also pass an absolute path, or a URL.
- player = minim.loadFile("youcan.mp3");
- //printArray(Serial.list());
- }
- void draw()
- {
- background(0);
- stroke(255);
- if ((millis() - previousMillis) > interval) {
- player.play();
- print(millis());
- previousMillis = millis();
- delay(3500);
- player.rewind();
- }
- if ((myPort.available() > 0) && (daFare)) {
- daFare = false;
- player = minim.loadFile("congratulations.mp3");
- player.play();
- print("verde");
- }
- }
Add Comment
Please, Sign In to add comment