So it’s finally time to create something cool out of what I learned this semester. For this project, I decided to build something that would ultimately help me in what I do: music production. As much as I love the flashy stuff Processing can do, I felt that Max would be the ideal platform for sound manipulation. I ended up learning a lot about Max in this Processing class, but hey, everything is useful at some point. Especially because all my music tech friends are total Max geeks and I feel left out. This was a great chance to learn Max and put something together that is both fun and useful. My idea was to create something that could augment the capabilities of keyboard instruments. When a key is pressed on a piano, there’s not much else that can be done to affect the sound. Unless you’re an experimental prepared piano artist, you’re limited to working with the sound of the hammers hitting the strings. When I was doing research for this project I remembered something I had seen a long time ago: piano keys with sensors that allow the player to create vibrato effects. What an awesome idea, I thought. If I could make my own DIY version of something like that I’d be very happy. So that’s what I tried. The first step was finding the right sensor for this type of application. A soft potentiometer, or simply soft pot, seemed to be a good choice. It is easy to install, relatively cheap, and fits perfectly with the hand gesture I want for my system. The soft pot outputs different voltages depending on where you press it along it’s length. It’s ideal for this type of finger movement as the user can ergonomically adjust the depth of the vibrato as she or he plays the keys. Another advantage to this potentiometer is that it comes with a self-adhesive back and is soft enough to cut to the exact size of my keyboard keys. Here’s what the soft pot looks like:
This project is just a test of my DIY vibrato system, so I started small. I only ordered four soft pots from http://www.adafruit.com. Here’s how I hooked up them up on my Arduino Uno and key board:
The circuit is very simple: the 5V+ and gnd pins of each soft pot go to their respective lines on the breadboard, while the middle floating pin of each sensor goes into the Arduino’s analog input A0, A1, and A2. This allows me to write some code for the Arduino to read each analog input and transmit it serially to Max. Here’s what I wrote for the Arduino:
int softPot1 = A0;
int softPot2 = A1;
int softPot3 = A2;
This code sends the voltage values of each pot in three columns, which are then decoded on Max’s side. Here’s what my Max patch looks like:
IT WORKS! It still sounds pretty crude because I haven’t added an envelope generator to adjust the attack and decay of each note. It works polyphonically though, which is definitely a desirable feature for most music production (except 8-bit music for 1990s video games). It was a bit of a pain to get the polyphony and FM synthesizer working properly. Again, I barely knew how to do anything in Max before this project. And here it is, it works! This patch is also cool because it let’s the user define how much the serial values from Arduino affect the patch. If you use the full range of values from the stream, from 0 to 1023, the sensors changes the sounds drastically because it greatly increases the harmonicity ratio, or the ratio between the carrier frequency and modulating frequency. (For more info on FM synthesis: http://www-reynal.ensea.fr/IMG/pdf/Article_Chowning_Synthese_FM.pdf) So besides creating vibrato effects with the low-frequency oscillator (LFO) of the FM synth, the user can increase the modulating frequency and create a great variety of harmonic sequences. Basically, this thing can make several different types of sound. All you gotta do is slide your finger up and down the keys — don’t forget to still press them down though, you’re still playing a keyboard!