All posts by Ieva Urbaite

Computational Media and Storytelling

For my Gallatin Colloquium, I’ve been reading a lot of books that warn against the dangers of casually incorporating technology into every aspect of our lives. Two of the books include Amusing Ourselves to Death  by Neil Postman and Alone Together: Why We Expect More from Technology and Less from Each Other by Sherry Turkle. In both texts, the authors argue that we are continuously shirking our social responsibilities by hiding behind technology.

I would argue, however, that from the perspective of someone tinkering with computational media, the opposite may be true. While no one can debate  the existence of a strong community of nerds who hide behind their computers online, I’ve found my experience with computational media, especially physical computing, to be much more engaging than the casual online chat. With physical computing, we are taking abstract ideas and bringing them to the material world. The data collected comes from human interaction in the real world and can potentially create some sort of disturbance in the physical world as well.

From my experience, while the end-result of a computational media project may be a simple game or a horrible animation, the behind-the-scenes work is what is truly fascinating. Now computers and arduinos can be ordered online for a small cost instead of found only in the bowels of MIT. People like myself, who have virtually no coding experience, can learn to think in new ways and process information to create art. We can work with people from completely foreign fields and create something harmonious. This accessibility is totally mind blowing to me because it is creating new forms of communication for people who would normally stick with more traditional storytelling media like music, writing, or film.

Ieva and Emily: Cat Detectives (in training)

import ddf.minim.*;
//import twitter4j-4.0.1.*;
//import twitter4j.api.*;
//import java.util.*;

//audio
AudioPlayer player;
Minim minim;

PImage backimage;
PImage sloth;
PImage catFace;

//Query query;
//Twitter twitter;

void setup() {  

  //Set the size of the stage, and the background to black.
  size(700, 700);
  backimage = loadImage("compcat.jpg");
  sloth = loadImage ("slothallday.jpg");
  catFace = loadImage ("buny_cat.jpg");
  smooth();

 ConfigurationBuilder cb = new ConfigurationBuilder();
 cb.setOAuthConsumerKey("EKTjLWa6EOFXhfthNTP8A");
 cb.setOAuthConsumerSecret("ZTsfvECqYSLF57E3mRLTLm3zevUzLIjEateUSSfPU");
cb.setOAuthAccessToken("329517248-TDTpfMwx6fn1n6O6VpIzmdqpcugbVfJGluNau8Xv");
  cb.setOAuthAccessTokenSecret("DzfsSJmkK1WcqmYAAa2XPoAgaIY8A3H84puznWyeLBrHV");

  //initialize minim
  minim = new Minim(this);
  player = minim.loadFile("catcat.mp3");
  player.play();

  //Make the twitter object and prepare the query
 Twitter twitter = new TwitterFactory(cb.build()).getInstance();
 Query query = new Query("#cat");
 query.setCount(100);

 //Try making the query request.
 try {
 QueryResult result = twitter.search(query);
 List tweets = result.getTweets();

 for (int i = 0; i < tweets.size(); i++) {
 Tweet t = (Tweet) tweets.get(i);
 String user = t.getFromUser();
 String msg = t.getText();
 Date d = t.getCreatedAt();
 println("Tweet by " + user + " at " + d + ": " + msg);

 //Break the tweet into words
 String[] input = msg.split(" ");
 for (int j = 0;  j < input.length; j++) {
 //Put each word into the words ArrayList
 words.add(input[j]);
 }
 };
 }
 catch (TwitterException te) {
 println("Couldn't connect: " + te);
 };
 }

void draw() {
  background(backimage);

  //Draw a word from the list of words that we've built
  //int i = (frameCount % words.size());
  // String word = words.get(i);

  // Put it somewhere random on the stage, with a random size and colour
  fill(255, random(50, 150));
  textSize(random(10, 30));
  //  text(word, random(width), random(height));

  //ieva's dumb people code thinking

 // if tweet contains word cat {
 //   draw (catFace);
 // }

 // if tweet does not contain word cat{
//  background (sloth);
  //}

}

 

This party is so not happening

I tried to use face detect to control the paddle in the Zoolander game. I got stuck  🙁

import processing.video.*;
// Import the library
import gab.opencv.*;

//audio
import ddf.minim.*;
AudioPlayer player;
Minim minim;

//declare variables
PImage bgdimg;
PImage mugatu;
PImage primeMini;
float circleA = 100;
float circleB = 50;
float speedA = 5;
float speedB = 2;
int new_x;
int xpos;
int points = 0;
int miss = 0;

// Library object
OpenCV opencv;

// Capture object
Capture cam;

// Array of faces found
Rectangle[] faces;

void setup() {
  size(595, 325, P2D);
  bgdimg = loadImage("magnum.jpg");
  mugatu = loadImage("mugatu.png");
  primeMini = loadImage("prime_minister.jpg");
  smooth();

  //insert video stuff here
  // Start capturing
  cam = new Capture(this, 320, 240);
  cam.start();

  // Create the OpenCV object
  opencv = new OpenCV(this, cam.width, cam.height);

  // Which "cascade" are we going to use?
  opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);  
  //opencv.loadCascade(OpenCV.CASCADE_EYE);  
  //opencv.loadCascade(OpenCV.CASCADE_NOSE);

  //initialize minim
  minim = new Minim(this);
  player = minim.loadFile("Relax.mp3", 2048);
  player.play();
}
// New images from camera
void captureEvent(Capture cam) {
  cam.read();
}
void draw() {
  float paddle = 1000 / (points + 10);
  background (bgdimg);
  opencv.loadImage(cam);
  // Detect the faces
  faces = opencv.detect();

  //figure out what to do here
  // If we find faces, draw them!
  if (faces != null) {
    for (int i = 0; i < faces.length; i++) {
      //strokeWeight(2);
      //stroke(255,0,0);
      //noFill();
      rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
    }

    // ye olde paddle stuff
    if (circleA < 0 || circleA > width)
      speedA = -speedA;
    if (circleB > height) {
      speedB = -speedB;
      float distance = abs(faces[i].x - circleA);
      if (distance < paddle)
        points += 1;
      else miss += 1;
    }
    else
      speedB += 1; 

    circleA = circleA + speedA;
    circleB = circleB + speedB;

    rect(xpos-paddle, height-10, 100, 125);
    fill(225, 10, 50);
    image(mugatu, circleA, circleB);

    if (miss > 5 && miss < 15) {
      textSize(18);
      text("KILL THE MALAYSIAN PRIME MINISTER!", width/4, height/2);
    }
    if (miss > 20) {
      textSize(18);
      fill (0);
      text("YOU'VE LOST", width/2, height/2);
      background(primeMini);
    }
  }
}

 

KILLING THE MALAYSIAN PRIME MINISTER != GOOD

You’re Derek Zoolander and you’ve got some decisions to make.

//the port stuff
import processing.serial.*;
Serial myPort;
//int new_x;

//audio
import ddf.minim.*;
AudioPlayer player;
Minim minim;

//declare variables
PImage bgdimg;
PImage mugatu;
PImage primeMini;
float circleA = 100;
float circleB = 50;
float speedA = 5;
float speedB = 2;
int new_x;
int xpos;
int points = 0;
int miss = 0;

void setup() {
  size(595, 325);
  bgdimg = loadImage("magnum.jpg");
  mugatu = loadImage("mugatu.png");
  primeMini = loadImage("prime_minister.jpg");
  smooth();

  //arduino stuff
 printArray(Serial.list());
 String portName = Serial.list()[13];
 myPort = new Serial(this, "/dev/tty.usbmodemfd131", 9600);
myPort.readStringUntil('\n');  //clean out anything already in the buffer
   new_x = 0;

//initialize minim
  minim = new Minim(this);
  player = minim.loadFile("Relax.mp3", 2048);
  player.play();
}

void draw() {
  float paddle = 1000 / (points + 10);
  background (bgdimg);
  if (circleA < 0 || circleA > width)
    speedA = -speedA;
  if (circleB > height) {
    speedB = -speedB;
    float distance = abs(mouseX - circleA);
    if (distance < paddle)
      points += 1;
    else miss += 1;
  }
  else
    speedB += 1; 

  circleA = circleA + speedA;
  circleB = circleB + speedB;

  rect(xpos-paddle, height-10, 100, 125);
  fill(225,10,50);
  image(mugatu, circleA, circleB);

   if(miss > 5 && miss < 15){
    textSize(18);
    text("KILL THE MALAYSIAN PRIME MINISTER!", width/4, height/2);
   }
   if (miss > 20){
     textSize(18);
     fill (0);
     text("YOU'VE LOST", width/2, height/2);
     background(primeMini);
   }
}

void serialEvent(Serial _port) { //this is a callback function
if(myPort == null)return;
    String input = myPort.readStringUntil('\n');
    if (input != null) {  //if a '\n' character has in fact now arrived
      input = input.trim();  //Take off the '\n' character
    new_x = (int)map(xpos,50,378,0,325);
      xpos = int(input);  //Turn it into number 
      println(xpos);
    }}

 

Risky Business (Take a Chance on Cheese)

This time around I used an array to make many cheeses and added a nasty carpet in the background. And the little mouse is in there, too!

I tried to see how I could get the cheese to identify when it was clicked, but couldn’t figure it out. Ideally, as the mouse eats the cheese, the cheese would disappear.

Cheese Array Files

Video: https://www.youtube.com/watch?v=6P6JnybsEE4&feature=youtu.be

//PART 1
PImage cat;
PImage lilmouse;

Cheese[] cheeses = new Cheese[50];   //declare an array of 50 cheeses 
float grav;
PImage bImgFor;
PImage bImgRev;
PImage bCarpet;
//PImage fGrass;

//PART 2
void setup() {
  size(720, 480);
  bImgFor = loadImage("cheese_icon.png");   //load cheese
  bCarpet = loadImage("bCarpet.JPG");   //load background
  cat = loadImage("cat_icon.png"); // load cat
  lilmouse = loadImage("mouse_icon.png"); //load mouse
  for (int i=0; i < cheeses.length; i++) {   //Loop to initialize each object in the array
    cheeses[i] = new Cheese();   
  }
}
//PART 3

  void draw() {
    image(bCarpet, 0, 0, width, height);  
    image( loadImage("mouse_icon.png"),mouseX,mouseY, 60,60);

    spinCat();
    for (int i=0; i < cheeses.length; i++) {   //Loop to display and move each object in the array
      cheeses[i].display();
      cheeses[i].move();
    }

  }

  /// CLASS CHEESE

  class Cheese {
  float x;
  float y;
  float w;
  float xSpeed;
  float ySpeed;
  PImage b;

  Cheese() {   //Constructor!
    x = random(20, 600);
    y = random(0, height/2);
    w = random(10, 100);
    xSpeed = 5;
    ySpeed = 0;
    b = bImgFor;
  }

  void display() {  //display cheeses
    if (x < 0) {
      b = bImgFor;
    }
    image(b, x, y, w, w);
  }

  void move() {   
    x = x + xSpeed;   
    y = y + ySpeed;   
    ySpeed = ySpeed+grav;   
    if (y > height-w) {  
      ySpeed = ySpeed * -0.95;
    }
    if (x > width-w) {
      xSpeed = xSpeed * -1;
    }
    if (x < 0) {
      xSpeed = xSpeed * -1;
    }
  }
}

void spinCat() {
  translate (width/2, height/2);
  rotate(frameCount / 100.0);
  for (int s=0; s<1; s++) {
    image (cat, 100 + s*10, 0, 200, 300);
  }}

 

 

Workin’ that cheese…

I want to eventually make a mouse have to catch the cheese and dodge the spinning cat.

VIDEO

PImage cheese;
PImage cat;

float siz = 30;
float posX = 20; 
float posY = 80;
float xspeed = 10; 
float yspeed = 6;

void setup(){
  size(900,600);
  cheese = loadImage("cheese_icon.png");
  cat = loadImage("cat_icon.png");

}

void draw(){
 // followMouse();
  mouseTime();
  spinCheese();

}

void mouseTime(){
  background(255,15,155);
  posX = posX + xspeed; 
  posY = posY + yspeed;

  if(posX > width ||posX < 0){
    xspeed = xspeed * -1;
  }
  if(posY > height ||posY < 0){
    yspeed = yspeed * -1;
  }

image(cheese, posX-40, posY-20);
}

void spinCheese(){
  translate (width/2, height/2);
  rotate(frameCount / 100.0);
  for (int s=0; s<1; s++) {
    image (cat, 100 + s*10, 0, 200, 300);

}
}

 

The Big Cheese

I made a really simple animation with a bouncing ball and the image of a mouse.  The mouse follows your computer mouse. I would have liked to have the ball disappear when the mouse goes over the cheese ball, but I wasn’t sure how to do that.

Screenshot 2014-03-03 12.27.08

mouse and cheese

float circleX;
float xspeed = 1;
void setup (){
  loadPixels ();
  size(1000,1000);
  circleX = 5;
}

void draw (){

background (255,15,155);
 fill (255,196,105);
 stroke (255);
   float h = random (0,1000);
 ellipse (circleX,h,200,200);

 image( loadImage("mouse_icon.png"),mouseX,mouseY);

  circleX = circleX + xspeed;

if (circleX > width || circleX < 0) {
    //turn around

 xspeed  = xspeed + -1.1;
}

}

 

 

Does Charlie Even CARE?!

For my stupid pet trick I decided to make a board that tested whether or not my cat was interested in sniffing the Arduino. To my surprise, the buzzing of the motor got her interested enough to try the setup out for herself!

Playing with Cardboard

Charlie gets in on the action

 

#include <Servo.h>    
Servo servoMotor;      
void setup(){
  Serial.begin(9600);
  pinMode(12,OUTPUT);

  servoMotor.attach(2);  
}

void loop()
{
  digitalWrite(12,HIGH);
  int analogValue = analogRead(A0); 
  Serial.println(analogValue);    

int servoAngle = map(analogValue, 15, 122, 0, 179);
Serial.println(servoAngle);

servoMotor.write(servoAngle);
}

 

Catman Strikes Again!

I made a simple circuit with two lightbulbs.

photo (12) photo 2

The green bulb blinks whenever the switch is not in use. The blue bulb is set off when a connection is made within the switch. In this scenario, Lil Elephant tries to warn Rubber Ducky about Catman with a secret message embedded in the blue bulb using really sloppy Morse Code. Can you guess what it is?

Catman Strikes Again

Code:

void setup(){
pinMode(7,OUTPUT);
pinMode(8,INPUT);
pinMode(3,OUTPUT);
}

void loop(){
if(digitalRead(8) == HIGH)
{
digitalWrite(3,HIGH);
delay(2000);
digitalWrite(3,LOW);
delay(300);
digitalWrite(3,HIGH);
delay(700);
digitalWrite(3,LOW);
delay(300);
digitalWrite(3,HIGH);
delay(2000);
digitalWrite(3,LOW);
delay(300);
digitalWrite(3,HIGH);
delay(700);
digitalWrite(3,LOW);
delay(300);
digitalWrite(3,HIGH);
delay(700);
digitalWrite(3,LOW);
delay(300);
digitalWrite(3,HIGH);
delay(2000);
digitalWrite(3,LOW);
delay(300);
digitalWrite(3,HIGH);
delay(2000);
digitalWrite(3,LOW);
delay(300);
}
else{
digitalWrite(7,HIGH);
delay(350);
digitalWrite(7,LOW);
delay(350);

}
}