CPB PWM Jam Buddy (Blues Jam Track/Metronome)
by scordos in Circuits > Microcontrollers
192 Views, 1 Favorites, 0 Comments
CPB PWM Jam Buddy (Blues Jam Track/Metronome)
Do you ever find yourself without a buddy to play the blues with? Well look no further! I'll teach you how to build one!
The controls are simple. The box has two potentiometers: one to pick the song, and one to control the tempo of the song. The tempo ranges from 60 to 160 BPM. My project contains three songs (Two 12-bar blues melodies and a metronome), but code can be modified to make any song you would like.
Supplies
Adafruit Circuit Playground Bluefruit
2 x Potentiometers
3 x Alligator clip wires
CPB Power Supply
A Box
Circuit Python
Write a Circuit Python Program!
Write a Circuit Python program that plays music. I used the pwmio library to play through the built in speaker, and used slide potentiometers to control tempo and select songs.
The code works as follows:
A "play" function requires a note as a parameter and a duration as an input from a potentiometer, which ranges from 60-160 bpm.
"Song" functions play notes in a predetermined order, and the melody is repeated within a for-loop of another function. The blues function, for example, plays a blues melody 12 times, and inputs key changes.
The code can be modified to incorporate the ability to shift keys, but I ran out of room on my CPB. Maybe the next time around, an Arduino Nano may be a better choice.
Lastly, the second potentiometer is split into 4 sections: Off, Blues Melody 1, Blues Melody 2, and Metronome. Each section has a designated Neopixel color (Red, Purple, Blue, Green) and changes at the end of every measure due to the "check" functions".
I've attached my code to this step, or you can view it on Github here: https://github.com/scordos/CPB-PWM-Jam-Buddy
Downloads
Make a Box!
I made my box out of foam poster board. The front of my box has the potentiometer interface, with a drawing of my jam buddy on it. The drawing has its eyes cut out, for an indicator light, but your design is up to you. Get creative!
Assembly!
Once you have your box, now it's time to put your circuit playground in the box, along with the power supply. Install the potentiometers in the top of the box, and connect them to your CPB with your alligator clip wires. I soldered mine in, but thats entirely optional.
Close It Up!
Close up the box and pray that it works. Mine took some finicking, but I got it to work just fine. Have fun jamming!