Finding A MIDI Note From A Guitar's Strings And Frets
"So, the build is now a bit harder and more time consuming, but note to MIDI conversion, on a simple to program Mega Mini inside a 3D printed, aluminium reinforced guitar body and neck, built from 5 or 6 "laminations" slipped over the reinforcement tubes/conduits and glued with epoxy... EASY! Also, make it in carbon fibre PETG? Sexy, dark grey, matte finish! Sweet!"
In response to the fact that my YouRock MIDI guitar is an aging, irreplaceable curio, and is permanently stuck on the default MIDI channel, because the manufacturer closed down shortly after launch and the support app was never updated, I've been looking at my options for replacement. If I were still playing professionally and using the YouRock, I'd probably buy a JamStik Studio. These are an "axe" about the equal of my Ibanez Blazer "super Strat" or my Haze Telecaster with a low latency, divided pickup system similar to the older Roland system, except they put out MIDI and USB MIDI directly from the guitar, rather than running a multicore cable to a floor box. As music is purely a hobby, and my interest of late in EDM is especially so, I figure AU$2k+ and the risk of having it shipped from the USA is not really worth it for another guitar. I could get the Fishman TriplePlay USB MIDI pickup system "locally" for AU$800 to $1000, depending the retailer, still quite an expense for a hobby toy, and the guitar I'd likely fit it to, the above-mentioned Ibanez, is a bit too collectable to eff with. So, I've been researching building a guitar based MIDI controller that actually plays like a guitar and feels like a guitar, but outputs MIDI notes instead of, or as well as, audio.
So, MIDI guitars come down to a few ways of getting MIDI notes... 55.4
- Pitch-to-MIDI from the audio jack, eg the G2M, but monophonic, no chords,
- After market divided pickup systems from Boss or Fishman, expensive and require retrofitting a guitar in ways that may affect its value, eg tiny screw holes,
- A whole new MIDI guitar, eg JamStik and ever-on upwards in price,
- Build my own, difficult, but not impossible, probably not super cheap, but cheaper JTS.
So I looked into getting 6 G2M boxes and MIDI merge box - might as well buy a Fishman by the time those 7 boxes, various short MIDI cables and an audio buffer/splitter are sourced, so that's pointless and messy. If it comes to that, I'll just nab me a Fishman TriplePlay.
Next, like everybody on this "pilgrimage" I looked into a 6 input pitch-to-MIDI device using an Arduino, ruled out pitch-to-MIDI almost immediately as being almost impossible and started working on period to MIDI, which even an Arduino Uno could do for 6 strings. However, measuring the on pulse and off pulse time the PulseIn() command would take 12ms for the low E, plus however long the MIDI library would take to spit that note out from the period to MIDI formula I wrote about a few weeks back. Then you have to do each string in succession, and while there's a little latency between each string in a strum, the conversion latencies add up and the device may well be unplayable. I could use a faster microcontroller than an Uno, Nano or Mega, but the affordable easy ones have few GPIOs (inputs and outputs) and still have noticable latencies for things like reading a string level for the velocity part of the signal. What to do?
So, I stopped for a while and thought about what a guitar is, particularly an electric guitar.
The answer to this quest? It's a matrix switch! 6 steel strings crossing up to 24 brass frets, one just has to figure out a way to make a guitar so that the wires to each fret and each string are easily run to the microcontroller with enough GPIOs to handle the matrix. The digitalWrite() and digitalRead() commands needed for a matrix switch are really fast compared to pulseIn() - a few microseconds each compared to several milliseconds for the latter.
Hmm, but this is now a luthiery project, not a retrofit. Yes, but 3D printing.
I already have a 3D printed guitar that I remixed from a model on thingiverse, a Les Paul body remixed for Strat guts and and an antique Hofner neck of unknown "birthright" and strattish styling. This guitar plays well and sounds great. Why not 3D print a body and neck "single piece" in 5 or 6 stages, reinforce it with aluminium tubes and run the fret wires down the neck tube from the pre-printed fret slots, the wires being soldered to the underside of the fret tang. The strings would read the logic signals from the frets, one at a time, via wires from each of 6 divided bridges. The latter have become common because of the interest in multiscale guitars, of late. Six 10mm piezo disks underneath each bridge saddle would give velocity data via analogReadFast(), an Arduino thir party library that brings analog read latencies down to 20 microseconds.
Now, 6 digital writes, 24 x 6 digital reads and 6 analog reads sounds latent AF, but...
Using a Mega2650 board, or a Mega Mini, digitalWrite() takes 2.25uS, digitalRead() takes 3.6uS and an analogReadFast() is 20uS. So, 6 digital writes (one for each string) and 24 digital reads (at each fret for each string, 24 x 6), plus 6 analogReadFast commands equals 652 microseconds. Perceptable latency begins at 7 milliseconds. Acceptable latency doesn't begin to fade until around 3 milliseconds. The MIDI output handle would have to multiply the matrix read time by 3 before latencies even came close to being noticable.
So, the build is now a bit harder and more time consuming, but note to MIDI conversion, on a simple to program Mega Mini inside a 3D printed, aluminium reinforced guitar body and neck, built from 5 or 6 "laminations" slipped over the reinforcement tubes/conduits and glued with epoxy... EASY! Also, make it in carbon fibre PETG? Sexy, dark grey, matte finish! Sweet!
Comments
Post a Comment