Midi Guitar

Status: Work in progress (due date passed)


April 26, 2009

It can get the right note about 40% of the time, but I think filtering is most of the trouble. I'll continue work on this as soon as exams are done.

April 12, 2009

So the UBW32 is in and it's pretty damn sweet. It's like an arduino that can actually do something. Pins are all really accessible and bootloaders are nice. I've been struggling to get the USB descriptor table to work get the device recognized as a USB MIDI interface, but I don't think I'll have time to get that working right. I'll probably just make it work over serial with an RtMIDI interface app.

I overlooked the output impedance of the piezoelectric pickups when planning the filtering. They seem to have a good (effective) 4MΩ in them and therefore need to be buffered right in the guitar. It should simplify some since amplifying the signal with no distortion was giving me trouble with only a 3.3V supply. Now I can use the 9V battery in the guitar for a cleaner output and greater voltage swing within the 0-3.3V range. It also simplifies the circuit somehow. Don't ask. The project is going pretty slow right now because of other approaching assignments, labs, and exams. This week sucks.

April 5, 2009

It turns out my ICD2 clone is hosed and with the project due in 9 days, I'm resorting to the bootloader-based UBW32(PIC32MX460F512H) as a replacement for the core of the device. Come summer, I'd like to build it properly with a printed board and all, but for now, this is really all that can be done. On the bright side, this switch should simplify the project some and will allow me to work in linux. Having to dual-boot just becase Piklab doesn't support the new PIC32s yet is a pain.

April 4, 2009

Proto board is populated. 64-pin TQFP on a proto board? That's a lot of wires!

Using a PIC µC and Graphtech Ghost piezoelectric saddle pickups, I am making an inexpensive guitar to MIDI converter capable of rivaling the accuracy and speed of much more expensive units. This is to be my final project for MUMT 307, and more importantly the realization of a dream to play the keyboard intro of Van Halen - Jump properly on guitar.

Preliminary Parts List (Now mostly irrelevant):

The strings will be cycled across the ADC operating at 96kHz (16kHz per string) allowing an excessive ~(80,000,000/96,000) = 833 clock cycles to process each sample. Occasional slight jitter is expected as a result of USB interrupt callbacks, but it should be minimal (~50 cycles = 0.6µs) and infrequent. Each sample will simply be input to one of six state machines.

Many pitch tracking algoriths rely on FFTs which are not only computationaly expensive (for an embedded system, at the resolution needed), but also provide an algorithmic delay of the selected window size. Given the strong resonance of the signal and using physical filtering of the strings, analysis can be done in the time domain with greatly reduced delay and computational complexity.

Short time signal power will be calculated on each string until it crosses a threshold level which occurs on solid contact from pick to string, or worst case, 1-2ms later. A simple algorithm will then track positive peaks (with pickups polarized accordingly) until a consistent peak-peak time can be calculated (seems typically stable after 2 periods). If no consistency is found in two sets of 5 peaks, revert to power tracking as if nothing happened. This will rule out accidental contact with a muted note and could also be used to control, for example, a percussion channel. If a note is found, associate that string to the nearest note number, send a note-on, and continue tracking both pitch and power. Note-off when the power drops below threshold.

Here are some shots of what the attack of each note to be processed look like. They are unfiltered so peaks aren't very well defined and the guitar wasn't *perfectly* in tune. Anyways, this is just to show roughly the waveform to be processed:

E2 Scope

Attack of unfiltered E2 played on the 6th string
Expecting 82.407Hz

E4 Scope

Attack of unfiltered E4 played on the 1st string
Expecting 329.63Hz

C4 Scope

Attack of unfiltered C4 played on the 3rd string
Expecting 261.63Hz
There is a lot of extra noise here from fret buzz, since the action on the guitar is quite low. Most of this is easily removed, since it is at such a higher frequency than anything of interest

As soon as I can find a camera to use, I'll put up the filtered and scaled samples, which are a lot nicer.

Some useful references for the project:

Back to more useless crap

Valid XHTML 1.0 Strict