Guest User

Untitled

a guest
Jul 21st, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. import ddf.minim.*;
  2. import processing.serial.*;
  3.  
  4. Serial myPort;
  5.  
  6. Minim minim;
  7. AudioPlayer player;
  8.  
  9. int previousMillis = 0;
  10. int interval = 10000;
  11. boolean daFare = true;
  12.  
  13. void setup()
  14. {
  15. size(512, 200, P3D);
  16.  
  17. // we pass this to Minim so that it can load files from the data directory
  18. minim = new Minim(this);
  19. myPort = new Serial(this, Serial.list()[0], 9600);
  20.  
  21. // loadFile will look in all the same places as loadImage does.
  22. // this means you can find files that are in the data folder and the
  23. // sketch folder. you can also pass an absolute path, or a URL.
  24. player = minim.loadFile("youcan.mp3");
  25. //printArray(Serial.list());
  26. }
  27.  
  28. void draw()
  29. {
  30. background(0);
  31. stroke(255);
  32. if ((millis() - previousMillis) > interval) {
  33. player.play();
  34. print(millis());
  35. previousMillis = millis();
  36. delay(3500);
  37. player.rewind();
  38.  
  39. }
  40. if ((myPort.available() > 0) && (daFare)) {
  41. daFare = false;
  42. player = minim.loadFile("congratulations.mp3");
  43. player.play();
  44. print("verde");
  45. }
  46.  
  47. }
Add Comment
Please, Sign In to add comment