Introduction: DIY Guitar Midi Controller (a.k.a. "Guitorgan")
Here's a weird one for all you MIDI enthusiasts out there. Somehow I got around to thinking about electronics and guitars at the same time, and it occurred to me that whenever you press a string against a fret you are making an electrical path between the two. The logical conclusion of this insight is that if you wire up all of the frets and strings of a guitar (yes I used a bass) to a micro-controller, you should be able to detect what notes are being fretted by testing the electrical conductivity between the frets and the strings! Combined with code to send MIDI messages and routed to a synthesizer, this creates a cool new way interface your guitar to your electronic setups. It's an alternative to hexaphonic pickup guitar synths that detects actual physical contact instead of processing signals.
I was pretty certain at that moment that I was on to something new, however this idea has been around for awhile, likely originating with the Guitorgan, which used this fret-detection method to drive an old school electric organ. It has also been perfected in a guitar called the Solange 6 from Industrial Radio. These professionally crafted instruments retail for $1500 to $4000 respectively.
Unfettered, I set out to make my own version of this synth for more to the tune of under $50. It turns out that, thanks the DIY friendly Arduino Mega, just about any guitar with metal strings can be converted to this setup if you're willing to modify the bridge, with a catch.
The catch is that we can only achieve partial polyphony (when you play more than one note at once). Achieving true polyphony requires completely different frets and make this project a lot more difficult.
Additionally, also understand that my current setup generates a lot of electrical noise when the instrument is plugged into an amp. I'm working on a different version that shouldn't have this issue. This setup is just the simplest hardware and code-wise to implement.
Step 1: Ingredients
To construct this monstrosity, you're going to need:
- A Sacrificial instrument
- Any guitar (or bass) with metal strings will work. I recommend a cheapo electric model, as they are very sturdy and the low action is great for this setup. You will need to modify your bridge though, on an acoustic you do not have to as the strings are already electrically isolated.
- Arduino Mega...for this setup we need a lot of inputs!
- Diodes (just your standard low-amp parts bin type)
- Plenty of 10K Ohm resistors
- A good length of Ethernet cable, 12ft+
- Quick setting, 5-min epoxy
- Superglue
- Soldering Equipment
- A fine point and fine solder (ideally leaded) are a must
- Drill and Bits
- A nice big breadboard
Step 2: Modify Your Guitar: Electrically Isolate Your Strings
Because the strings themselves are part of electrical circuits in this build, we need to make sure that there is no conductivity between them so the micro-controller knows which string is fretted. On an acoustic guitar this is not a problem, however electric instruments generally have their strings grounded in order to try and reduce noise. This is the exact opposite of what we want! You can test the conductivity between strings with a multi-meter, the resistance needs to be infinite.
The place where this happens is usually at the bridge, a metal piece at the base of the guitar that anchors down the strings. Examine your bridge and where the string makes contact with the metal. On mine, this was both at the strings anchors at the bottom of the bridge, and the metal saddle pieces that support the strings. Any metal surface that touches the strings needs to be coated in a non-conductive glue like epoxy or superglue.
For my saddle pieces, I was able to just apply a thin layer of superglue where the string rests.
Unfortunately, the string anchors at bridge could not be handled this way as the string and its end loop fit tightly into the base. I was able to fix this by getting out my drill and vastly over-boring these holes and filling them with epoxy. After it dried I then re-drilled the epoxy so it just fit the strings and the hole was "all glue". After re-installing my bridge and strings, my multi-meter showed no conductivity between the strings!
You will need to be creative for this step and figure out how to make you own instruments specific hardware non-conductive, though chances are it will involve drilling and glue.
Step 3: Modify Your Guitar: Solder Ethernet Wire to Your Frets and Strings
We're almost there with the modifications to the guitar. We will now solder on the wires that plug into our micro-controller. You will need two separate sections (or more) of Ethernet cable, ideally 6 ft or greater. Go ahead and strip all the wires at each end. One cable will be connected to the the frets, and the other to the strings. I only did 8 frets for this setup, but you can add more with more Ethernet cable.
Soldering to the strings is pretty straightforward. Make sure you have a nice bit of wire stripped, and then wrap it on the string after the saddle so it doesn't interfere with the vibrations. Then hit it with your iron and some solder, and the string should readily accept the connection.
The frets are a bit trickier to solder. In order to preserve play-ability of the guitar, we need to make these joints as smooth as possible, and also make the joint at the very end of the fret. Thin gauge leaded solder and a fine tipped iron make this a a lot easier, along with using a soldering stand to hold the wire against the fret. It also helps to pre-tin the edge of the fret and the tip of the wire. When doing this, the least amount of solder, the better!
Once you've got everything soldered, secure everything with tape so that the neck is playable, ideally with high contrast duct tape.
Step 4: Build the Circuit
The circuit setup I used in fundamentally the same as that used in touch keypads, basically a grid of overlayed wires with switches at the junctions. The micro-controller selectively energizes one axis of the grid, and then reads the voltage of each wire at the other axis to determine what connections are made. Instead of buttons, we use the fret to string contact as the switch.
For this setup, the powered axis of this grid is the strings. These will attach, through diodes, to your Arduino Mega Pins 4-9 (4-7 for me since I used a bass). You can verify the order once you get the code running.
The reading axis is the frets. Attach your fret wires to pins 22-29 (or higher if you have more frets), with a 10K Ohm resistor also connecting each wire to ground. This resistor, called a pull-down, ensures that charge does not build up in the string and cause a false reading when it is not activated as the wiring used acts as a capacitor. The controller won't work without these!
Putting it together:
The circuit isn't very complicated, it just involved a lot of wires doing the same thing. Use a nice big breadboard, and take advantage of the common ground rail for your pull down resistors. Definitely fasten the cable from the guitar to the breadboard securely. Also make sure you line up the frets to the pins in the right order, If they're reversed it's fine, you can change it in code, but you don't want them to be random!
Polyphony Limitations
The circuit and code is setup to recognize and play more than one fretted note at a time, however there are limitations due to the lack of segmented frets. Because the fret will conduct between strings, any chord scenario that frets strings adjacent to each other will cause all the strings to be part of the same circuit, resulting in the code reporting that all involved strings are playing the highest involved fret. For example, a major third interval, the two notes of a C chord, will be actually read as a fourth, the two fretted notes of an E Minor chord. If the fretted notes are far enough spaced apart, the note reading is correct.
Important Note:
The scanning method resulting in the strings rapidly (as fast as the micro-controller can go) being brought to voltage and back down to ground. On an electric guitar, this rapid cycling of voltage is picked up through the guitar pickups, resulting in a noticeable buzzing in the amp.
It's possible this could be filtered out somehow, but functionally this setup is not ready to be played at the same time the guitar is plugged into an amp. I am working on an alternative method using an array or different resistor values for the frets instead, and this could potentially fix the problem.
Step 5: Arduino Code
Here is the code you will upload to your Arduino Mega. It's available on my Github too. There's really not much to it, basically a nested loop to scan the frets and an array to keep track of what notes are being signaled.
Notice that our Arduino is sending MIDI messages over serial, and I do not have an actual MIDI port setup. This is handled by using a Serial-Midi device converter in software which I'll get to next. There are guides out there for hooking up a MIDI port if you want, it's not too difficult.
An important aspect is that the chosen note to play after the fretboard has been scanned is the highest registered fret, as fretting a note actually closes two (or more) circuits.
Pay attention to the DEFINE values and the arrays that define the pin values and string offsets. These are easily changed around. Notable BASENOTE sets the pitch of the whole instrument starting at the lowest string. 28 is E2.
//Midi_Guitar, Guitorgan Style //Michael Niemi, <a href="https://github.com/mvniemi/midi_guitar"> https://github.com/mvniemi/midi_guitar </a> #define NUM_STRINGS 4 #define NUM_FRETS 8 #define VELOCITY 100 #define noteON 145 #define noteOFF 129 //This is where you pick what note you want your lowest string to start at #define BASENOTE 28 //Set up for standard tuning of fourths int stringOffsets[] = {0,5,10,15,19,25}; //This is for my bass, add more pins for a 6 string int stringPins[] = {4,5,6,7}; int fretPins[] = {22,23,24,25,26,27,28,29}; int currentNote[NUM_STRINGS]; // void setup() { //Serial to send midi commands over Serial.begin(115200); //Initialize read pins for (int i=0; i< NUM_FRETS; i++){ pinMode(fretPins[i], INPUT); } // Initialize write pins? for (int i=0; i< NUM_STRINGS; i++){ pinMode(stringPins[i], OUTPUT); digitalWrite(stringPins[i], LOW); currentNote[i]=0; } } void loop() { //Scan Strings: We will scan down the neck string my string and set // the note as the highest detected fret // Currently setting the note after each string instead of after all strings for (int i=0; i < NUM_STRINGS; i++){ //Turn String High digitalWrite(stringPins[i], HIGH); //Set current note to zero int newNote=0; for (int k=0; k < NUM_FRETS; k++){ if (digitalRead(fretPins[k]) == HIGH){ newNote=k+1; } } //Turn String Low digitalWrite(stringPins[i], LOW); if (newNote != currentNote[i]){ MIDImessage(noteOFF, (currentNote[i]+stringOffsets[i]+BASENOTE), VELOCITY); if (newNote != 0){ MIDImessage(noteON, (newNote+stringOffsets[i]+BASENOTE), VELOCITY); } currentNote[i] = newNote; } // delay(); } } void MIDImessage(int command, int MIDInote, int MIDIvelocity) { Serial.write(command);//send note on or note off command Serial.write(MIDInote);//send pitch data Serial.write(MIDIvelocity);//send velocity data }
Step 6: Software
If we incorporate a hardware MIDI port into this setup, it can be directly plugged into a MIDI interface, and the serial commands directed through it. However I don't have such hardware, but we only need a couple pieces of software to solve this problem.
The Arduino Mega, when connected to your computer through USB, will send raw MIDI messages through the COM port. We need some software to read this serial signal and represent it as a MIDI device on your computer, which is done by The Hairless MID-Serial Bridge
Additionally, if you are using Windows, you need another program to create a "virtual MIDI loopback cable", it's called loopMID.
Once you've created a MIDI port in loopMIDI, and then connected it to your Arduino's serial port with Hairless, you should be able to receive MIDI commands into your DAW or whatever you're using to generate sounds!
Step 7: How Does It Play???
Without any sort of expressive modulation usually found on instruments (how hard you pluck a string or strike a key), this MIDI controller is truthfully a "digital" instrument. Notes are either on or off, with nothing in between. So it's best described as "experimental".
Combined with the nature of the string-fret switching interface, using this setup with MIDI instruments that expect modulated, expressive control can be a bit chaotic. You must be extra precise with your fretting in order to not "glitch" your notes. I haven't read up much on Guitorgans, but I'm guessing they are less forgiving than a normal guitar with your technique. I'm considering introducing some sort of filtering in the code that would allow a "grace period" when a note is disengaged before the OFF midi command is sent, which might help things out.
One solution to this is to use virtual instruments with strong aspects of attack and decay, meaning the sound takes a little while to build up and drop off, and that some expression is already built in.

Participated in the
Circuits Contest 2016
15 Comments
6 years ago
This is pretty awesome. I came across this because i am pursuing the same thing (arduino based 5 stting Midi-Bass).
Are you still making improvements to this project, or have you shelved it?
I am hoping to differ from yoyrs in a few ways...
1) i really really want it to be fully polyphonic... i'd love to find a way to solve it using standard frets, but i fear i may have to go with segmented frets, and a whole lot of wiring... (meaning it will have to be a carbon fibre neck if i have to run all those wires inside)
2) i plan to use the string/fret switches to determine note values, but not play the notes: i plan to incorpirate puezo transducers for each string to generate the volume, sustain and decay data.
Beyond that, who knows?!!! Id love to hear where you are at with yours, or even see some video!
Reply 7 months ago
Did you ever make headway with this project? Looking into building something similar. Polyphonic bass midi controller using piezoelectric vibration sensors to get the note velocity sustain, etc.
Only difference is I’m forgoing the whole functioning bass thing and just want to use it as a midi controller with the look and feel of a real bass. Because I don’t need quite as much tension on the neck since it doesn’t need to be tuned properly I was hoping to get away with a wooden neck.
Would love to get some insight into how you ended up completing your project if you were ever able to get it done!
Reply 7 months ago
I also had some really great brainstorming sessions with the openai chatgpt page... Basically asked it "hey... Can you program this thing for me?"
And it said "sure... Hook up your wires here, here, and here.... Then use this code"
.... No idea if it is actually a workable solution, but I intend to find out.
... Some day
Reply 7 months ago
Let me know if ChatGPT comes through for you! I'll definitely reach out if I can get a working solution up and running as well.
Reply 7 months ago
What you propose sounds good... My progress is still mostly on paper... Segmented frets is a daunting task and I have been procrastinating....
With your approach, I would be worried that you may not get the sustain that you want if string tension is set a lot lower than standard... Just a thought....
Reply 7 months ago
That's a good point. I had considered the sustain thing and since I'm not planning on having it be a functional bass, theoretically I could have a separate set of short, properly tensioned strings on the body for the right hand pluck and sustain. Though that introduces its own set of difficulties by making it impossible to palm mute a note with my left hand. Closest I could get would be sending a note off message when a fret is released with the left hand. I could also forego strings altogether on the body, and have some FSRs with some additional functionality, though at that point I think I'm starting to stray away from my original vision of a midi bass that feels like a real bass.
The solution I'm looking into right now is based on a post I came across late last night by someone who had figured out a way to setup the circuit and code for polyphonic playing without having to separate/segment the frets for each string. If I'm not remembering incorrectly, I believe they were grounding the frets, and having the strings themselves carry the voltage, which supposedly allowed the whole thing to be read properly as a matrix with accurate polyphonic output. However, I'm still very new to Arduino and want to make sure I can fully wrap my head around everything and the proper safety precautions before I start sending current through all four strings and hooking it up to my expensive audio gear. Also, the guy who developed that code directed people to his website to see all the details and download the sketch, but this was several years ago and his website is no longer active. So going this route would involve creating a sketch from scratch, whereas I'm more in my comfort zone with the copy+paste-from-github method of programming. I'll try to link the post I'm referring to a little later on tonight, as this is undoubtedly the most straightforward/least build-intensive solution since there would be very little modification needed to a normal electric bass.
Question 3 years ago
How do open notes work?
Answer 7 months ago
An open note would work via the programing... If the input detects vibration on a string but no electrical connection to the fret, it would default to playing whatever open note you have it set to
3 years ago
Hi eggloaf,
I am also considering how I can use this system for a 5 string bass (without split frets that are not available anywhere) ...
In this Arduino sketch open notes are not recognized because only the frets and the strings are queried ...
This can perhaps be changed in connection with a stop detection ...
Another
problem is the limited polyphony that results from the non-subdivided
frets when two strings are gripped on the same fret ... Unfortunately,
the system cannot distinguish between them.
I'm still looking for a feasible solution ...
A
better hardware instead of Arduino Mega would be a Teensy 3.2 / 3.6 or
4.0. The can midi via USB. This eliminates the cumbersome software
bridge that must be used with the Mega.
Would be happy if there were like-minded people to share experiences!
Reply 7 months ago
Did you end up making headway on your project? About to build something similar and would love to hear how you ended up making this a reality.
6 years ago
Are you still currently working on this project, or have you shemved it? I found this page while doing research for my project... Which is essentially identical to yours.
I am hoping to solve polyphonic problem though. If i cant find a decent way through the programming, i fear i will have to go with segnented frets. (Major pain! A wooden neck wont have enough strength after having wire channels carved out... segmented frets will mean i need to make a carbon fibre neck)
I am also planning to use piezos for each string to generate the attack, sustain, and decay data...
I would love to hear your thoughts!
Reply 6 years ago
Glad your here you're working on a similar setup! Will it be a fully custom built? Unfortunately my rig is in storage across the country so I haven't been able to work on it. I'd really like to switch it over to a resistor array though to see if that eliminates noise into the pickups and also would only require a few analog inputs. I'd also love to miniaturize it and set it up for bluetooth so it's all contained on the guitar. Piezos are definitely an approach a lot of people take. Of course if you just do signal processing on you end up with the commercial synth projects that are already out there (and good)...though I do think having the actual fret data can have novel uses.
How are you planning on doing the Midi messaging? I'm not particularly happy with the setup I'm using (a Midi-> serial bridge), and I recently discovered a language/framework called Max that's well suited to this sort of project.
In terms of polyphony, as far as I can tell there is no obvious solution. If you play around fingering chords, for example doing an "F" shape both forwards and backwards, you will find that they create identical electrical circuits. The pro model, the Solange, does indeed use segmented frets, and it should say something if their engineering team couldn't figure out a solution. Of course segmented frets require some serious precision in your build!
Capacitive sensing, where the sensors are on the actual fretboard themselves, are likely a viable option, and would enable polyphony. If you are doing a custom build, that could make in integrated. I did a google search and it looks like some research has been done : http://www.iiia.csic.es/guitarLab/research/sensors... and there is a patent out there. However there could be issues with it depending on the sensitivity of the sensors, will it be able to determine a finger being position closely (perhaps even resting on a string), from actually fretting?
That being said, I've been thinking about the polyphony a bit, and it might be theoretically be possible. I said earlier that different chord shapes will create the same electrical circuit, but in theory these circuits aren't exactly identically. The path from fret to string, conductiong through adjacent string and frets is not the same, and potentially introduces resistance, meaning that by measuring resistance between frets and the strings we could determine what the exact chord is. If frets/strings had resistance on 1k Ohm/cm, this would be easy, but they are much better. However, if we had very precise resistance measuring, perhaps it would be possible.
Reply 6 years ago
Good to hear from you!
Yes, mine will be entirely built from the ground up specifically for the purpose of being a fully polyphonic midi bass, while at the same time being aesthetically pleasing, having great playability, and a killer tone.
I come at this from the wood angle, not the electronics side... i built my first instrument (a classical guitar) 20 years ago, and in addition to my hobby projects, i have spent around 8 years employed by a well known maker of electric basses and guitars... so.... ive got the mechanical side of things covered.
Building a carbon fibre neck will be a first for me, but i remain convinced it is the only way to go if i want to have nicely hidden wire-runs and not sacrifice neck stiffness.
I am currently mulling over a few different options for getting all the fret segments done, and done well...
The current "promising" idea involves soldering the hookup wires (5 per fret) to the bottom of the tang using a licator jig id make on my maketspace's cnc. The fret slots will be cut on the cnc as well, with thru-holes located appropriately. Then the fret board is fretted like normal. The final step: mount the fretboard back on the cnc, and with the smallest endmill that will do the job, slowly cut through the frets, one by one to electrically seperate them.
I have only scratched the surface of the whole arduino thing... just enough to know that it is possible and that there are options... an awful lot of learning syill to come.
6 years ago
Lol... i put up a reply, looked like it got deleted, so i rewrote it. Lol... they both say more or less the same thing. Id delete one of them if i could, but that doesnt seem to be an option. .
6 years ago
Yay ! Guitorgan :)
Lots of love for this proto-board connection :]