Tuesday, February 16, 2016

Documentation

MIDI GLOVE

Interaction with music is something that has driven me to do a variety of projects over the past few years with this being the most recent and involved project to date.
The idea behind my MIDI Glove is to be able to compose, control, and manipulate music just using the dexterous properties of your hands.

The glove is meant to act as a midi controller for any DAW (Digital Audio Workstation) to record melodies, loops, etc. to create music in a non-conventional, more interactive way.

The Glove is composed of many different sensors, each with a different purpose and completely customizable. Each sensor can trigger different parameters within the program to allow the user to control the music in whatever fashion fits their style best.

The glove itself is composed of 9 sensors and 2 buttons. There is a pressure sensor on each of the five fingers and there is a flex sensor on the back of each finger excluding the thumb.

The 5 pressure sensors are FSRs (Force Sensitive Resistors) that register different resistances based on the pressure on the sensor. This allows for velocity sensitive control meaning the harder the sensor is pressed, the louder the volume value will be sent in the MIDI signal.

On the back of 4 fingers there are bend resistors that change resistance the further they are bent. These are used to change variable values within the program such as frequency control, volume control, effect presence within a sound, etc.

The glove allows for many different combinations of controls and movement to expressively interact with the music.

Below you can see pictures of the current build stage of the glove.

Ableton (DAW)

Thursday, February 4, 2016

Sewing

Next step was to figure out how to secure down the sensors so that I could test all the components together. I thought I might try to sew each individual one down.
I quickly learned two things:
First, that I am terrible at sewing
Second,  that sewing each individual component was not the most efficient way to go about it.


First Test



Pics After Wiring

Just a few pics to show after wiring it all up and strapping it to my hand.






Wiring

Wiring has been a little bit of an issue and will be an ongoing process.
I originally started by hooking up all the sensors in parallel and connected them directly to the Teensy 3.0.

I kept on running into issues of the board shutting off and/or not turning on again while there were multiple sensors connected.

I discovered that the sensors were exceeding the boards amp rating and needed an external power source to function properly.

So, after learning that I decided to hook up a coin cell battery to power the resistors. So far it has worked out pretty well. I havent really run across any problems but only time will tell.

Code Challenges

Next challenge was learning how to optimize code for each individual sensor.

One challenge that I had faced during testing the flex sensors was that there was a lot of inconsistent data being sent.
The data was very sporadic and jumped up and down very quickly causing very rough control within the audio program.

I tried doing some math to get things working but it didn't work out too well.
I kept doing research and eventually came across this arduino page about data Smoothing.

https://www.arduino.cc/en/Tutorial/Smoothing

This is exactly what I needed. Now the data is much smoother and the sensor is much easier to control.

The other problem, as far as code goes, was getting the pressure sensors to register the peak value so that I could use the FSRs as velocity sensitive devices.
I have yet to really improve this but so far I just have a delay after the sensor registers a trigger value simulating when the peak of the tap should be.


 

Heres the code for smoothing:

/*

  Smoothing

  Reads repeatedly from an analog input, calculating a running average
  and printing it to the computer.  Keeps ten readings in an array and
  continually averages them.

  The circuit:
    * Analog sensor (potentiometer will do) attached to analog input 0

  Created 22 April 2007
  By David A. Mellis  <dam@mellis.org>
  modified 9 Apr 2012
  by Tom Igoe
  http://www.arduino.cc/en/Tutorial/Smoothing

  This example code is in the public domain.


*/



// Define the number of samples to keep track of.  The higher the number,
// the more the readings will be smoothed, but the slower the output will
// respond to the input.  Using a constant rather than a normal variable lets
// use this value to determine the size of the readings array.
const int numReadings = 10;

int readings[numReadings];      // the readings from the analog input
int readIndex = 0;              // the index of the current reading
int total = 0;                  // the running total
int average = 0;                // the average

int inputPin = A0;

void setup() {
  // initialize serial communication with computer:
  Serial.begin(9600);
  // initialize all the readings to 0:
  for (int thisReading = 0; thisReading < numReadings; thisReading++) {
    readings[thisReading] = 0;
  }
}

void loop() {
  // subtract the last reading:
  total = total - readings[readIndex];
  // read from the sensor:
  readings[readIndex] = analogRead(inputPin);
  // add the reading to the total:
  total = total + readings[readIndex];
  // advance to the next position in the array:
  readIndex = readIndex + 1;

  // if we're at the end of the array...
  if (readIndex >= numReadings) {
    // ...wrap around to the beginning:
    readIndex = 0;
  }

  // calculate the average:
  average = total / numReadings;
  // send it to the computer as ASCII digits
  Serial.println(average);
  delay(1);        // delay in between reads for stability
}
 

Tutorials

First step for me was learning how to use each different type of sensor using various tutorials.
Many of the tutorials were from Sparkfun, Buildr, or Instructables.

Here are a few examples of some of the sensors and tutorials I followed to get started:

FSR Tutorial - http://bildr.org/2012/11/force-sensitive-resistor-arduino/

Flex Resistor Tutorial - http://bildr.org/2012/11/flex-sensor-arduino/

Midi Instructable - http://www.instructables.com/id/Easy-3-Pot-Potentiometer-Arduino-Uno-Effects-Midi-/


Monday, February 1, 2016

Board Choice

I originally started with the Sparkfun RedBoard as my primary control surface but quickly realized that I couldnt control all my sensors due to the lack of analog pins.
I searched around to see if I could convert digital pins to analog and didn't find anything that would really work too well.

I inquired about different boards and someone mentioned the teensy board.

After doing some research I decided that the teensy would be my best option.
It comes with 20 analog pins and enough digital pins for my project.

As a bonus, it can send midi messages and doesn't require external software to convert serial to MIDI.

Final conclusion:
Teensy 3.0 is definitely the best way to go.

MIDI Glove Vision Statement

I will be creating a device I am referring to as a MIDI Glove. Its purpose will be to send MIDI signals to various programs to trigger certain controls.
The main purpose and intention for this is to control and create music solely with the use of hand gestures and finger taps. It will be able to trigger audio clips, musical notes, songs, audio effects, software controls, etc.
It will be able to be used for song composition, live dj control, electronic music production, live looping, light control, and more.

This glove will be composed of a variety of sensors on different parts of the hands to pick up different changing outside factors.
I plan to have pressure sensors on each finger, flex sensors on the top of each finger, tilt sensors, accelerometers, and buttons.
Each will be able to be programmed to different controls within the audio program to allow for complete customization.

I also hope to include LEDs and visual aspects on the top of the globe to make the performance and production process more engaging and entertaining for both the user and the audience.

Switches in parallel
and
switches in Series