Anyone who has ever picked up a guitar and tried to learn a song has probably come across guitar tab. Back in the 90s, when my only intention for playing guitar was to be able to pick one up and play Ugly Kid Joe's Everything About You as a party piece, tab books were expensive things.
I had a few tab books, and learned a few guitar solos (long since forgotten) by wrote. I had no idea what I was doing - just that if fret 15 followed 12, then drop a string and repeat, swapping 15 for 14 (I know, complex or what?!) it sometimes sounded a little bit like a tiny fragment from the guitar solo section.
Thanks to the interwebs, there are guitar tabs all over the place. And most of them are free. And many of them appear on the ultimate-guitar website. And the most popular tab-reading software is Guitar Pro. So - having created a guitar with a light-up fretboard - it only made sense to be able to parse some GuitarPro files and present them in LEDs on the physical guitar neck.
So, this weekend, we set about trying to untangle the .gp5 file format.
It's a bit of a nightmare, but just as we were making progress, one of the nerds downloaded a newer, GuitarPro 6 file. Initially our reaction was to ignore it. Just stick with .gp5 because - although navigating the file structure was a pain, it was doable.
Then someone found Tuxguitar.
Because TuxGuitar imports just about all of the GuitarPro tab files, and can export as XML.
This is brilliant for our guitar software. Although the XML format does lose some of the guitar notation (string bends, slides etc) this doesn't really matter to us, since we're only using the actual fret markers to make lights appear on the guitar neck. "Articulation" will have to be left for the player to interpret anyway.
And from XML we quickly had a php/jQuery based webpage up and running, able to parse the tab files.
Our webpage converts the messy time signatures found in the tab files and simplifies them somewhat. It splits the song up into measures and from the start of each measure we simply track number of milliseconds between each note to be played.
This will allow us to play the tablature back in real-time on our guitar neck - simply read a note from tab and make it light up on the guitar neck. Wait a few milliseconds and send another serial packet to change the note being displayed. That's all there is to it!
So far we've managed to import GuitarPro files, but we're making very fast progress on being able to edit the tablature online (so players can create their own riffs and leads, or edit pre-written tab to suit their preferred fingering of specific chords and so on). Look out for a video showing the tablature being played out in real time, very soon!
For the eagle-eyed amongst you, you've no doubt recognised the signature "lick" in the image above, from Metallica's Enter Sandman. Here's how it appeared in TuxGuitar
If nothing else, proof that we're importing the tab correctly at least!