Mini Assignment 9

One sound that would be really helpful for our house is a certain song playing as a notification if all our garbage/recycling cans aren’t in their spots on our driveway at 5:30 PM on Wednesdays. This would be a great reminder to take them off the curb so we don’t get in trouble with Pittsburgh.

Another helpful sound inspired by Jet’s weather example is a tone that would be played as we are leaving the house if it’s late afternoon/ early evening and the temperature is supposed to drop by 10 or more degrees. This could be a useful reminder to get a(nother) jacket if you aren’t already prepared for the temperature change. This is more important with everyone spending so much time inside.

Finally, a last helpful sound I thought of is if a package is delivered to have the doorbell ring if the delivery person had not done so. It seems that this year it is up in the air whether there is a notification that a package has arrived.

 

Mini-assignment 9

What sounds would you add to your house to make it more accessible?

Some examples

  • your thermostat plays a song right before turning on the heat or air conditioning so you know you’ll need to turn up the volume on the TV.
  • the songs my water boiler, rice cooker, and clothes washer play when they are ready/done
  • a song my clothes dryer plays when the cycle is finished
  • weather forecast sounds using rain and thunder, but what about a sunny day or a day with snow?

Class notes, 27 Sep 2020

Genre conflation

This is a counter to sampling and using electronics to invent new music. Instruments from one style of music are used to perform a style of music from a completely unrelated genre. My favorite examples are “pirate metal” or the band Orkestra Obsolete playing famous pop music.

We’re skipping a lot of contemporary genres — things like EDM, IDM, dub, liquid trap, and future soul. There’s an entire class in this topic, but if you want to go on a genre-binge-fest then Ishkur’s Guide is one place to start: http://music.ishkur.com/

Physical interaction options

How to hide things in plain sight: https://www.youtube.com/watch?v=T61-twuvJA4

Bill Shannon, PGH native, who defies disability with dance performance:

 

and his tutorial on a dance form he developed:

Ways of making sound

Some examples of different ways people create sound

Foley artists creating the sounds of weather.

The Arduino guide to handling debounce on switches.

A mapping of western scale notes to frequencies.

The Sound Noise Device that uses cameras to create animation and sound.

It’s easy to create sounds without speakers:

Using things you already have at home

There’s a Japanese TV show for kids, “Pythagora Switch“, that features Rube-Goldberg like devices made with stuff you’d find around the house. These are so popular with adults that people go a little over the top making/recording their own devices still using common items.

Arduino data collection/processing tips

how to debounce a switch: https://www.arduino.cc/en/Tutorial/Debounce

standard deviations, arrays, and monitoring a variable source. flattening data with mean / median.

// -*-c++-*-
/*
  The MIT License (MIT)

  Copyright (c) 2019 Jet Townsend

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
*/

/* basic stats with analogRead()

   intputs
   A0 pot

   output
   D2 Speaker
   D13 LED

   40 NEOPIXEL

*/

#include <Adafruit_NeoPixel.h>

#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN            44
#define NUMPIXELS      1
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRBW + NEO_KHZ800);

static int plotter = 1;
static int console = !plotter;

static const int inPot = A0;
unsigned int potValue;

static const int sampleSize = 16;
int readings[sampleSize];
unsigned int sampleIndex = 0;
unsigned long lastSampleTime = 0;
unsigned long sampleInterval = 100; // in ms
// we need to move these out of the loop() as well
unsigned int median = 0;
unsigned int low = 1024;
unsigned int high = 0;
unsigned int mean = 0;

static const int statusLed = 13;
unsigned int lastRedVal = 0;
unsigned int analogMax = 1023;

void setup() {
  //analogWriteResolution(10); // Set analog out resolution to max, 10-bits
  analogReadResolution(12); // and read at 12 bits
  analogMax = 1023 * 4;

  Serial.begin(115200);

  pinMode(inPot, INPUT);

  pinMode(statusLed, OUTPUT);

  pixels.begin(); // This initializes the NeoPixel library.

}

void loop() {
  // TODO what happens if you try to set a negative color?
  unsigned int redVal = 0;

  // TODO
  // don't read the input on every loop to help stabilize the data
  // sampling over time is also a UI change, you have to actively
  // block light for
  // sampleSize * sampleInterval milliseconds to create a change

  unsigned long now = millis();
  if (lastSampleTime + sampleInterval < now) {
    lastSampleTime = now;
     potValue = analogRead(inPot);

    // good for debugging:
    //        Serial.print(now);
    //        Serial.print(" ");
    //        Serial.println(potValue);

    readings[sampleIndex] = potValue;
    sampleIndex < (sampleSize - 1) ? sampleIndex++ : sampleIndex = 0;

    digitalWrite(inPot, HIGH);
    for (int i = 0; i < sampleSize; i++) {
      mean += readings[i];
      if (readings[i] < low) {
        low = readings[i];
      }
      if (readings[i] > high) {
        high = readings[i];
      }
    }
    mean = mean / sampleSize;
    bubbleSort();
    median = readings[sampleSize / 2];
  }

  // set the pixels with different values, mean, median, current read

  // long map(long x, long in_min, long in_max, long out_min, long out_max)
  // in A10, the value of 600 was the bottom end
  // TODO use a flashlight to break this, more light == lower number
  // than 600
  redVal = map(median, 5, analogMax, 0, 255);

  //  at home, 950 was the bottom end. Remember that higher value == less light
  // how do we dynamically set the bottom end of the map?
  //    redVal = map(median, 950, analogMax, 0, 255);

  // what about changing the max value of redVal so we have a dimmer range?
  //    redVal = map(median, 600, analogMax, 0, 128);

  // TODO keep the pixel from blinking
  /*
    // simple, but allows for some blinking
      if (redVal != lastRedVal) {
          pixels.setPixelColor(0, pixels.Color(redVal,0,0));
          pixels.show(); // This sends the updated pixel color to the hardware.
          lastRedVal = redVal;
      }
  */


  // use a tolerance to limit to a range
  // by making this not a const we can change it in the code
  // as needed

  int tolerance = 5;

  // This looks like it should work, right?
  // what happens if lastRedVal is 0?
  if (
    (redVal >  (lastRedVal + tolerance))
    || (redVal <  (lastRedVal - tolerance))
  ) {

    pixels.setPixelColor(0, pixels.Color(redVal, 0, 0));
    pixels.show(); // This sends the updated pixel color to the hardware.
    lastRedVal = redVal;
  }

  // console
  if (console) {
    Serial.print("reading ");
    Serial.print(potValue);
    Serial.print(" low ");
    Serial.print(low);
    Serial.print(" high ");
    Serial.print(high);
    Serial.print(" mean ");
    Serial.println(mean);
    Serial.print(" median ");
    Serial.print(median);
    Serial.print(",");
    Serial.print(" redVal ");
    Serial.println(redVal);
    delay(100);
    digitalWrite(inPot, LOW);
    delay(100);
  }
  else if (plotter) {
    // plotter
    Serial.print(low);
    Serial.print(",");
    Serial.print(high);
    Serial.print(",");
    Serial.print(mean);
    Serial.print(",");
    Serial.print(median);
    Serial.print(",");
    Serial.println(redVal);
  }

}

// tigoe's sort for an array
void bubbleSort() {
  int out, in, swapper;
  for (out = 0 ; out < sampleSize; out++) { // outer loop
    for (in = out; in < (sampleSize - 1); in++)  { // inner loop
      if ( readings[in] > readings[in + 1] ) { // out of order?
        // swap them:
        swapper = readings[in];
        readings [in] = readings[in + 1];
        readings[in + 1] = swapper;
      }
    }
  }
}

 

 

Assignment 8: Who’s there?

Problem:
I go to a circuit training gym, and since it reopened after covid, we’ve had to stand in line to take our temperature before we’re allowed to be admitted into class. This designated spot is obfuscated by a bunch of equipment, and it’s not always easy for the trainer on duty to be alerted whenever someone arrives. They are also likely to be re-setting the equipment for the next class, and unable to rely on visual cues.

Solution:
Whenever someone arrives at the door, the ultrasonic sensor initiates the speaker to start playing a tune to alert the trainer that someone is here. Once they take their temperature is taken and they leave that spot, the tune automatically stops because the distance sensed in the ultrasonic sensor returns back to baseline. This is less frustrating and annoying than a doorbell or buzzer, which can startle other people in the room and disrupt their pre-workout stretch.

https://vimeo.com/user80133951/review/472812721/a046f1c7f5

Sometimes, the trainer uses a vacuum cleaner to clean the gym between classes, and can’t hear soft ambient noises. In this case, the person waiting can use a button to sound a buzzer and stop the tune playing to attract the attention of the trainer more effectively.

//Setting up ultrasonic speaker pins
const int trigPin = 12;
const int echoPin = 13;

//Defines variables
long duration;
int distance;

//Setting up speaker
#include "pitches.h"

//Setting up melody:
int melody[] = {
  NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4
};

// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
  4, 8, 8, 4, 4, 4, 4, 4, 4
};

//buzzer interrupt
static const int togglePin = 2;
bool buzzerState = false;
const bool isInterrupt = true;

void SwitchPressed()
{
  //play buzzer
  }

void setup() {
//To read ultrasonic speaker
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
Serial.begin(9600); // Starts the serial communication
pinMode(togglePin, INPUT); // Button for buzzer

}

void loop() {

//Reading from ultrasonic speaker
// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);

// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);

// calculate distance
distance= duration*0.034/2;

// print distance
Serial.print("Distance: ");
Serial.println(distance);

if(distance<100){
//  digitalWrite(11,HIGH);

  // iterate over the notes of the melody:

  for (int thisNote = 0; thisNote < 8; thisNote++) {

    // to calculate the note duration, take one second divided by the note type.

    //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.

    int noteDuration = 1000 / noteDurations[thisNote];

    tone(8, melody[thisNote], noteDuration);

    // to distinguish the notes, set a minimum time between them.

    // the note's duration + 30% seems to work well:

    int pauseBetweenNotes = noteDuration * 1.30;

    delay(pauseBetweenNotes);}

}
    else{
//  digitalWrite(11,LOW);
    // stop the tone playing:
    noTone(8);
}
}

 

Capacitive μPiano: Cultivating an ear for music

Problem: Today, many children are taking music lessons. They learn to read notes and play them on different instruments. But is it enough to learn notes and scores by heart in order to cultivate an ear for music? Or to recognise notes both auditory and visually to compose them into pleasant melodies that make sense?

Solution: Capacitive μPiano helps beginners to do exactly that. You can repeat your favourite melody as many times you want, until you finally perceive how to reproduce it. Each capacitive sensor represents a different note. The melody’s reading becomes an auditory experience for the user, who previously used visual scores. This process helps new practitioners to train an ear for music from the early beginning.

Demo:

https://www.youtube.com/watch?v=L1W8SxbK3Og

Code:

# include <CapacitiveSensor.h>
#include <pitches.h>

// Capacitive Sensors
CapacitiveSensor cs1 = CapacitiveSensor(6, 9);
bool cs1Touched = true; long cs1Val;
CapacitiveSensor cs2 = CapacitiveSensor(6, 7);
bool cs2Touched = true; long cs2Val;
CapacitiveSensor cs3 = CapacitiveSensor(6, 5);
bool cs3Touched = true; long cs3Val;
CapacitiveSensor cs4 = CapacitiveSensor(6, 8);
bool cs4Touched = true; long cs4Val;

// Speaker + Music
#define speakerPin 4
int melody1[] = {NOTE_E4, NOTE_G3, NOTE_G3, NOTE_C4, NOTE_G3, 0, NOTE_B3, NOTE_C4};
int noteDurations[] = {4, 8, 8, 4, 4, 4, 4, 4};

// Switch
#define switchPin 2

typedef struct switchTracker {
  int lastReading;       // last raw value read
  long lastChangeTime;   // last time the raw value changed
  byte pin;              // the pin this is tracking changes on
  byte switchState;      // debounced state of the switch
} switchTrack;

void initSwitchTrack(struct switchTracker &sw, int swPin) {
  pinMode(swPin, INPUT);
  sw.lastReading = digitalRead(swPin);
  sw.lastChangeTime = millis();
  sw.pin = swPin;
  sw.switchState = sw.lastReading;
}

switchTrack switchInput;
bool practiseTime = false;

void setup() {
  Serial.begin(9600);
  pinMode(speakerPin, OUTPUT);
  initSwitchTrack(switchInput, switchPin);
  attachInterrupt(digitalPinToInterrupt(switchPin), changeMode, RISING);
}

void loop() {
  Serial.println(practiseTime);

  if (practiseTime) {
    practise();
  } else {
    playMelody();
    delay(3000);
  }

}

void changeMode() {
  practiseTime = !practiseTime;
}

void practise() {
  capacitiveSensor1();
  capacitiveSensor2();
  capacitiveSensor3();
  capacitiveSensor4();

}
void capacitiveSensor1() {

  cs1Val = cs1.capacitiveSensor(80); // resolution
  if (cs1Touched) {
    if (cs1Val > 1000) {
      Serial.println(cs1Val);
      cs1Touched = false;
      tone(speakerPin, NOTE_E4);
    }
  }

  if (!cs1Touched) {
    if (cs1Val < 100) {
      Serial.println(cs1Val);
      noTone(speakerPin);
      cs1Touched = true;
    }
  }
}

void capacitiveSensor2() {

  cs2Val = cs2.capacitiveSensor(80); // resolution
  if (cs2Touched) {
    if (cs2Val > 1000) {
      Serial.println(cs2Val);
      cs2Touched = false;
      tone(speakerPin, NOTE_G3);
    }
  }

  if (!cs2Touched) {
    if (cs2Val < 100) {
      Serial.println(cs2Val);
      noTone(speakerPin);
      cs2Touched = true;
    }
  }
}

void capacitiveSensor3() {

  cs3Val = cs3.capacitiveSensor(80); // resolution
  if (cs3Touched) {
    if (cs3Val > 1000) {
      Serial.println(cs3Val);
      cs3Touched = false;
      tone(speakerPin, NOTE_C4);
    }
  }

  if (!cs3Touched) {
    if (cs3Val < 100) {
      Serial.println(cs3Val);
      cs3Touched = true;
      noTone(speakerPin);
    }
  }
}

void capacitiveSensor4() {

  cs4Val = cs4.capacitiveSensor(80); // resolution
  if (cs4Touched) {
    if (cs4Val > 1000) {
      Serial.println(cs4Val);
      cs4Touched = false;
      tone(speakerPin, NOTE_B3);
    }
  }

  if (!cs4Touched) {
    if (cs4Val < 100) {
      Serial.println(cs4Val);
      noTone(speakerPin);
      cs4Touched = true;
    }
  }
}

void playMelody() {
  for (int thisNote = 0; thisNote < 8; thisNote++) {

    int noteDuration = 1000 / noteDurations[thisNote];

    tone(speakerPin, melody1[thisNote], noteDuration);

    // to distinguish the notes, set a minimum time between them.

    // the note's duration + 30% seems to work well:

    int pauseBetweenNotes = noteDuration * 1.30;

    delay(pauseBetweenNotes);

    // stop the tone playing:

    noTone(1);
  }
}

boolean switchChange(struct switchTracker & sw) {
  const long debounceTime = 100;
  // default to no change until we find out otherwise
  boolean result = false;
  int reading = digitalRead(sw.pin);

  if (reading != sw.lastReading) sw.lastChangeTime = millis();
  sw.lastReading = reading;
  // if time since the last change is longer than the required dwell
  if ((millis() - sw.lastChangeTime) > debounceTime) {
    result = (reading != sw.switchState);
    // in any case the value has been stable and so the reported state
    // should now match the current raw reading
    sw.switchState = reading;
  }
  return result;
}

 

 

Funky Music Maker

After watching the videos on changes and developments in music in class, I got to thinking about what would be a cool, funky way to make music with electronics. I decided that a fun experimental music making idea would combine the ability to change the type of sound quickly on a speaker (frequency) as well as add in the taps that could go with a beat based on your leg moving up and down. This being triggered by your leg would leave a hand open to change out what is being tapped by the solenoid and thus change the sound heard from it. As someone who knows nothing about music and notes, I chose for someone to just change the frequency so that there would be no barriers from someone trying it out. For this proof of concept, I chose to have the speaker turn off when the IR beam is broken and the solenoid moves as it overpowers the sound otherwise.

int solenoidPin = 9;
const int IRpin = 3;
int IRstate;
int potPin = A0;
int potVal;
int speakerPin = 13;
int frequency;

void setup()
{
  pinMode(solenoidPin, OUTPUT);
  pinMode(IRpin, INPUT);
  digitalWrite(IRpin, HIGH);
  pinMode(potPin, INPUT);
  pinMode(speakerPin, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  potVal = analogRead(potPin);
  frequency = map(potVal, 0, 1023, 1, 1000);
  IRstate = digitalRead(IRpin);
  Serial.println(IRstate);
  static int start = millis();
  digitalWrite(solenoidPin, !IRstate);
  if (IRstate == 1) {
    tone(speakerPin, frequency);
  }
  else { //broken
    noTone(speakerPin);
  }
}

 

Shadow Boxing Partner

Problem

I have just started practicing boxing a few weeks ago and every week we work on a new drill. During class I can work with a partner and get familiar with the hits and rhythm of the drill. After I am familiar with drill, I will have to react to the movement made by my partner and execute the drill accordingly. When I shadow-box in home and without a partner, however, there is no hint or reminder on the next hit as I try to get familiar with the drill again. In addition, shadow-boxing also lacks the reacting aspect of s?m.parring. Therefore, a device that acts as the shadow boxing partner is designed.

Solution

The design of the devices

The device is made up by six speakers that sticks to the wall. Each square in the diagram above represents a speaker. The diagram shows the default arrangement of the speakers. The number written near the speakers  represents the number for the hit the speakers are responsible for. For example, when a jab needs to be thrown, the speaker on the top left-corner will play the sound effect because the number of jab is 1. The middle speakers are responsible to upper cut to chin and body shots to the middle. The device will connect to phone, and the sound effect player by the speakers depending on what drill is being practiced. The one of the navy drills, for example, includes a left hook (3), a straight punch (2), and then a left hook (3). The speaker that is responsible for left hook will play the sound effect for left hook, and the speaker responsible for straight punch will play the sound effect for straight punch. The sound effects of each type of punches are recorded from actual punches. They might not be that distinct comparing to each other but the position of the speaker already gives a big hint on the next hit and the user should at least know what hits are included in the drill. When the user gets comfortable with the drill, the device can be switched to difficult mode. Only the first punch or the “hit” from the partner is given and the user has to react to it. The user can also change the drill through the smart phone.

Proof of Logic

The demo of the device

Because of the lack of materials, I cannot make the full device with 6 speakers. Instead, I will use speaker, solenoid, and vibration motor to stimulate the sound effects for hook, straight punch/ jab, and body shoots. The first button on the right hand side is to switch between drills and the second button is to switch between normal mode and difficult mode.

Code:

//libary
#include "pitches.h"


//Defining the pins
#define solenoide 12
#define motor 13
#define speaker 7

#define drill_pin 3
#define hint_pin 2

//Global varibales
//For interrupt
const bool isInterrupt = true;
int drill;
int drill_number = 1;
bool hint_status = true;
bool solenoid = true;
int delay_in_between = 350;

//Functions
void move_solenoid() {
  if (solenoid == true) {
    digitalWrite(solenoide, HIGH);
    solenoid = false;
  }

  else {
    digitalWrite(solenoide, LOW);
    solenoid = true;
  }
}

void vibrate_motor() {
  digitalWrite(motor, HIGH);
  delay(300);
  digitalWrite(motor, LOW);
}

void DrillSwitchPressed() {
  if (digitalRead(drill_pin) == LOW) {
    drill == drill_number ? drill = 0 : drill ++;
  }
}


void HintSwitchPressed() {
  if (digitalRead(hint_pin) == LOW) {
    hint_status = !hint_status;
  }
}

//Functions for the drill
void Navy_drill(int random_numb) {
  if (hint_status == true) {
    if (random_numb == 1) {
      //NOTE_A4 is the note for hook
      tone(speaker, NOTE_A4,200);
      delay(delay_in_between);
      move_solenoid();
      delay(delay_in_between);
      tone(speaker, NOTE_A4,200);
     
      
    }

    if (random_numb == 2) {
      move_solenoid();
      delay(delay_in_between);
      tone(speaker, NOTE_A4,200);
      delay(delay_in_between);
      move_solenoid();
    }

    if (random_numb == 3) {
      //Upper cut
      vibrate_motor();
      delay(delay_in_between);
      move_solenoid();
      delay(delay_in_between);
      //NOTE_A4 is the note for hook
      tone(speaker, NOTE_A4,200);
      
    }

    if (random_numb == 4) {
      //Upper cut
      //tone(speaker, NOTE_C4);
      //delay(200);
      //tone(speaker, NOTE_D4);
      //delay(100);
      //tone(speaker, NOTE_E4, 100);
      vibrate_motor();
      delay(delay_in_between);
      //hook
      tone(speaker, NOTE_A4, 200);
      delay(delay_in_between);
      move_solenoid();
    }
  }

  else {
    if (random_numb == 1) {
      //NOTE_A4 is the note for hook
      tone(speaker, NOTE_A4, 200);
      
    }

    if (random_numb == 2) {
      //NOTE_A4 is the note for hook
      tone(speaker, NOTE_A4, 200);
    }

    if (random_numb == 3) {
      //Body shot coming in
      vibrate_motor();
    }

    if (random_numb == 4) {
      //Body shot coming in
      vibrate_motor();
    }
  }   
}


void Dodge_drill(int random_numb) {
  if (hint_status == true) {
    if (random_numb == 1) {
      //NOTE_A4 is the note for hook
      tone(speaker, NOTE_A4,200);
      delay(delay_in_between);
      move_solenoid();
    }

    if (random_numb == 2) {
      tone(speaker, NOTE_A4,200);
      delay(delay_in_between);
      move_solenoid();
      
    }
  }

  else {
    delay(random(0,2000));
    if (random_numb == 1) {
      //NOTE_A4 is the note for hook
      tone(speaker, NOTE_A4, 200);
      
    }

    if (random_numb == 2) {
      //NOTE_A4 is the note for hook
      tone(speaker, NOTE_A4, 200);
    }
  }   
}
void setup() {
  // Setup the pin modes
  pinMode(solenoide, OUTPUT);
  pinMode(motor, OUTPUT);

  //When the buttons are pushed, digitalRead shows 0

  pinMode(drill_pin, INPUT_PULLUP);
  pinMode(hint_pin, INPUT_PULLUP);


  //Initiate the serial monitor
  Serial.begin(9600);


  // attach the interrupt pin to a method
  if (isInterrupt) {
    attachInterrupt (digitalPinToInterrupt(drill_pin), DrillSwitchPressed, FALLING);
    attachInterrupt (digitalPinToInterrupt(hint_pin), HintSwitchPressed, FALLING);
  }



 
  //vibrate_motor();
  //tone(speaker, NOTE_C4);
  //delay(200);
  //tone(speaker, NOTE_D4);
  //delay(100);
  //tone(speaker, NOTE_E4, 100);
}






void loop() {
  if (drill == 0) {
    //randomSeed(analogRead(A0));
    int random_numb = random(1,4);
    Navy_drill(random_numb);
    delay(3000);
  }

  if (drill == 1) {
    //randomSeed(analogRead(A0));
    int random_numb = random(1,2);
    Dodge_drill(random_numb);
    delay(4000);
  }
}

 

Surfing Paddling Metronome

I learned surfing for the first time this past weekend and paddling was one of the hardest part of it. Here are some of the common mistakes/mistakes that I made:

    1. Starts increasing paddling “faster”(in quotations because by faster, it does not mean moving your arms faster but paddle the water stronger with the same tempo so that the surfboard moves faster) too late
    2. Not paddling “fast” enough
    3. Arms are moved too fast and lost the tempo
    4. Stop paddling too early

So I thought what kind of device can offer some cues to beginners like me? Auditory cue is a great idea here because there is already a lot to look at and strength requirement does not really allow haptic cues.

Here is the device that uses an acceleration sensor as input, and a speaker as output. The device always make sounds with the same tempo like a metronome, but depending on how close the wave is(acceleration), the pitch of the sound it makes is different.

Users can listen to the sounds to decide when to paddle faster, how fast, and when to stop while maintaining the rhythm.

I couldn’t accurately simulate the change acceleration change, so for demoing purpose, I’m swinging the acceleration sensor back and forth, but you can still hear the different pitches when swinging at different speeds.

Singing toilet but make it less obvious

As Jet briefly mentioned in class, in some countries including Korea/Japan, the “singing toilets” can be commonly found. Even the toilet at my house not only plays music but also it has a speaker and a microphone that connects to the doorbell, so you can answer someone outside the door while you are using the toilet.

I wondered, why does it play music? why not just a sound? Is it also a way to show the luxury of listening to classical music even while you do your business? I asked around many people, but I couldn’t really get an answer. Therefore, I called the interior consultant who installed this at my home.

He says it is more of a cultural thing. Not only the calm music lets you concentrate better on your business, but basically, for the toilets that are located in a shared area such as a public bathroom/my parent’s room, it is considered “rude” to let others hear the sound that your stuff makes. Therefore, there’s music to stealth the sound so that you don’t feel embarrassed. It is not always music, too; for example, the Incheon airport toilets have buttons next to them that you press when you use the toilet, and it makes a flush sound — no, it doesn’t flush the toilet, it only makes a flushing sound (you flush your toilet after pressing the flush sound button.

Therefore, I wondered again. While I use the microphone in the bathroom, classical music doesn’t stop. However, everyone in this building has the same toilet installed, so I was always afraid that the delivery guys can hear the music while I talk. The fact that the music doesn’t stop while talking on the microphone is defeating the whole purpose of that music.

So I designed a singing toilet module that fulfills all of the purposes.

https://drive.google.com/file/d/1pMVpjTm3tO2JzSIfYPkowj36UpNh8F3g/view?usp=sharing

It plays the intro of “Spring” by Vivaldi. (this is where my musical talent came in handy) The full jingle can be played here:

https://drive.google.com/file/d/1cWwLkompyNM6D4IXzH8UUfemVE9Hp2lo/view?usp=sharing

From the left: speaker, photocell resistor, button, and a blue LED
While the photocell is blocked (the equivalent of someone sitting on the toilet) the music plays and the blue LED comes on.
Someone presses the doorbell at the door! The music pauses, and the LED turns off as well to alert the person that it is paused.

+

What’s up with the LED? Why is it necessary?

  • According to the interior design consultant, he says that so that the “visual” bothers the person less.

Assignment 8 – Sound is spatial

Sound to me is spatial and that because it triggers my spatial modalities of perception such as vision, touch and proprioception. Through the latter ones, a person perceives space and its properties such as shapes, relations, textures, materiality, as well as his/her body’s relation to space and particular objects. Therefore, when I hear a sound, I have the tendency to visualise, spatialise and make kinaesthetic projections onto my body.

For example, when hearing the workers building on the construction site, I particularly focus on the sounds being produced using their tools. Those make me visualise materials being transformed; I try to understand the nature of the material itself, how rigid that is, what kind of texture it may have and the kinds of visual transformations that take place when it collides with different tools.

Or when hearing the echo of a person walking or talking in a space, I close my eyes and visualise how spacious and tall this room is. Or when raining, I render spatial the rain’s strength or the environment’s humidity degree. Finally, because of my dancing experience and the effect of neural mirroring on me, when hearing to music such as the sleeping beauty, I visualise famous dancing patterns and sometimes I perceive the difficulty to execute them.