Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ddf.minim.*;
- import ddf.minim.ugens.*;
- import netP5.*;
- import oscP5.*;
- OscP5 osc;
- Minim minim;
- AudioOutput out;
- Oscil wave;
- float xval = 0;
- float yval = 0;
- float ellsize = 30.0;
- void setup(){
- fullScreen();
- osc = new OscP5(this, 12345);
- minim = new Minim(this);
- out = minim.getLineOut();
- wave = new Oscil (440, 0.5f, Waves.SINE);
- wave.patch (out);
- frameRate(30);
- rectMode(CENTER);
- noCursor();
- noStroke();
- }
- void draw(){
- background(245,120,47,30);
- ellipse(xval, yval, ellsize, ellsize);
- stroke (130,0,0);
- strokeWeight(5);
- for (int i=0; i<width-1; i++){
- point(i, height/2 - (height*0.50) * wave.getWaveform().value((float)i /width));
- }
- }
- void keyPressed() {
- if (key == 's'){
- saveFrame();
- }
- }
- void oscEvent(OscMessage message){
- println(message);
- if(message.checkAddrPattern("/mtpad/0/x") == true){
- xval = message.get(0).floatValue() * width;
- float amp = map (mouseX, 0, width, 110,880);
- wave.setAmplitude(amp);
- }
- if(message.checkAddrPattern("/mtpad/0/y") == true){
- yval = message.get(0).floatValue() * height;
- float freq = map(mouseY, 0, height, 1,0);
- wave.setFrequency(freq);
- }
- if(message.checkAddrPattern("/mtpad/0/size") == true) {
- ellsize = message.get(0).floatValue()*60.0;
- }
- }
Add Comment
Please, Sign In to add comment