Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ddf.minim.analysis.*;
- import ddf.minim.*;
- Minim minim;
- AudioPlayer Erthal;
- FFT fft;
- //Erthal
- boolean play;
- int button1_x = 410, button1_y = 265, button1_sz = 40;
- //PImage img;
- void settings() {
- size(800, 700);
- }
- void setup()
- {
- //load img
- //img = loadImage("/Users/piakeller/Dropbox/klimawandel/- files/- würzburg files/map_01.jpeg");
- minim = new Minim(this);
- Erthal = minim.loadFile("/Users/piakeller/Dropbox/klimawandel/- audio/Deutschland_Würzburg_B19_10.mpeg", 1024);
- Erthal.loop();
- fft = new FFT( Erthal.bufferSize(), Erthal.sampleRate() );
- }
- void draw()
- {
- //image(img, 0, 0);
- background(255);
- fft.forward( Erthal.mix );
- if (play)
- Erthal.play();
- else
- Erthal.pause();
- for(int i = 0; i < fft.specSize(); i++)
- {
- //background(255);
- fill(fft.getBand(i)*1000);
- ellipse(button1_x, button1_y, button1_sz, button1_sz);
- }
- }
- void mousePressed(){
- //napoli
- if( mouseX > button1_x && mouseX < button1_x + button1_sz &&
- mouseY > button1_y && mouseY < button1_y + button1_sz){
- play = !play;//will switch false/true each click
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement