FINAL PROJECT- MUSICAL MAP

IMG_7438For my final project, I had to last minute change the concept since my midi controller idea fell through and proved to be unfit for this assignment. My project now is a musical map that lets users play music from different regions of the world. I initially wanted to create a map of the globe but decided to consolidate my map into one continent. The continent I chose was South America (SA). South America resonated with me the most because of my love of Latin American music! I initially was going to take an image of the map from off of the internet but decided to design my own map of SA. This was designed in Adobe Illustrator.

I picked a total of 13 songs all from different parts of SA:

Brazil: Dindi – Sylvia Telles

Venezuela: Mi Corazon – Los Melodicos

Colombia: Tobaco y Ron – Rodolfo y su typica ra7

Ecuador: Escribeme – Tierra Canela

Suriname: Moi Misi – Sabokoe

Guyana: Catch me Lova – JMC

French Guiana: Kraze  Dj Action X Jaydieff

Peru: Peru de Valses: Y se llama Peru – Oscar Avilles

Chile: 1977 – Ana Tijoux

Argentina: Buenos Aires – Nathy Peluso

Paraguay: Inevitable – Shako El Sh

Uruguay: Cora Aislado – Bebe 21

Bolivia: Amor Segrado – Chila Jatun

 

USER TESTING:

MUSICAL MAP

Interaction Design:

Users simply can move the joystick, which acts as a cursor on the screen and press on the squares in the p5 sketch to trigger a unique sound file from each country.

Aesthetic Design:

I made my box out of cardboard and painted on several separate sheets of paper a similar color scheme to my digital design of the map. I then glued those pieces of paper onto the box!

P5 Code Sketch:

https://editor.p5js.org/dianadonatella/sketches/NDBhUIeWI

P5 Code:

let img; //variable for image

//variables for square buttons.
let Colombia;
let Argentina;
let Peru;
let Paraguay;
let Uruguay;
let Guyana;
let Fguiana;
let Venezuela;
let Brazil;
let Bolivia;
let Ecuador;
let Chile;
let Suriname;

//colors for each country's buttons
let color_state_col;
let color_state_ven;
let color_state_arg;
let color_state_bra;
let color_state_bol;
let color_state_per;
let color_state_guy;
let color_state_par;
let color_state_uru;
let color_state_chi;
let color_state_fgu;
let color_state_sur;
let color_state_ecu;

//PLAYING AND PAUSING states
let isColombiaPlaying = false;
let isVenezuelaPlaying = false;
let isArgentinaPlaying = false;
let isBrazilPlaying = false;
let isBoliviaPlaying = false;
let isPeruPlaying = false;
let isGuyanaPlaying = false;
let isParaguayPlaying = false;
let isUruguayPlaying = false;
let isChilePlaying = false;
let isFguianaPlaying = false;
let isSurinamePlaying = false;
let isEcuadorPlaying = false;

//ORIGINAL BUTTON COLORS
let originalColorCol;
let originalColorVen;
let originalColorArg;
let originalColorBra;
let originalColorBol;
let originalColorPer;
let originalColorGuy;
let originalColorPar;
let originalColorUru;
let originalColorChi;
let originalColorFgu;
let originalColorSur;
let originalColorEcu;

//For joystick
let joystick_X;
let joystick_Y;
let joystick_button;
let circleX;
let circleY;

//Only update when Joystick is pressed, making it equal to the time that the joystick was pressed at
let LastTime = 0;
// Always updated with the latest number of Millis
let CurrentTime = 0;

function success(e) {
  console.log("works: ", e);
}

function error(e) {
  console.log("oopsie: ", e);
}

function loading(e) {
  log("loading", e);
}


function preload() {
  img = loadImage("SA_MAP.png");
  Colombia = loadSound("./COLOMBIA.mp3", success, error, loading);
  Argentina = loadSound("./ARGENTINA.mp3");
  Peru = loadSound("./PERU.mp3");
  Paraguay = loadSound("./PARAGUAY.mp3");
  Uruguay = loadSound("./URUGUAY.mp3");
  Guyana = loadSound("./GUYANA.mp3");
  Fguiana = loadSound("./FGUIANA.mp3");
  Venezuela = loadSound("./VENEZUELA.mp3");
  Brazil = loadSound("./BRAZIL.mp3");
  Bolivia = loadSound("./BOLIVIA.mp3");
  Ecuador = loadSound("./ECUADOR.mp3");
  Chile = loadSound("./CHILE.mp3");
  Suriname = loadSound("./SURINAME.mp3");
}

function setup() {
  createCanvas(1920, 1020);
  background(220);
  //   colors for each button
  color_state_col = color(32, 37, 179);
  color_state_ven = color(35, 60, 98);
  color_state_arg = color(32, 37, 179);
  color_state_bra = color(100, 57, 79);
  color_state_bol = color(35, 60, 98);
  color_state_per = color(32, 37, 179);
  color_state_guy = color(35, 60, 98);
  color_state_par = color(24, 32, 89);
  color_state_uru = color(24, 32, 89);
  color_state_chi = color(100, 57, 79);
  color_state_fgu = color(24, 32, 89);
  color_state_sur = color(32, 37, 179);
  color_state_ecu = color(24, 32, 89);

  //original state colors after pausing
  originalColorCol = color_state_col;
  originalColorVen = color_state_ven;
  originalColorArg = color_state_arg;
  originalColorBra = color_state_bra;
  originalColorBol = color_state_bol;
  originalColorPer = color_state_per;
  originalColorGuy = color_state_guy;
  originalColorPar = color_state_par;
  originalColorUru = color_state_uru;
  originalColorChi = color_state_chi;
  originalColorFgu = color_state_fgu;
  originalColorSur = color_state_sur;
  originalColorEcu = color_state_ecu;

  circleX = width / 2;
  circleY = height / 2;
}

function draw() {
  if (img) {
    image(img, 0, 0, width, height);
  }
  
//references colors and sets sizes for each square 
  //COLOMBIA
  fill(color_state_col);
  rect(790, 135, 40, 40);

  //VENEZUELA
  fill(color_state_ven);
  rect(910, 80, 35, 35);

  //ARGENTINA
  fill(color_state_arg);
  rect(940, 700, 50, 50);

  //BRAZIL
  fill(color_state_bra);
  rect(1150, 400, 50, 50);

  //BOLIVIA
  fill(color_state_bol);
  rect(935, 435, 40, 40);

  //PERU
  fill(color_state_per);
  rect(800, 360, 40, 40);

  //GUYANA
  fill(color_state_guy);
  rect(1038, 125, 23, 23);

  //PARAGUAY
  fill(color_state_par);
  rect(1012, 490, 30, 30);

  //URUGUAY
  fill(color_state_uru);
  rect(1120, 700, 30, 30);

  //CHILE
  fill(color_state_chi);
  rect(800, 600, 40, 40);

  //FGUIANA
  fill(color_state_fgu);
  rect(1170, 90, 30, 30);

  //SURINAME
  fill(color_state_sur);
  rect(1090, 58, 25, 25);

  //ECUADOR
  fill(color_state_ecu);
  rect(650, 200, 30, 30);
  
  //increments joystick in the X or Y position

  if (joystick_X > 800) {
    circleX += 5;
  }
  if (joystick_X < 200) {
    circleX -= 5;
  }

  if (joystick_Y > 800) {
    circleY -= 5;
  }
  if (joystick_Y < 200) {
    circleY += 5;
  }
  
  //cursor shape and design
  
  fill(0, 0, 0, 100);
  circle(circleX, circleY, 30);
  stroke(255);
  line(circleX, circleY + 30, circleX, circleY - 30);
  line(circleX - 30, circleY, circleX + 30, circleY);
  JoyStickPressed();
  if (!serialActive) {
    text("Press Space Bar to select Serial Port", 20, 30);
  } else {
    text("Connected", 20, 30);
  }

  console.log(circleX);
}
// to check when joystick is pressed and to play or pause the song playing for a specific country

function JoyStickPressed() {


  //Updating current time
  CurrentTime = millis();
  if (joystick_button == 1 && CurrentTime > LastTime + 2000) {
    // Check if the joystick is within the Colombia button
    if (
      circleX > 790 &&
      circleX < 790 + 40 &&
      circleY > 135 &&
      circleY < 135 + 40
    ) {
      if (!isColombiaPlaying) {
        Colombia.play();
      } else {
        Colombia.pause();
      }
      isColombiaPlaying = !isColombiaPlaying;
      color_state_col = isColombiaPlaying ? color(255) : originalColorCol;
    }

    if (
      circleX > 910 &&
      circleX < 910 + 35 &&
      circleY > 80 &&
      circleY < 80 + 35
    ) {
      if (!isVenezuelaPlaying) {
        Venezuela.play();
      } else {
        Venezuela.pause();
      }
      isVenezuelaPlaying = !isVenezuelaPlaying;
      color_state_ven = isVenezuelaPlaying ? color(255) : originalColorVen;
    }

    if (
      circleX > 940 &&
      circleX < 940 + 50 &&
      circleY > 700 &&
      circleY < 700 + 50
    ) {
      if (!isArgentinaPlaying) {
        Argentina.play();
      } else {
        Argentina.pause();
      }
      isArgentinaPlaying = !isArgentinaPlaying;
      color_state_arg = isArgentinaPlaying ? color(255) : originalColorArg;
    }

    if (
      circleX > 1150 &&
      circleX < 1150 + 50 &&
      circleY > 400 &&
      circleY < 400 + 50
    ) {
      if (!isBrazilPlaying) {
        Brazil.play();
      } else {
        Brazil.pause();
      }
      isBrazilPlaying = !isBrazilPlaying;
      color_state_bra = isBrazilPlaying ? color(255) : originalColorBra;
    }

    if (
      circleX > 935 &&
      circleX < 935 + 40 &&
      circleY > 435 &&
      circleY < 435 + 40
    ) {
      if (!isBoliviaPlaying) {
        Bolivia.play();
      } else {
        Bolivia.pause();
      }
      isBoliviaPlaying = !isBoliviaPlaying;
      color_state_bol = isBoliviaPlaying ? color(255) : originalColorBol;
    }

    if (
      circleX > 800 &&
      circleX < 800 + 40 &&
      circleY > 360 &&
      circleY < 360 + 40
    ) {
      if (!isPeruPlaying) {
        Peru.play();
      } else {
        Peru.pause();
      }
      isPeruPlaying = !isPeruPlaying;
      color_state_per = isPeruPlaying ? color(255) : originalColorPer;
    }
    if (
      circleX > 1038 &&
      circleX < 1038 + 23 &&
      circleY > 125 &&
      circleY < 125 + 23
    ) {
      if (!isGuyanaPlaying) {
        Guyana.play();
      } else {
        Guyana.pause();
      }
      isGuyanaPlaying = !isGuyanaPlaying;
      color_state_guy = isGuyanaPlaying ? color(255) : originalColorGuy;
    }

    if (
      circleX > 1012 &&
      circleX < 1012 + 30 &&
      circleY > 490 &&
      circleY < 490 + 30
    ) {
      if (!isParaguayPlaying) {
        Paraguay.play();
      } else {
        Paraguay.pause();
      }
      isParaguayPlaying = !isParaguayPlaying;
      color_state_par = isParaguayPlaying ? color(255) : originalColorPar;
    }

    if (
      circleX > 1120 &&
      circleX < 1120 + 30 &&
      circleY > 700 &&
      circleY < 700 + 30
    ) {
      if (!isUruguayPlaying) {
        Uruguay.play();
      } else {
        Uruguay.pause();
      }
      isUruguayPlaying = !isUruguayPlaying;
      color_state_uru = isUruguayPlaying ? color(255) : originalColorUru;
    }

    if (
      circleX > 800 &&
      circleX < 800 + 40 &&
      circleY > 600 &&
      circleY < 600 + 40
    ) {
      if (!isChilePlaying) {
        Chile.play();
      } else {
        Chile.pause();
      }
      isChilePlaying = !isChilePlaying;
      color_state_chi = isChilePlaying ? color(255) : originalColorChi;
    }

    if (
      circleX > 1170 &&
      circleX < 1170 + 30 &&
      circleY > 90 &&
      circleY < 90 + 30
    ) {
      if (!isFguianaPlaying) {
        Fguiana.play();
      } else {
        Fguiana.pause();
      }
      isFguianaPlaying = !isFguianaPlaying;
      color_state_fgu = isFguianaPlaying ? color(255) : originalColorFgu;
    }

    if (
      circleX > 1090 &&
      circleX < 1090 + 25 &&
      circleY > 58 &&
      circleY < 58 + 25
    ) {
      if (!isSurinamePlaying) {
        Suriname.play();
      } else {
        Suriname.pause();
      }
      isSurinamePlaying = !isSurinamePlaying;
      color_state_sur = isSurinamePlaying ? color(255) : originalColorSur;
    }

    if (
      circleX > 650 &&
      circleX < 650 + 30 &&
      circleY > 200 &&
      circleY < 200 + 30
    ) {
      if (!isEcuadorPlaying) {
        Ecuador.play();
      } else {
        Ecuador.pause();
      }
      isEcuadorPlaying = !isEcuadorPlaying;
      color_state_ecu = isEcuadorPlaying ? color(255) : originalColorEcu;
    }
    LastTime = millis();
  }
}

function keyPressed() {
  if (key == " ") {
    // important to have in order to start the serial connection!!
    setUpSerial();
  }
}


//TO SET UP SERIAL CONNECTION
function readSerial(data) {
  ////////////////////////////////////
  //READ FROM ARDUINO HERE
  ////////////////////////////////////

  if (data != null) {
    // make sure there is actually a message
    // split the message
    let fromArduino = split(trim(data), ",");
    // if the right length, then proceed
    if (fromArduino.length == 3) {
      // only store values here
      // do everything with those values in the main draw loop

      // We take the string we get from Arduino and explicitly
      // convert it to a number by using int()
      // e.g. "103" becomes 103
      joystick_X = int(fromArduino[0]);
      joystick_Y = int(fromArduino[1]);
      joystick_button = int(fromArduino[2]);
    }
  }
}

Arduino Code:

int xValue = 0 ;
int yValue = 0 ; 
int bValue = 0 ;

void setup()	
{	
    Serial.begin(9600) ;
    pinMode(8,INPUT); 
    digitalWrite(8,HIGH);	
}	

void loop()	
{	
    xValue = analogRead(A2);	
    yValue = analogRead(A1);	
    bValue = digitalRead(8);	
    Serial.print(xValue,DEC);
    Serial.print(",");
    Serial.print(yValue,DEC);
    Serial.print(",");
    Serial.println(!bValue);

    delay(10);	
}

Schematic:

 

CHALLENGES:

I initially had quite a few issues in p5 trying to upload the song files. I realized that it was because I placed all the songs in a folder and P5 couldn’t find the path to that folder. I also had issues with organizing the square buttons on the screen, as well as cuing and pausing the music in combination with the joystick!

Improvements:

I would really like to make my p5 sketch a bit more elaborate and maybe add some sort of extra LED aspect to my arduino to make things a bit more exciting!

 

VIDEOS FROM THE SHOWCASE:

IMG_7438

IMG_7445

The showcase was incredibly fun and I really loved seeing everyone’s projects. I am very excited for building more fun projects in the future!!

 

Alien Intelligence w/Professor Leach

 

I was so happy to attend Professor Leach’s talk about AI! The conversation of AI has recently come up in a discussion with some of my peers and it reminded me of a few of the topics that were discussed in Professor Leach’s talk. In conversation, we were discussing the role of AI in the arts and how AI can be quite harmful to artists, at least that’s what I believe. My friends disagreed (quite loudly if I may add) and maintained the stance that AI will never be able to create art in the same way a human can. They went on to say that you simply can’t program creativity, so AI would be unlikely to replace human artists.

Here are my thoughts.

As an artist myself, I feel that we are entering a very tricky time. For me, it isn’t about my art vs the AI-generated art. It’s more so these questions: Will people be able to tell the difference or care who made the art? Will art become devalued and seen as something that can be simply generated by AI? Why would you pay for artists and their work when you can recreate their work or make something even more artificially “perfect” with AI?

These questions have yet to be answered and are quite difficult to answer. I wonder what the future will look like for artists who ultimately will have to compete with not only other artists like themselves, but AI as well.

 

FINAL PROJECT PROPOSAL

For my final project, I wanted to do something that was related to sound since I have a great interest in all things music/sound-related. After much research and contemplation, I decided to recreate one of the most important tools in my line of work, a midi controller. I use my MIDI controller for all of my musical creations because it is not only convenient but works incredibly well with my DAWs (digital audio workstations). The primary instrument that I use in many of my pieces is the synthesizer. This instrument inspires so many of my songs and allows me to manipulate sound in ways I could have never imagined. 

For this project, I will be taking inspiration from this tutorial ( https://www.youtube.com/watch?v=cHiTPoNCv1w ) and recreating my own controller. I hope to have quite a few buttons that will mimic a synthesizer and also add some sound effects for percussion (like a drum kit). I have yet to figure out how I want to implement p5 in all of this but I am thinking of trying to create a sound visualization in p5 that will maybe move whenever a button in Arduino is pressed. 

 

Here is the sample code for the Arduino portion of my project.

#include <Control_Surface.h> // Include the Control Surface library

// Instantiate a MIDI over USB interface.
USBMIDI_Interface midi;

// Instantiate a NoteButton object
NoteButton button {
  5,                             // Push button on pin 5
  {MIDI_Notes::C(4), Channel_1}, // Note C4 on MIDI channel 1
};

void setup() {
  Control_Surface.begin(); // Initialize Control Surface
}

void loop() {
  Control_Surface.loop(); // Update the Control Surface
}

These are the two sound libraries that I needed to download for this code to make a bit more sense.

https://github.com/arduino-libraries/MIDIUSB

https://tttapa.github.io/Control-Surface-doc/Doxygen/index.html

I attempted to draw the basic circuit 😔

WEEK 11 EXERCISES W/PIERRE

Exercise 1

IMG_7102

let rVal = 0;
let potentiometerInput = 0;
let circleX;


function setup() {
  createCanvas(640, 480);
  textSize(18);
  circleX = width/2;
}

function draw() {
  // one value from Arduino controls the background's red color
  background(255);

  // the other value controls the text's transparency value

  if (!serialActive) {
    text("Press Space Bar to select Serial Port", 20, 30);
  } else {
    text("Connected", 20, 30);
    

    // Print the current values
    text('potentiometerInput = ' + str(potentiometerInput), 20, 70);

  }
  
  //Draws the circle 
  circle(circleX,height/2,100);
}

function keyPressed() {
  if (key == " ") {
    // important to have in order to start the serial connection!!
    setUpSerial();
  }
}

// This function will be called by the web-serial library
// with each new line of data. The serial library reads
// the data until the newline and then gives it to us through
// this callback function
function readSerial(data) {
  ////////////////////////////////////
  //READ FROM ARDUINO HERE
  ////////////////////////////////////

  if (data != null) {
    // make sure there is actually a message
    // split the message
    let fromArduino = split(trim(data), ",");

    // if the right length, then proceed
    if (fromArduino.length == 1) {
      // only store values here
      // do everything with those values in the main draw loop
      
      // We take the string we get from Arduino and explicitly
      // convert it to a number by using int()
      // e.g. "103" becomes 103
      
      
      potentiometerInput = int(fromArduino[0]);
      
      //Maps the potentiometer input value to the width of the canvas.
      circleX = map(potentiometerInput,0,1023,0,width);


      
    }
    let sendToArduino = "\n";
    writeSerial(sendToArduino);
    
  }
}

P5 ⬆️

void setup() {

  Serial.begin(9600);

  // start the handshake
  while (Serial.available() <= 0) {
    digitalWrite(LED_BUILTIN, HIGH); // on/blink while waiting for serial data
    Serial.println("0,0"); // send a starting message
    delay(300);            // wait 1/3 second
    digitalWrite(LED_BUILTIN, LOW);
    delay(50);
  }
}

void loop() {
  // wait for data from p5 before doing something
  while (Serial.available()) {
    digitalWrite(LED_BUILTIN, HIGH); // led on while receiving data
      
      delay(5);
       if (Serial.read() == '\n') {
      int potentiometer = analogRead(A1);
      delay(5);
      Serial.println(potentiometer);
      Serial.print(',');
      Serial.println(potentiometer);
       }
    }
      digitalWrite(LED_BUILTIN, LOW);
  }

Arduino ⬆️

Exercise 2

 ASSIGNMENT 2

while (Serial.available()) {
    Serial.println("0,0");
    digitalWrite(LED_BUILTIN, HIGH); // led on while receiving data
    int value = Serial.parseInt();
    int value2 = Serial.parseInt();
    if (Serial.read() == '\n') {
      analogWrite(ledPin, value);
      analogWrite(ledPin2, value2);
    }
  }

Arduino ⬆️

function readSerial(data) {
  if (data != null) {
    //////////////////////////////////
  //SEND TO ARDUINO HERE (handshake)
  //////////////////////////////////
  value = int(map(mouseY,0, height, 0, 255));
  value2 = int(map(mouseX,0, width, 0, 255));
  let led1 = value + "\n";
  let led2 = value2 + "\n";
  writeSerial(led1);
  writeSerial(led22);
  print(value);
  print(value2)
    
    
  }

p5 ⬆️

ASSIGNMENT 3

void loop() {
  // wait for data from p5 before doing something
  while (Serial.available()) {
    // led on while receiving data
    digitalWrite(LED_BUILTIN, HIGH); 
    // gets value from p5
    int value = Serial.parseInt();
    // led switch from p5 value input
    if (Serial.read() == '\n') {
      if (value == 1) {
        digitalWrite(ledPin, HIGH);
      }
      else {
        digitalWrite(ledPin, LOW);
      }
      
      // gets sensor value
      int sensor = analogRead(A0);
      delay(5);
      // sends sensor value to p5
      Serial.println(sensor);
    }
  }
  digitalWrite(LED_BUILTIN, LOW);
  
}

Arduino ⬆️

 

Final Project Proposal

For my final project, I would really love to incorporate something with sound and color (very similar to my midterm). I think maybe a cool idea would be composing a short piece of music, that would generate some sort of light show using leds. I could assign different colors to the notes, so that when the piece plays, the leds (the translucent ones) will generate different colors for the piece.

WEEK 11 RESPONSE

For this week’s reading, the author discusses design in relation to disabilities. He specially talks about how the fashion industry has changed the perception of certain disabilities, purely based off of the design choices made to enhance the appearance of certain medical items. He used glasses as an example, stating that eyeglasses were once considered humiliating and undesirable, but that since the fashion industry/brands discovered a method to produce trendy and cool eyewear, glasses are now considered fashionable and stylish. This is a great example of positive framing (no pun intended) of a disability through its design, which not only offers a product for those with disabilities, but also allows indivsisuals with disabilities to seamlessly blend into society without feeling “different” from everyone else. What can become concerning about the fashion industry and its role in making certain medical items “fashionable” is its economic influence on these  products. These fashionable items become more expensive and leave those who actually need these items unable to afford them. This is extremely concerning and it begs the question of whether emphasizing aesthetic in the process of manufacturing these products is a good idea. Personally, I believe that the (aesthetic) design part of these items is extremely necessary because it not only allows people with disabilities to feel more at ease in society, but it also enables them to feel good about themselves. Of course, there must be a fair balance between usability and appearance, but looking good also makes you feel good.

WEEK 10 Reflection

 

A Brief Rant on the Future of Interaction Design:

Main points

  • We take for granted the importance of touch and how much we rely on our hands. Touch is one of the, if not the most important sense out of all five of our senses. 
  • Interactivity shouldn’t be confined to the press of a finger, but rather engage our entire bodies. Only then will we be able to progress into an era of true interactivity.

Follow up article:

  • From what I could gather in the response article, the author was emphasizing the importance of further developing the technology already at our disposal. Technology cannot remain stagnant, it needs to develop and advance with us. 
  • Again the author highlights that we must NOT neglect our bodies, allowing ourselves to create a future of total immobility. We should engage all aspects of our being and ensure that we give ourselves the chance to experience true interactivity. 

Personally, I find myself extremely scared of our future. The author mentions the possibility of complete immobility in the future due to our lives becoming too heavily reliant on external technologies. To me this is so dystopian to even think about. I don’t want every aspect of my life to be consumed by technology. I want to feel HUMAN and be HUMAN.

WEEK 10 ASSIGNMENT (PIERRE & DIANA) PIANO/SYNTHESIZER

 

 

CONCEPT:

For this project, our goal was to craft a musical instrument within the constraints of limited resources available. Despite the restricted options, we brainstormed various concepts and ultimately settled on developing a hybrid piano/synthesizer. To accomplish this, we repurposed buttons as keys by integrating two types of sensors, analog and digital. Using a breadboard, we configured the keys and delved into the coding phase. Each button was programmed to generate distinct notes, connected to a borrowed speaker from the IM lab for clearer and better sound quality.

 

As we progressed with the initial setup, the need for an analog sensor arose. We incorporated a potentiometer, not to alter the current, but as a knob to modulate the notes produced by the four buttons. The potentiometer’s range was segmented into three sections, and within the programming loop, an ‘if-else’ construct acted akin to cases, adjusting the notes played in response to the potentiometer’s adjustments.

 

Code:
#include "pitches.h"


const int speaker = 12;


const int tone_G = 2;
const int tone_A = 3;
const int tone_B = 4;
const int tone_C = 5;
const int tone_D = 9;
const int tone_E = 10;
const int tone_F = 11;




int buttonState_G = 0;
int buttonState_A = 0;
int buttonState_B = 0;
int buttonState_C = 0;
int buttonState_D = 0;
int buttonState_E = 0;
int buttonState_F = 0;


int potPin = A0;
int potVal = 0;




void setup() {
 // iterate over the notes of the melody:
 pinMode(tone_G, INPUT);
 pinMode(tone_A, INPUT);
 pinMode(tone_B, INPUT);
 pinMode(tone_C, INPUT);
 pinMode(tone_D, INPUT);
 pinMode(tone_E, INPUT);
 pinMode(tone_F, INPUT);
 
 }


void loop() {
 // no need to repeat the melody.


 potVal = analogRead(potPin);




 buttonState_G = digitalRead(tone_G);
 buttonState_A = digitalRead(tone_A);
 buttonState_B = digitalRead(tone_B);
 buttonState_C = digitalRead(tone_C);
 buttonState_D = digitalRead(tone_D);
 buttonState_E = digitalRead(tone_E);
 buttonState_F = digitalRead(tone_F);


if (potVal < 341)  // Lowest third of the potentiometer's range (0-340)
 {   
 if (buttonState_G == HIGH) {
   // play the sound
   tone(speaker,NOTE_G4);
 }
 else if (buttonState_A == HIGH) {
   // play the sound
   tone(speaker,NOTE_AS4);
 }
 else if (buttonState_B == HIGH) {
   // play the sound
   tone(speaker,NOTE_F4);
 }
 else if (buttonState_C == HIGH) {
   // play the sound
   tone(speaker,NOTE_C3);
 }


 else
  {
   noTone(speaker);
   }
 }


 else if (potVal < 682)  // Lowest third of the potentiometer's range (0-340)
 {
   if (buttonState_G == HIGH) {
   // play the sound
   tone(speaker,NOTE_A4); //random note not matching the name
 }
 else if (buttonState_A == HIGH) {
   // play the sound
   tone(speaker,NOTE_B4); //random note not matching the name
 }
 else if (buttonState_B == HIGH) {
   // play the sound
   tone(speaker,NOTE_C4); //random note not matching the name
 }
 else if (buttonState_C == HIGH) {
   // play the sound
   tone(speaker,NOTE_D4); //random note not matching the name
 }


 else
  {
   noTone(speaker);
   }


 }


 else
 {
   if (buttonState_G == HIGH) {
   // play the sound
   tone(speaker,NOTE_AS4);
 }
 else if (buttonState_A == HIGH) {
   // play the sound
   tone(speaker,NOTE_FS4);
 }
 else if (buttonState_B == HIGH) {
   // play the sound
   tone(speaker,NOTE_GS4);
 }
 else if (buttonState_C == HIGH) {
   // play the sound
   tone(speaker,NOTE_CS3);
 }


 else
  {
   noTone(speaker);
   }
 }
  
 }




 

 

 

WEEK 9 RED LIGHT GREEN LIGHT

 

IMG_3777

Concept:

For this project, I wanted to re-create a stop light or intersection, where a “car” could be driving when the light is green and a pedestrian could press a button to turn the traffic light red, so that they could walk and cars could not drive forward. I really liked this concept, because it reminded of all the times I would be walking by an intersection and would attempt to press the button to turn the traffic light red and it would never work.  With this model, the light actually turn red to let the pedestrians cross.

FUN FACT: I made the car a Tesla, because I really like teslas.  (:

// Set pin names
// to keep track of what is connected to which pin, we set global variables that name each pin
// this also allows us to use these names in functions like "pinMode" & "digitalWrite" instead of the pin numbers. 
const int switch_Pin = 2;
const int lightSensor_Pin = A0;
const int LED_green = 13;
const int LED_red = 12;
void setup() {

  //Start the serial monitor
 Serial.begin(9600);
 //Set pin modes
 // The LED pins are OUTPUT pins because we are sending information to the LED instead of receiving information from it
 // the information we are sending is in the form of HIGH or LOW
 // this is an alternative to connecting the LED lights straight to the 5V pin, which constantly outputs 5 volts
 // with these pins being used as OUTPUTs we can control wether the LED is recieving power or not.
 pinMode(LED_green, OUTPUT);
 pinMode(LED_red, OUTPUT);

 // The switch pin is an INPUT pin because we are taking in information from the switch about whether it is ON or OFF.
 pinMode(switch_Pin,INPUT);
}

void loop() {
  // Set variables for the input from the light sensor & the switch
  
  // for the lightValue variable, we want it to be equal to the value coming from the light sensor
  // the data coming form the sensor is analog data so we use the "analogRead()" function and we give it the pin it's supposed to read from
  // here we give it the pin connected to the light sensor (A0)

   int lightValue = analogRead(lightSensor_Pin);

  // for the switchState variable, we want it to be equal to the value coming from the switch
  // the data coming form the switch is digital (either HIGH or LOW) so we use the "digitalRead()" function and we give it the pin it's supposed to read from
  // here we give it the pin connected to the switch (2)

   int switchState = digitalRead(switch_Pin);

   // Prints values from sensor in serial monitor
   // we use the "Serial.print()" function to send information serial monitor (open using bottom on top right) so that we can read it
   Serial.print("Analog reading: ");
   Serial.print(lightValue);
   // "\n" is a line break, makes the serial monitor start on a new line
   Serial.print("\n");

// If statement to check if there is something blocking the light from the light sensor & control the green LED accordingly
// if the value coming form the light sensor is less than 700,
   if (lightValue < 800) {
    // we use the "digitalWrite()" to send data to the green LED, in this case we send "HIGH" so that it turns on
    digitalWrite(LED_green,HIGH);
    // else ; if the light value is not less than 700
   } else {
    // we send a "LOW to the green LED so that it turns off"
    digitalWrite(LED_green,LOW);
   }
  
  // If statement to check if the switch is ON or OFF & controls the red LED light accordingly 
  if (switchState == HIGH){
    digitalWrite(LED_red,HIGH);
    digitalWrite(LED_green,LOW);
  } else if (switchState == LOW){
    digitalWrite(LED_red,LOW);
  }
  

}

 

 

 

 

 

 

 

WEEK 9 Reflection

“Making Interactive Art: Set the Stage, Then Shut Up and Listen”

In the reading, “Making Interactive Art: Set the Stage, Then Shut Up and Listen”, the author discusses the importance of allowing users to fully take charge of interactive artworks. The main points brought up were the following: 

  • Interactive artwork doesn’t need to have a clear statement. (Leave room for interpretation) 
  • Interactive artwork is meant to open a conversation not DIRECT the conversation. 
  • The audience should ideally complete the artwork by offering their emotional reactions, physical actions, and thoughts to the piece.

I think the PERFECT analogy that the author used was when they compared a director telling an actor on set how to feel or what to do when acting, to artists adding too much of their input into their interactive pieces.

I thought that that analogy wonderfully tied together what the author was trying to explain throughout the piece. I believe that artists have such a critical role in creating spaces that allow for important discussion and have the great responsibility of making sure these discussions are OPEN without being manipulated.

“Physical Computing’s Greatest Hits (and misses)”

For the reading, “Physical Computing’s Greatest Hits (and misses)”, the author goes over a wide range of different interactive artworks. For me this reading almost acted as a means for me to brainstorm some possibilities for projects in the future and gave me a sense of some of the things that are possible with physical computing. 

My favorite example was the piece called “Fields of Grass”. I really liked the idea of the user being able to use semi physical touch to activate music or light using sensors. I always enjoyed these types of interactive artworks when seeing them in person!