Sunday, 27 March 2011

Ideas


I looked at Wave varied forms to display my Raw Data, Including colour and volume to demostrate the effects of the Arch OS feed.





How i wanted to create my visualisation, a wave effected by the feed and colour used to demonstrate different feeds or variables in the feed.



Code produced for learning

Picture Mouse Trail with Sound Freq

import ddf.minim.*;
import ddf.minim.signals.*;

Minim minim;
AudioOutput out;
SineWave sine;



int[] xpos = new int [50];
int[] ypos = new int[50];


void setup()

{
  size(500,500);
  frameRate(25);
  smooth();
  for (int i = 0; i < xpos.length; i++)
  {
    xpos[i] = 0;
    ypos[i] = 0;
  }
 
  minim = new Minim(this);
  out = minim.getLineOut(Minim.STEREO);
  sine = new SineWave(440, 0.5, out.sampleRate());
  sine.portamento(200);
  out.addSignal(sine);
 
 
}

void draw()
{
  background(255);
  for (int i = 0;i <xpos.length-1; i++)
 
  {
    xpos[i] = xpos[i+1];
    ypos[i] = ypos[i+1];
  }
  
  xpos[xpos.length-1] = mouseX;
  ypos[ypos.length-1]= mouseY;
 
  for (int i = 0; i < xpos.length; i++)
  {
noStroke();
fill(255-i*5);
ellipse(xpos[i],ypos[i],i,i);
  }
 
}

void mouseMoved()
{
  float freq = map(mouseY,0,height,1500,60);
  sine.setFreq(freq);
  float pan = map(mouseX,0,width,-1,1);
  sine.setPan(pan);
}

void stop()
{
  out.close();
  minim.stop();
  super.stop();
}




Magical Colour with Sound

import ddf.minim.*;
import ddf.minim.signals.*;
float freq,pan;

Minim minim;
AudioOutput out;
SineWave sine;



int[] xpos = new int [50];
int[] ypos = new int[50];


void setup()

{
  size(500,500);
  frameRate(25);
  smooth();
  for (int i = 0; i < xpos.length; i++)
  {
    xpos[i] = 0;
    ypos[i] = 0;
  }
 
  minim = new Minim(this);
  out = minim.getLineOut(Minim.STEREO);
  sine = new SineWave(440, 0.5, out.sampleRate());
  sine.portamento(200);
  out.addSignal(sine);
 
 
}

void draw()
{
  background(255);
  for (int i = 0;i <xpos.length-1; i++)
 
  {
    xpos[i] = xpos[i+1];
    ypos[i] = ypos[i+1];
  }
  
  xpos[xpos.length-1] = mouseX;
  ypos[ypos.length-1]= mouseY;
 
  for (int i = 0; i < xpos.length; i++)
  {
   
noStroke();
fill (map(freq,1500,60,0,255),map(pan,-1,1,0,255),freq/25*4);
ellipse(xpos[i],ypos[i],i,i);
  }
 
 
}

void mouseMoved()
{
  freq = map(mouseY,0,height,1500,60);
  sine.setFreq(freq);
  pan = map(mouseX,0,width,-1,1);
  sine.setPan(pan);
 
 
 
 
 
}

void stop()
{
  out.close();
  minim.stop();
  super.stop();
}




Font Randomiser

PFont f;


void setup()
{
size(200,200);
frameRate(5);
f=loadFont("DialogInput-48.vlw");
}


void draw()
{
float x=random(width);
float y=random(height);
background(255);
textFont(f,20);
fill(0);
text("HELLOOOOO",x,y);
}



RSS FEED


import processing.xml.*;

XMLElement xml;
XMLElement[] title;
XMLElement[] pubDate;
XMLElement[] value;



void setup()

{
  size(500,500);

  String url = "http://rss.news.yahoo.com/rss/topstories";
  XMLElement xml = new XMLElement(this,url);

  title = xml.getChildren("channel/item/title");
  pubDate = xml.getChildren("channel/item/pubDate");
  value = xml.getChildren("channel/item/description");
}

void draw()

{
for (int i =0; i<title.length; i++)

    println(title[i].getContent());
}



RSS Feed Illustrated



import processing.xml.*;

XMLElement xml;
XMLElement[] title;
XMLElement[] pubDate;
XMLElement[] value;



void setup()

{
  size(500,500);

  String url = "http://rss.news.yahoo.com/rss/topstories";
  XMLElement xml = new XMLElement(this,url);

  title = xml.getChildren("channel/item/title");
  pubDate = xml.getChildren("channel/item/pubDate");
  value = xml.getChildren("channel/item/description");
}

void draw()

{
for (int i =0; i<title.length; i++){

    float num1 = int(title[i].getContent().charAt(0));
      float num2=int(title[i].getContent().charAt(2));
            float num3=int(title[i].getContent().charAt(4));
             float num4=int(title[i].getContent().charAt(6));
       ellipse (num1,num2,num3,num4);
}
}


No comments:

Post a Comment