Raspberry Pi Pico Converts Electric Guitar Signals to MIDI
Philip Karlsson Gisslow used a Raspberry Pi Pico to convert the signal from an electric guitar to MIDI.
MIDI (Musical Instrument Digital Interface) is a standard for digital music. It’s a bit like sheet music that computers can read, because it is independent of a specific instrument or sound. That means a MIDI song can be switched between instruments arbitrarily. MIDI songs can be created purely in software, but it is very common for musicians to use piano keyboards for composition. That doesn’t mean that the resulting song will sound like it was played on a piano, because any instrument’s sound can be applied. But not all musicians are gifted pianists, which is why Philip Karlsson Gisslow used a Raspberry Pi Pico to convert the signal from an electric guitar to MIDI.
This might seem strange at first, because guitars and pianos are almost nothing alike. They’re played completely differently and have wildly disparate sounds. But consider the fact that a musician can play a song on both a piano and a guitar using the exact same sheet music. That makes sense, since most instruments are capable of playing the same notes over a similar range of octaves. In this case, Gisslow just needed a way to determine which notes were being played on the guitar and convert those into MIDI. He had done that in the past with software running on a computer, and took advantage of the Raspberry Pi Pico’s power to achieve similar results in this project.
The Raspberry Pi Pico is quite powerful with its dual-core Cortex M0 processors running at 133 MHz and 264KB of RAM. That may not seem like a lot when compared to your computer, but a microcontroller doesn’t need to run a bloated operating system with a bunch of software. Gisslow is using that power to analyze the signal coming from a Fender Stratocaster electric guitar through a pre-amp. His code checks the frequency of the audio signal like a digital tuner does, because the frequency corresponds to the note and octave of the current note. It is able to identify a note within just a few milliseconds. The code then assigns a MIDI note and sends that to a computer over USB. The MIDI notes can either be recorded to use later or played by the computer in real time. By doing the latter, Gisslow can play a guitar riff and have it output like it is being played on any other instrument or even a synthesizer. This is very useful for musicians who want to work with MIDI, but who are more comfortable playing the guitar then the piano.