Thursday 26 May 2011

My IF / ELSE interpretation


An ‘IF/ELSE’ statement in computer coding is used like a road block, first it begins with an ‘IF’. Inside of the ‘IF’ statement will be a condition, and if it is true, then the computer will carry on in that direction. If it is false, then it can only move on to the ‘ELSE’ option. This means that if the first part wasn’t true, then everything else that follows will be completed by the ‘ELSE’ statement. You can have more than one ‘IF’ statement at a time, and any subsequent ‘IF’ statements are called ‘ELSE IF’. For example, Traffic lights; ‘IF’ you drive up and see a red light (the first condition) then you must stop. Or ‘ELSE IF’ you drive up and see an orange light (the second condition) then stop if you can. Anything ‘ELSE’ (green being the only option left) then continue driving. ‘IF/ELSE’ statements are used in coding the same way we use day to day rules.
The metaphor I chose for my model is that ‘IF/ELSE’ statements in coding relates to a buzzing wire game. The condition is, while the game is being played, ‘IF’ you do touch the long loop of wire the result is a buzzing sound and you must start again. If you don’t touch the wire (‘ELSE’) then you may carry on.

My Final Model for Project three


After being close to finishing I found a few things that needed to be fixed on my model. The little buzzer speaker that i had placed underneath wasn't making enough sound for my liking. To solve this I drilled another hole in the door at the base, and then put little metal feet to raise it of the table so that the sound may now travel better. Next I added some white electrical tape at each end of the wire maze. I had to add the tape because once you have finished playing with the model and put the handle down, there was still a connection. This meant the buzzer would still be active and the battery wouldn’t last very long.
I am glad to have changed my idea a few times as I headed through this project. And having a good time management plan has helped me also. It meant I could test, change, improve and evolve my project into something I feel suits my statement best. 

                                                   This is my Final Model

Final model progress

Having made a test model and getting good feedback from peers I started to make my final model. After my test model there were a few things I found needed to be changed. The first was I needed a way to hind or condense all the wires and connections but still have the LED visible. After a few sketch ideas I came up with having a hollow base to contain everything. The problems were to still have the wire connected to the handle and the also having the LED on the outside as well. I made a wooden base drilled and chiselled out the bottom and made a little door to hold all the contents. Then on the side I drilled a small hold in which I had the wire running out for the handle. The LED part wasn't working so I opted for a speaker which would buzz if connected.  Now everything was hidden away and much cleaner.

Friday 20 May 2011

New idea for project 3

After trying to get the tin foil idea working and having my map rip in half mid drawing, i started playing around with what i did have. This is what i have come up with.
It's a game where the user has to guide the wire loop from one end of the wire to the other. If at any stage the loop touches the wire it will complete the circuit and the LED will light up. I have already made a mock up model and tested it on 5 people with good results. I was told in the interim presentation to have something interesting that people will rermember. The model i made has been the flat center of attention all weekend so i guess i have covered that point. I am not to sure how my final model will look or wiether i will have more than one track to complete, i might add noise as well but will ask the tutors on that one.
This is a picture of the mock up model i made on the weekend.

Design problems

I have struck a big problem, the metal conducts fine and everything works as i expected, the problem is i can not have a map / paper on top of the metal sheet, as it stops all electrical current. I have thought of as many ways as i can to fix this problem or to have another solution. The only real posiblity would be to use tin foil as the metal conductor and also the paper, for example drawing a map on tin foil. I will take it all home with me this weekend and see what i can come up with.

Material problems

Having found some LEDs wire and battery connectors the last item i needed was a piece of sheet metal. That proved harder than i first thought, couldn't find anywhere within walking distance that sold any. The last resort was to as a plumbing world, luckly for me they had some scrap metal out the back which they very kindly cut in to a more managable size. The only bad thing was that the section they gave me was a bit to thick, this would mean i would have to drill out the shapes because the metal cutters couldn't cut  into it very well.

Finding Materials

I need to find were to get some LEDs, wire, battery connector and resistor, plus some wood for the box that will hold everything inside. I know i can get all of the above at either Dicksmith or Jaycar and the wood from Bunnings. The last item i need to start construction and the most important of them all, is a piece of sheet metal, preferably copper or very thin tin.  Im not too sure where im going to find the metal but will google it and ask around. Once i have located and brought all the materials i can start constucting as testing my design. With all going to plan i will have a test model before tuesday 24th next week.

Monday 16 May 2011

New idea for Project 3

Because my three storyboard ideas were not "interesting enough" i have scrapped all three and worked over the weekend on a new idea. Although not a completely new idea as it is based on my third design. The third design was a poster with a map of Wellington city. On top of the map was zones, green was the inside zone which repersented walking distance from the center point (the center point being this campus). the next larger zone was orange, repersenting biking distance. Red was used everywhere else to repersent driving.

My new idea was to make the design instead of a poster but rather a board, that the user could touch with the provided pen/pin at the location of intest. Eg; there house, location in town or another campus. The idea is that if they choose somewhere within walking distance then the map and board will light up green. To far to walk but within biking distance then the board will light up orange, and anywhere else will light up red, which means drive by car/bus.

Storyboard for Project 3

With having IF/ELSE as my chosen function i came up with these three ideas then layed them out on to a storyboard. After the presentation on friday i will hopefully have 1 of these as my final and can start working on the design a bit more.
 My Cost for the first and the last of these designs would be very minimum. Only needing a camera, time and maybe a helper. For the middle of the three ideas the cost would be a race track which could vary in cost, depending weither i am able to obtain one second hand or of trade me for cheap.

For my time management, i would like to have a finalised idea after tuesday 17th. After i have a final idea i can start to find any nessisary materials and work out my costs better. Hoping to have a mock up model/film/poster by friday the 20th. testing and working with the chosen idea and results to better my design. having the final completed by the 27th with that weekend to write up my 300 discribing words and finalise anything needed.

Monday 2 May 2011

Project three Ideas

I have choosen to go for the IF/ELSE statments. My first idea was to make a video of the traffic lights for people, for example if the lights are green then walk, else stop. But it will need to be a loop with if/else statments within it. An example would be. IF the lights are green walk and break the loop, ELSE IF the lights are blank stop then push button, ELSE stop reload loop.


The processing discription of  IF/ELSE:

IF;                                                                      ELSE;


Allows the program to make a decision about which code to execute. If the test evaluates to true, the statements enclosed within the block are executed and if the test evaluates to false the statements are not executed. Extends the if() structure allowing the program to choose between two or more block of code. It specifies a block of code to execute when the expression in if() is false.      



Sunday 1 May 2011

The final result

I have been unable to get any sound going on my project, which is not good at all. I am unable to look at other designs and understand how to add the sound. I have added the code underneth as i cant export it to openprocessing as it wont compile.

//////////////////////////////////
//// Project Two, DSDN 142    ////
//// George Bristow 300239542 ////
//////////////////////////////////

import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;

Minim minim;
//AudioSample move;
//SineWave sine;
//AudioOutput out;
List<Spring> springs = new ArrayList<Spring>();
Spring held = null;

void setup(){
  size(500,500);
  smooth();
 
  
  minim = new Minim(this);
  //move = minim.loadSample("Turkey Gobble.mp3");
 
//  // get a line out from Minim, default bufferSize is 1024, default sample rate is 44100, bit depth is 16
//  out = minim.getLineOut(Minim.STEREO);
//  // create a sine wave Oscillator, set to 440 Hz, at 0.5 amplitude, sample rate from line out
//  sine = new SineWave(440, 0.5, out.sampleRate());
//  // set the portamento speed on the oscillator to 200 milliseconds
//  sine.portamento(200);
//  // add the oscillator to the line out
//  out.addSignal(sine);

  for (int i = 1; i <= 3; ++i) {
    for (int j = 1; j <= 3; ++j) {
      springs.add(new Spring(width / 4 * i, height / 4 * j), "Turkey Gobble.mp3");
    }
  }
}



void draw(){
  background(255);
 

  //sound.trigger();


//   float freq = map(Spring.x, 0, height, 1500, 60);
//  sine.setFreq(freq);

  for (Spring spring : springs) {
    if (spring == held) {
      spring.moveTo(mouseX, mouseY).draw();
    } else {
      spring.move().draw();
    }
    if (spring.isMoving ()) {
    //move.trigger();
    move.play();
  
   
  }
//  else {
//   
//    move.rewind();
//  }
  }
 
}

 
void mousePressed(){
  // mouse pressed on a ball will let u drag it in any direction
  for (Spring spring : springs) {
    if (spring.mouseOver()) {
      held = spring;
      break;
    }
  }
}

void mouseReleased(){
  // will release the ball in the opersite direction that u have dragged it
  if (held != null) {
    held.release();
    held = null;
  }
}
////////////////////////////Tab two starts here///////////////////////////////
class Spring {

  private float
    x, y
  , vx, vy
  , ax, ay
  , size = 80
  , ls = 5;
 
  private final float springX, springY;

  private boolean
    released = false
  , left, above
  , vleft, vup;
 
  private AudioPlayer audio;

  public Spring(float x, float y, String audioName) {
    this.springX = x;
    this.springY = y;
    this.x = x;
    this.y = y;
    audio = minim.loadFile("audioName");
  }
 
  public Spring draw() {
    stroke(ls);
    strokeWeight(ls);
    line(springX,springY,x,y);
    fill(100,100,100);
    noStroke();
    ellipse(x, y, size, size);
    return this;
  }
 
  public Spring moveTo(int x, int y) {
    this.x = x;
    this.y = y;
    return this;
  }
 
  public Spring move() {
    vx += ax;
    vy += ay;
    x += vx;
    y += vy;

    if (vleft && vx >= 0 || !vleft && vx <= 0 ||
        vup && vy >= 0 || !vup && vy <= 0) {
      vflip();
      vleft = !vleft;
      vup = !vup;
    }
   
    if (left && x > springX || !left && x < springX ||
        above && y > springY || !above && y < springY) {
      flip();
      left = !left;
      above = !above;
    }
   
   
   
    return this;
  }
 
  /**
   * Calculates whether the mouse is over the spring or not.
   */
  public boolean mouseOver() {
    if (dist(x, y, mouseX, mouseY) > size / 2) {
      return false;
    }
    return true;
  }
 
  public void release() {
    vx = vy = 0;
    ax = (springX - x) / 60;
    ay = (springY - y) / 60;
    left = x < springX;
    above = y < springY;
    vleft = ax < 0;
    vup = ay < 0;
    released = true;
  }
 
  public void flip() {
    ax *= -1.2;
    ay *= -1.2;
   
    if (released && abs(ax) < 0.1 && abs(ay) < 0.1) {
      ax = ay = vx = vy = 0;
      x = springX;
      y = springY;
      released = false;
    }
  }
 
  public void vflip() {
    ax *= 0.75;
    ay *= 0.75;
  }
 
  boolean isMoving () {
    return (ax != 0 && ay != 0) ;
  }
 
}

Saturday 30 April 2011

Got some sound working

I have been able to get some sound working but nothing like i wanted. I can get a droning sound in the background that makes a higher, lower sound depending on where the mouse is positioned on the screen. The problem i have is to now put this sound into the balls instead of the mouse.

Trying to get sound working

Getting stuck with the sound part to the project. Im not to sure weither it should be in the original tab or in the second tab with the spring class. Will try both and see which one works or is more effective.

What i want for sound

This is for me a very hard process, i was away for the sound lecture or studio. I want to have when the user pulls on one of the balls it will spring like sound untill the ball has come to its resting place again. Each different ball will have a seperate sound depending on where they are positioned. Resulting in being able to make multipul sounds at the same time.

Monday 11 April 2011

Project Two re-designed

After starting my original idea of the balls exploding into smaller balls on impact with each other, i realised that there was far too little user interaction. The only user interation was making 'X' amount of balls and the direction they would start in. So i went back to my sketches and choose another, this was the idea of a spring type system where a ball would get thrown in a direction and then slowly return to the original position. The reason i didnt choose this sketch in the first place was due to me thinking it would be far to hard. But to have a good amount of user interation i realised it cannot be a simple code.
With help from tutors and googling 'processing tutorials' i made a ball and string program.
http://www.openprocessing.org/visuals/?visualID=26721

Then because of using an 'Array List' like demonstrated in the tutorial by Tim, i could make multiple ball springs in very little time and without having to change any code. ( Variables and Array Lists was a must for me as i learnt how important it was to use variables etc after the many hours i put into my Wallpapers in Project One.)
This is the same code but with multiple ball springs.
http://www.openprocessing.org/visuals/?visualID=26722

Then drawing a line from the two points i had already used in my code i could draw a line from the starting point to the ball no matter where its location was. Then with a little playing around i made the stroke weight more, size of the balls larger and changed the colours. This was my result.
http://www.openprocessing.org/visuals/?visualID=26723

This result i found was what i would use and add sound to. For the sound i thought i would have each of the balls be a different pitch or volume. With each ball movement will make a sound, at the pitch or volume it has been set to.

The results of the sound will be the next post.

Making patterns from multiple objects

Friday 1 April 2011

My project 2 interim designs/ideas

I wanted to use the idea of balls bouncing around and making different sounds as they hit either each other or the walls. With that in mind I created six quick sketches of my ideas, then chose three to draw and use as story board designs.


 
My inspiration came from the lecture video of the different balls being dropped and making sounds according to their size.
The top of the three pictures is what i will base my project two on. Given it had the recommendation from the tutors. It works by the user making as many balls as they like and can start their movement in any direction. The balls will then keep traveling in that direction until they hit a wall or another ball. If the balls collide then they will break/pop into two smaller balls each. The smaller the ball the higher the note, collisions also make their own sound. The user interaction is the ability make new balls and direct the balls.

Refection of project one


 Some of the things i have noticed now are that size makes a picture very different. While working on my design on the computer i wanted it to be as i saw it on the screen, but didn’t really consider the enlargement. I will defiantly have this in mind for future works.
Another thing I have taken on was the use of variables, as it would have made my project a lot easier. Harder at first but for the detail and any changes it would have made life easier. I will again take this on for future projects or assignments. A bit of work now means less work later.
Time management, this is something I need to work on for all my papers, projects and assignments.
I found that I had a lot more work than I originally thought. Luckily I didn’t have any clashes at the time but this has opened my eyes. Also if I needed help I had left it too late to ask.

Tuesday 22 March 2011