Klezmer Style Electric Clarinet
by goldbeas in Circuits > Microcontrollers
44 Views, 0 Favorites, 0 Comments
Klezmer Style Electric Clarinet
As a part of Professor John Gallaugher's "Physical Computing: Interactive Art" class, I made a portable electric clarinet capable of playing through a traditionally Jewish style scale and capable of adjusting volume through a distance sensor. I did this with the intention of making a tool/toy that can be used to introduce a beginner to Klezmer style music. The end result is a clarinet about 15 inches tall that can play a Freygish scale through a speaker and adjust its volume by moving closer to or farther away from the mouthpiece.
Supplies
Adafruit Circuit Playground Bluefruit
Adafruit CPB compatible power bank
Adafruit VL53L0X Time of Flight Distance Sensor
Adafruit MPR121 12-Key Capacitive Touch Sensor
I2C to I2C cord
Wire
Capacitive touch tape
Paper
3D printing PLA filament (Black)
Super glue
Black marker
Drill
Scissors
Wire stripper
Duck tape
Command strips
Speaker
Hair ties
Download and Print Clarinet STL
To encase all the technical components of my project, I found a pre-existing model of a clarinet on Thingiverse, made by Katelyn De Villers. I uploaded the STL to the slicer platform for my 3D printer and changed a few key aspects of it.
First, I changed the Y axis size of the print from 1.2592 in to 3 in. This is important, because it allows us to fit the CPB and speaker in the base (commonly referred to as the bell) of the clarinet.
Second, I cut the print into 4 pieces, pictured above. Cutting it front to back (so between the side with most of the keys and the side without) is essential, as it allows you to place all components of the build inside of it. I also cut it from top to bottom (making a piece with the mouthpiece and a piece with the bottom). This is only necessary if the print is too large for the bed of your printer.
Once I cut the print into 4 pieces, I set the infill to 20% and set supports to Everywhere. I also changed the support type from "snug" to "organic", as I prefer organic's easy removal and limited visual impact on the print. I then set the layer height to 0.2 mm and began my print.
Record Audio for Project
I recorded .mp3 files for each of the notes in a traditional Klezmer scale, called the Freygish scale. I used a D Freygish scale, which contains the following notes:
D, Eb, F#, G, A, Bb, C, D
I chose to go with the Freygish scale (as opposed to it's two Klezmer counterparts, the Mi-Sheberach and the Adonai Molokh) for a few reasons. First, the Freygish scale is most similar to the classic western major scale. In a Western context, a Freygish scale is a major scale in its Phrygian mode with a sharp third. The Mi-Sheberach scale is similar to a minor scale in its Dorian mode with a sharp fourth. I chose the major equivalent scale over the minor because I wanted to keep in mind the overall purpose of the project, to introduce people to playing Klezmer music. In Western music, major scales are often the first thing someone learns to play and some of the first musical sounds they hear as children. So, to make the transition from Western to Klezmer more understandable, this seemed like a good choice. The Adonai Molokh scale simply had too many notes, and would have made the project more difficult for beginners to use. If you wanted to make a Mi-Sheberach Klezmer, you can use the following notes:
D, E, F, G#, A, B, C, D
To actually record the files, I used the program Audacity on my computer. I recorded myself playing the note on a piano, primarily because the sound of a piano would be more clear than a clarinet in the final project. I held each note for about as long as a beginner would be able to on an actual clarinet.
In Audacity, I re-normalized the clips to 0 dB and loudness perception normalized them to -17. Without this step, the recordings would be too quiet. I then exported the recordings as separate clips in a file named "klezmernotes", with numbers before each note in the scale to keep them in the proper order (for example. 1D, 2Eb, 3F#...).
Program Your CPB
Next, I programmed my CPB to contain the code required for my project. I have attached a copy of my code, but will run through the different components of it briefly in this step.
My code first sets a limit on the distance sensor readings, as the time of flight sensor has a wider range than the length of my arms, so It would never reach full volume without an upper reading limit.
It then includes two functions, one to map the distance sensor to volume control and another to control the mp3's. The first function allows the distance sensor to set the volume on a scale from 0-1. The second function plays an mp3 that corresponds with a touchpad on the clarinet. It also stops playing as soon as you stop touching the capacitive touch tape, which is integral to the practical use of the project.
The while True statement simply calls up both of these functions in relation to a specific touchpad (touchpad[i], where i is a number from 0-7). This is why it is important to number the clips of audio in your file, otherwise they would each correlate to a touchpad in a pattern that is out of order.
Downloads
Wire the Components Together
Next, I attached the MPR121 to the CPB using an alligator to I2C connector, putting the different alligator clips in the following spots on the CPB:
Black: Ground
Red: 3.3V
Blue: A5
Yellow: A4
Once I ensured that the touchpad was functional, I cut off the alligator clips, stripped the wire, and wrapped it directly onto the CPB.
I also cut, stripped, and wrapped 8 wires to the first 8 sensors on the MPR121. These will eventually connect to the key holes on the clarinet.
I then used an I2C to I2C cord to connect the time of flight sensor to the touch sensor. Mine wasn't quite long enough, so I used two and cut, stripped, and wrapped them together.
Assemble Clarinet
I then glued the four separate pieces into two pieces, pictured here.
Attach Capacitive Touch Tape and Wires to Keys
Next, I measured the size of the key holes and cut capacitive touch tape to size. To do this, I used a black marker to outline the key and transferred this outline to the back of the tape (see video to watch this).
I then cut the end off of one of the wires connected to my touchpad and stripped it. I put this wire end through one of the key holes and fixed the exposed wiring between the corresponding piece of capacitive touch tape and a piece of paper and cut it to size (see video to watch this). I then used superglue to fix the key shaped capacitive tape and wire to the clarinet.
I repeated this until all 8 keys were covered. For the two keys that did not have a hole, I drilled two small holes and wove the wire between them (see attached photo). I then covered it in capacitive tape and secured it with glue from the back.
Assemble Final Project
Next, I connected to my power source and tested each touchpad. After confirming all components worked, I began to assemble my project.
I used a command strip to connect the time-of-flight sensor to the mouthpiece of the clarinet and then glued my two clarinet pieces together. At this point, all of my wiring was hanging out of the bottom of the project, so I simply pushed it into the body of the piece and used glue and duck tape to attach the MPR121 and CPB to the bell of the clarinet. I then glued the clarinet together and secured it with hair ties.
While it dried, I cut 1 in. long pieces of wire to connect my speaker to the board. I connected one wire to ground and the other to audio. I then put the audio wire on the tip of the speaker's jack and the ground wire on the base. I taped the speaker to the CPB and adjusted the position to hide as much wiring as possible. I chose to tape it (as opposed to a more permanent option like superglue) to make it easier to remove as needed to charge. The speaker will protrude a little bit, but this is ultimately important. If the speaker were entirely inside the bell of the project, the sound would come out softer and be harder to hear as you are using the project.
I then cut off the hair ties and used a sharpie to color in any spots where the glue visibly dried white. Finally, I tested the project one last time and ensured all components worked.