Piano Practice Assistant

Made by SijiaWang

Found in DioT 2019: Augmented Objects

The Piano Practice Assistant allows the user to practice without a real piano. And can record the behavior of the exercise and guide the practice

0

Intention

Limited by the venue and equipment, piano players can't practice anywhere, anytime. What if there is an object which is portable and equips with the piano function in an ambient way?

0

Process

Idea

0

Programming

Step1: Learning how to use sensors and piezo.

Step2: Making some sound - Piezo working when bending flex sensors

Step3: Final Version - Using photoresistor to detect position changes

0

How it works

1. By using the glove with flex sensors, users can simulate playing the piano without a keyboard.

2. By using photosensor, users can change tones when the position of hands changes.

3. LED brightness indicates the duration of a sound.


Prototype Video

0
0

Code

0
#include "application.h"
// Define a pin that we'll place the FSR on
// Remember to add a 10K Ohm pull-down resistor too.
int flexPin1 = A0;

// Create a variable to hold the FSR1 reading
int flexReading1 = 0;


int flexPin2 = A1;

// Create a variable to hold the FSR2 reading
int flexReading2 = 0;

int photoPin = A2;

int photoCellReading = 0;
// Create a variable to hold the pcr reading

int toneC = 0;

int toneD = 0;

// Define a pin we'll place an LED on
int ledPin = D2;

// Create a variable to store the LED brightness.
int ledBrightness = 0;

int Duration = 0;

int speakerPin = D3;

int notes[] = 
{0,
/* C,  C#,   D,  D#,   E,   F,  F#,   G,  G#,   A,  A#,   B */
3817,3597,3401,3205,3030,2857,2703,2551,2404,2273,2146,2024,   // 3 (1-12)
1908,1805,1701,1608,1515,1433,1351,1276,1205,1136,1073,1012,   // 4 (13-24)
 956, 903, 852, 804, 759, 716, 676, 638, 602, 568, 536, 506,   // 5 (25-37)
 478, 451, 426, 402, 379, 358, 338, 319, 301, 284, 268, 253,   // 6 (38-50)
 239, 226, 213, 201, 190, 179, 169, 159, 151, 142, 134, 127 }; // 7 (51-62)
 
#define NOTE_C2  1908
#define NOTE_C3  956
#define NOTE_D2  1701
#define NOTE_D3  852

void setup()
{
  // Set up the LED for output
  pinMode(ledPin, OUTPUT);
  // Create a cloud variable of type integer
  // called 'light' mapped to photoCellReading
  pinMode(speakerPin, OUTPUT);
  
  Particle.variable("force1", flexReading1);
  
  Particle.variable("force2", flexReading2);
  
  Particle.variable("light", photoCellReading);
  
}
 


void loop()
{
  // Use analogRead to read from the sensor
  // This gives us a value from 0 to 4095
  flexReading1 = analogRead(flexPin1);

  flexReading2 = analogRead(flexPin2);
  
  photoCellReading = analogRead(photoPin);
  
  force1makesSound();
  
  force2makesSound();
  

  // Map this value into the PWM range (0-255)
  // and store as the led brightness

   ledBrightness = map(flexReading1, 0, 4095, 0, 255);
;


  // fade the LED to the desired brightness
   analogWrite(ledPin, ledBrightness);
  


}

void photochangeTone()
{

if(photoCellReading < 530) {
     toneC = NOTE_C2;
     toneD = NOTE_D2;
  }
 
  else{
     toneC = NOTE_C3;
     toneD = NOTE_D3;
  }
  delay(0);
}

void force1makesSound()
{
   if (flexReading1 < 500 ){
    photochangeTone();
    tone(speakerPin, toneC, 100);
   }
  delay(10);
}

void force2makesSound()
{
   if (flexReading2 < 500 ){
    photochangeTone();
    tone(speakerPin, toneD, 100);
   }
  delay(10);
}
Click to Expand
0

Circuit

0

List of items

1. Particle Argon

2. Breadboard        

3. Flex sensor(2)    

4. Photosensor 

5. Piezo                 

6. Glove                  

7. Jumper line(some)


0

Next Steps

1. The practice data should be memorable.

2. After memorizing, the machine should give the practice recommendations, such as hands position correction and composition recommendation.

3. Gloves should be more portable and invisible.


x
Share this Project

Courses

49713 Designing for the Internet of Things

· 18 members

A hands-on introductory course exploring the Internet of Things and connected product experiences.


About

The Piano Practice Assistant allows the user to practice without a real piano. And can record the behavior of the exercise and guide the practice

Created

January 31st, 2019