A guitar shaped MIDI/OSC instrument
The goal of this project is pretty simple; Take the general functionality of your typical MIDI keyboard or control surface and implement it (robustly, and with low latency) in the form factor of a guitar. The motivation is a a little less straightforward. Three things:
I like the form factor of a guitar because it can look quite traditional in a rock band context, but upon closer inspection is clearly not. This reflects my taste in music, superficially recognizable, but substantially deviant. While I can play the guitar, I didn't feel it necessary that a functional guitar be augmented with MIDI controller capabilities, unless the two can be seamlessly combined. This is primarily because my single-threaded brain just cannot effectively handle playing an instrument well, while controlling other parameters.
Because a guitar hangs down in front of you, facing out, visual controls and feedback are pretty useless. A touch screen on the front of the guitar for example, is effectively a touch-pad for the player and a light show for the audience. Therefore I am mostly interested in tactile type sensors which can be blindly interacted with.
The DIY approach is simply an excuse to get lost in the details of interesting technical challenges instead of practicing, or composing actual music.
Regarding limiting cost... Yeah, anyone who has ever attempted a DIY project like this knows it's actually BS. There is no competing with the economies of scale that a market product has. We DIYers like to trick ourselves by spreading the costs into tiny chunks, over many months. But, I consider the premium an investment in enjoyment and the knowledge gained along the way. So that's how it ended up here.
(With Optional Headstock)
The guitar used was a junk no-name electric. I hollowed out from the front of the body with an oscillating multi-tool and a wood blade, leaving space for the FSRs. Because the body is plywood, it was pretty easy to remove the bulk of the material. I spray-painted everything black and carpeted the inside with adhesive Velcro strips (loop side). This has been quite helpful for cable management and general experimentation. Just put some hook Velcro to the bottom of a breadboard and stick it in there. Need a USB Hub? Raspberry Pi? Velcro!
The FSRs are attached with some double sided foam tape which holds them solidly in place and gives them a little bit of padding, which is good when you are banging on them with your knuckles. The little thumb joystick is mounted in the body with hot glue, and wired through a hole bored into the body cavity. The joystick is meant to be moved with the palm of your hand, allowing you to modulate parameters while tapping on the FSRs... In practice, little thumb joysticks like that are junk, they have too little travel to introduce any decent dynamic. I am actively looking for an alternative, larger joystick with more travel.
The first prototype was done using breadboards and an Arduino Mega2650 clone. When it was finally functional, I found the latency to be unacceptable, the breadboard connections were fragile and problematic,and I also found it lacking interface components. So, I swapped the Mega2650 for a Teensy 3.6, soldered all the connections using some protoboard, and added the four faders plus four LED buttons. The result is this new prototype module. I'm designing a PCB which will replace this.
There are USB-A and RJ-45 jacks to the side using some nice, locking Neutrik jacks. Because the Teensy's advanced USB capabilities, there is only USB IO at the moment. The unused RJ-45 is for some future ideas.
There is an SSD1306 64x32 OLED display mounted to the side of the body of the guitar. I simply flattened a little part of the edge with a belt sander, and drilled a hole into the body cavity for the wires. A 3d-printed protective case surrounding the display would be useful.
There is a cover for the body cavity I cut out of plastic to hide the unruly guts (although the aesthetics of the exposed internals are also appealing). Note that this photo was also taken before the faders and buttons were added, which means that the cover, in that form is not currently usable, but I'm still unsure about the final positions of those components anyhow.
The neck was a huge pain. Removing the truss rod required brute force, but afterward I had a cable channel through which I am able to pull wires from the body, up to the head stock. In order to adhere the membrane potentiometers, I needed to flatten the fingerboard. I didn't have any good ideas how, so I ended up just sanding the frets down with a belt sander. There are no photos of this process because I was too busy cursing. The result is OK but if you want to try this yourself, I'd recommend looking for a cheap neck without a fingerboard (although I was unable to find one). Once flattened I attached the membrane potentiometers and covered them with a layer of electrical tape. I then laid some straightened 14 gauge solid core wire down the middle of each sensor, and put another layer of tape on top. This provides some tactile feedback as to where the sensors actually are, and really helps the play-ability. The position tracking through the wire is excellent.
The headstock is a separate entity with its own microcontroller, a (Teensy LC) acting as an I²C slave device. It is attached to the headstock of a guitar. I've connected it to the body module with wires pulled through the neck of the guitar. I removed all the tuning hardware and screwed it directly to the headstock. Currently, it is quite exposed and fragile. I'd like to design a 3d printed protective cover for it.
Put all together and you have a ruitar!
Because the headstock and body have their own microcontrollers, this project is split into two sections, the ruitar-body and the ruitar-head. The directory layouts of both projects are currently set up for platformio, it works. It's not bad.
The ruitar-body is the core of the instrument, effectively a variety of sensors attached to a microcontroller (a Teensy 3.6). These sensors are sampled via the microcontroller ADCs, the values are calculated and, if appropriate, MIDI and OSC messages are sent out. (currently via USB to a PC).
The logic controlling when and what messages to send is configurable by a INI style text files on an SD card. These files can be considered "Presets" and can be copied, modified, renamed, and saved to the SD card.
TODO - Include config file example
I had plans to make presets configurable through the sensors, and OLED display, but I found the OSC GUI much easier and more powerful, so the OLED display is currently relegated to display some basic debugging info at the moment. Perhaps there is a better use for it, or the SPI pins it is occupying?
The default configuration is for it to behave a bit like a real guitar. Pressing a position on a "string" (0-3) determines the pitch of the note, while triggering the note on state, and its velocity is determined by pressure detected at the associated (0-3) "pad". The faders, and toggles emit CC messages, and the joystick can emit CC and pitch bend messages. Sensor values received from the head (accelerometer, encoders) can also be configured to emit MIDI CC messages.
The ruitar-head is set of sensors attached to a microcontroller (Teensy LC) acting as an I²C slave device. The firmware provides a set of read-only registers which can be read to obtain the accelerometer, and encoder values. Additionally the state of the RGB LEDs can be polled and changed by a set of read-write registers.
Things that still need to be done, but are incomplete.
A few ideas I've been batting around:
The Teensy 3.6 is laughing at the current workload. There is plenty of capacity to implement a digital synth, and the Teensy Audio library is amazing. I've already started this, but ran into a couple of problems:
Nothing insurmountable, I'd like to make this happen if I find the time.
At the moment OSC is provided over SLIP encoded Serial. This works, but is a kludge requiring a bridge program to get the UDP packets that all the OSC clients expect.
There is a Neutrik RJ-45 jack built into the body of the ruitar, I could provide power over the unused pairs assuming 100-BASE-T. But without the USB cable I would loose all the USB* devices the Teensy can emulate, which would be a bummer.
Alternatively I could send the SLIP serial to an ESP32 and broadcast the OSC packets via WiFi, not sure about the latency though.
The kxmx_ruitar is really hard to play. Tracking on the "strings" is not bad, but the lack of any tactile feedback along them makes it difficult to get a position reference. Anyway, since MIDI notes are discrete, all the position data the pot and ADC could provide gets quantized to the configured 20 note range anyway... They might as well be buttons, right?
Here's a list of products and projects from which I have gathered ideas:
|ID||Name||Designator||Footprint||Quantity||Manufacturer Part||Manufacturer||Supplier||Supplier Part||Price||LCSC Assembly||Mounted||BOM_Manufacturer Part||BOM_Supplier||BOM_Supplier Part||BOM_Manufacturer||BOM_LCSC Assembly|