It’s been a while since I’ve updated my blog posts, but life has been hectic with inventory at work, and I just recently lost one of my grandpas and now I’m praying that I don’t lose my other grandpa yet because his condition isn’t that great either. So I’m definitely fighting a lot of battles right now (mostly emotional), but praise the Lord, oh my soul!.. Somehow (by His guidance, for sure), I’ve been able to tackle my issues with MIDI for this ETRO project and it’s thanks partially to the Adafruit Music Maker Featherwing.
I’ve been trying to get caught up reading and finishing a $2 book that I found at Maui Friends of the Library called, “Computer Music: Science and Technology of a New Art.” Surprisingly, I picked up this book without judging it by its bright pink cover (haha). So far, I’ve read enough to learn that the MIDI DIN plug is actually old and technically getting obsolete and XLR plugs or USB plugs (not noted in the book since it’s a little older) are better replacements. I also learned that MIDI is done through computers by a genie (sort of like how op amps are done by a fairy =]).
In all seriousness though, I managed to read through the example Arduino code of the player_miditest by Adafruit’s owner, ladyada (Limor Fried). I figured out that midiNoteOn and Off, as well as midiSetChannelBank, midiSetInstrument, and midiSetChannelVolume were all written as void functions. For some reason, this was one of the few things that I was able to retain from ICS 111, and it’s actually been a year now since I last took that class!
One example of the code is “midiNoteOn(0, 60, 127).” The channel bank referred to the VS1053 melody bank and percussion bank. In the first part of midiNoteOn, I still couldn’t really understand what the ‘0’ meant, and I tried messing around with it to see what it would do, but I didn’t hear much change when I did the sound test. However, the second part of that code depended on the channel bank. If I chose the melody bank, the ’60’ meant the key ‘C3 (or middle C)’ and if the percussion bank was chosen, I had to match the number to whatever was written in the VS1053 percussion bank in order to hear that particular sound. And lastly, the 127 referred to the highest volume allowed.
When I first tested everything out, I wired my Arduino Uno and tried out the percussion bank with the synth sounds from a snare drum, bass drum, and a crash cymbal. I also wired up my piezo sensors to act as inputs, so whenever I tapped them, the sound would be outputted through my little speaker. In all honesty, the sound was pretty bad, but it could probably be because of my speaker. I sadly did not take any pictures or videos, but I did for the next test!
After that little practice, I moved on to the melody bank and I wired up an Arduino Mega with 13 piezo sensors and LEDs for a full piano scale from low C to high C. I actually had all of these wired up previously, but I just haven’t had the time to take any pictures or write anything about it until now. And not only did I do that, but I implemented the MIDI part with the Featherwing. After a little tweaking to the code, it worked! I took a video, but I can’t upload it into here, nor was I patient enough to upload it to YouTube.. but I promise, there’s proof…
As for now, I still need to catch up on reading my book and learning how to write better code to play polyphonic notes, and I need to figure out a way to get my sensors to trigger without setting off another one on accident. We’ll see what I can accomplish this coming President’s Day!