Inspiration
One of us plays the bass guitar and we wanted to create a fun and compact way to improve their skills.
What it does
The project scales and shifts the output of an electric bass guitar into a 0-4V wave that is read by our MCU's ADC, and process to support two modes, which are selected using physical buttons on the device. First was free play mode, where users play a note, and the output is written on the serial monitor. In terms of visual feedback on the device, we chose to use this mode more like a tuner, where if the user plays the lowest octave note on each of the four strings, a green flash plays on the screen, otherwise a red flash plays. If the strings are far out of tune, even a correct note will flash red, indicating to the player that they need to tune the string. The second mode is a game mode akin to Guitar Hero, where at each time step, there’s a note to be played. If the note is played correctly at the right time, a green square is written over it, otherwise a red square is. The sequence of notes right now is hardcoded to be an arrangement of Come As You Are at 60 bpm for the demo, and both of these can be changed by varying several hard coded variables. There is also a metronome made using a passive buzzer that ticks on every downbeat (including a 3 tick countoff), indicating when to play in game mode.
How we built it
One-half of the circuit was focused on creating an electrical output that was fully readable by the ADC for the Arduino Mega. It was made up of two LM358-AP op-amps cascaded into each other, the first stage had a gain of 50 to create an output with 4Vpp centered on 0, and the second stage was a summation circuit which added an offset of 2V to get 4Vpp with a range of 0-4V to feed into the Arduino Mega's ADC and be read. The input was the electrical wave which came from the passive pickups of the bass guitar and which was connected through a quarter-inch cable to a bass barrel jack and the mono pins were connected to the breadboard. The second half of the circuit had the LCD screen which would display intro screens for both game modes and the system as a whole, two buttons that were used to pick between game modes and a buzzer we used as a metronome. All the implementation for the games, along with the buzzer and button functionality was done in embedded C and then flashed onto the Arduino MEGA.
Challenges we ran into
On the software side, we faced numerous difficulties throughout the process of implementation. One major one was the amount of RAM available on the MCUs we chose. This is because the granularity/”bucket size” of the FFT is dependent on both the number of samples provided as well as the sampling rate. We originally began with the UNO, whose ATMEGA328p has only 2 KB of ram. The FFT algorithm I implemented requires a power of two size for input samples, and so with 2 KB of RAM, and each sample containing two floats taking 4-bytes each to represent a complex number, we can get a maximum of two 128 length arrays (for input and a second array for intermediate computation), assuming there are no other variables assigned by the program (which there obviously are, so only 64 would be possible). We were able to improve accuracy by moving to the MEGA which had 8 KB of ram, which allowed the sample size to be moved up to 256 in practice, which was still lower than we would’ve preferred, but enough to distinguish most notes on the bass. We also artificially lowered the sampling rate by only taking one in every 3 ADC samples because we knew that the range of frequencies on the bass was quite low. This meant the Nyquist frequency would still be much higher than the highest input frequency we would receive, but the FFT would be more precise. When working on a project that deals with complex computations on board an MCU in the future, we’ll consider the possible memory and computational load of the proposed program and choose a more appropriate MCU.
Accomplishments that we're proud of
We are proud of how clean the output wave from our processing circuit is, as well as the accuracy of the FFT given the physical memory limitations and sampling situation we were dealing with. We're also happy with the inclusion of the metronome and how it both improves user experience and improves sampling.
What we learned
On the hardware side, we gained practical experience with designing circuits to process/clean an analog signal. On the software side, we learned more about the limitations of embedded systems when implementing algorithms like the FFT, and dealt with properly using interrupts and timers to sample non-periodic waves as if they were periodic.
What's next for Bass Hero
Next steps for the project would mostly touch on addressing some of the fallbacks we’ve noted above. This includes switching the processor to one with more memory and a better ADC (like the Teensy we intended to use but was out of stock). As well as this, we would focus on building a more user friendly packaging for the project, with a 3D printed/wood laser-cut case and onboard battery power for the processing circuit and MCU.
Log in or sign up for Devpost to join the conversation.