Advertisement
Guest User

sooorry tim

a guest
Jun 19th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. import ddf.minim.analysis.*;
  2. import ddf.minim.*;
  3. Minim minim;
  4. AudioPlayer Erthal;
  5. FFT fft;
  6.  
  7. //Erthal
  8. boolean play;
  9. int button1_x = 410, button1_y = 265, button1_sz = 40;
  10.  
  11. //PImage img;
  12.  
  13. void settings() {
  14. size(800, 700);
  15. }
  16.  
  17. void setup()
  18. {
  19. //load img
  20. //img = loadImage("/Users/piakeller/Dropbox/klimawandel/- files/- würzburg files/map_01.jpeg");
  21. minim = new Minim(this);
  22. Erthal = minim.loadFile("/Users/piakeller/Dropbox/klimawandel/- audio/Deutschland_Würzburg_B19_10.mpeg", 1024);
  23. Erthal.loop();
  24. fft = new FFT( Erthal.bufferSize(), Erthal.sampleRate() );
  25. }
  26.  
  27. void draw()
  28. {
  29. //image(img, 0, 0);
  30. background(255);
  31. fft.forward( Erthal.mix );
  32.  
  33. if (play)
  34. Erthal.play();
  35. else
  36. Erthal.pause();
  37.  
  38. for(int i = 0; i < fft.specSize(); i++)
  39. {
  40. //background(255);
  41. fill(fft.getBand(i)*1000);
  42. ellipse(button1_x, button1_y, button1_sz, button1_sz);
  43. }
  44. }
  45.  
  46. void mousePressed(){
  47. //napoli
  48. if( mouseX > button1_x && mouseX < button1_x + button1_sz &&
  49. mouseY > button1_y && mouseY < button1_y + button1_sz){
  50. play = !play;//will switch false/true each click
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement