ryrob.es

archive / 2009–2013

Turning Guitar Tabs into structured Data. Silicon crunching Metal.

PythonSQLMetallicaTableauPythonsql servermetallicaTableauguitar tabdataviztablatureprocess tab filesread tab filestab file program

I'm always looking for data from unlikely sources, especially sources that are close to my own bizarre (and predictable) interests. Anyone who grew up learning (or still plays) guitar at one point or another has probably used tablature at one time or another. Visualizing Enter Sandman Tab with Tableau From the old Cherry Hill tab books of our favorite albums and artists, to the internet age where tens of thousands of plain-text format tabs because available all over the place (of varying levels of correctness at times). I've been playing off and on for the past 21 years - more "on" lately than any time in recent memory. So, I had an idea. What if I were to script out a way to crunch through an old school tab text file, split it up in a usable / logical way, and insert it all into a database so I can analyze and display it later via different methods. What would the data tell me? [unordered_list style="bullet"]

  • What if I could compile 100s of these files in this way?
  • What could I do with the data once it was transformed?
  • Would anyone even give a shit?

[/unordered_list]

Well, I've taken the first step - both in the CRUNCHING side and on the VISUALIZING side.

First, the end product - we can save the technical shit for AFTER. As you can see from the shot above. I took a (mostly correct) guitar tab for Metallica's Enter Sandman from ultimate-guitar.com - crunched it, note-for-note, into a database table and built a "analytic report" (using the term very loosely) out of it using Tableau Public. #### Link: Learning Enter Sandman with Visual Analytics Now, on to the "how"... If you look at my source tab, it's not that straightforward for computer reading with all the literal "3x", "12x" etc. I had to streamline it for line-by-line (and col-by-col) machine reading. You can see the original tab I started with here.

My "machine-friendly streamlined" version

[cc lang="text"] ?Metallica|Enter Sandman|The Black Album|http://tabs.ultimate-guitar.com/m/metallica/enter_sandman_tab.htm +01 Intro: #| 1|------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 2|------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 3|------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 4|------------5---------------------------5---------------------------5---------------------------5---------------------------5---------------------------5--------------- 5|--------7---------------7-----------7---------------7-----------7---------------7-----------7---------------7-----------7---------------7-----------7---------------7--- 6|----0-----------6---5-----------0-----------6---5-----------0-----------6---5-----------0-----------6---5-----------0-----------6---5-----------0-----------6---5------- #| 1|------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 2|------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 3|------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 4|------------5---------------------------5---------------------------5---------------------------5---------------------------5---------------------------5--------------- 5|--------7---------------7-----------7---------------7-----------7---------------7-----------7---------------7-----------7---------------7-----------7---------------7--- 6|----0-----------6---5-----------0-----------6---5-----------0-----------6---5-----------0-----------6---5-----------0-----------6---5-----------0-----------6---5------- +02 Rhythm Fill 1: #| PM------------------- sl PM----------------------- sl PM----------------------- sl PM----------------------- sl PM--- PM------- P PM--- PM------- P PM--- PM------- P PM--- PM------- P 1|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5|--2---------------------------/7------------------------------/7--------------------------------/7---------------------------------/7-----------7------------------3\2--------7------------------3\2--------7------------------3\2--------7------------------3\2 6|--0---0---0---0---0---0---0--------0---0---0---0---0---0---0---------0---0---0---0---0---0---0----------0---0---0---0---0---0---0-------0---0------6---0---0---0---1\00---0------6---0---0---0---1\00---0------6---0---0---0---1\00---0------6---0---0---0---1\0 #|PM--- PM--- P PM--- PM--- P PM--- PM--- P PM--- PM--- P PM--- PM--- P PM--- PM--- P PM--- PM--- P PM--- PM--- P 1|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5|--------7-------------------3\2-----------7-------------------3\2-----------7-------------------3\2-----------7-------------------3\2-----------7-------------------3\2-----------7-------------------3\2-----------7-------------------3\2-----------7-------------------3\2--- 6|0---0-------6---5---0---0---1\0---0---0-------6---5---0---0---1\0---0---0-------6---5---0---0---1\0---0---0-------6---5---0---0---1\0---0---0-------6---5---0---0---1\0---0---0-------6---5---0---0---1\0---0---0-------6---5---0---0---1\0---0---0-------6---5---0---0---1\0--- +03 Rhythm Fill 2: #| sl V sl V sl V PM------------------- sl V sl V sl V PM------------------- 1|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5|--2---2----/7-------------2---2----/7-------------2---2----/7--------------5-------5-------4---5---4--------2---2----/7-------------2---2----/7-------------2---2----/7--------------5-------5-------4---5---4------ 6|--0---0---------6---5-----0---0---------6---5-----0---0---------6---5------3---0---3---0---2---3---2--------0---0---------6---5-----0---0---------6---5-----0---0---------6---5------3---0---3---0---2---3---2------ +04 Rhythm Fill 3: #| PM------------------- P PM------------------------ P PM----------------------- PM------------ 1|-------------------------------------------------------------------------------------------------------------------------------------------------------- 2|-------------------------------------------------------------------------------------------------------------------------------------------------------- 3|-------------------------------------------------------------------------------------------------------------------------------------------------------- 4|-------------------------------------------------------------------------------------------------------------------------------------------------------- 5|--2----------------------------3\2-------------------------------3\2-----------------------------------------5-------5-------4---5---4------------------ 6|--0---0---0---0---0---0---0----1\0---0---0---0---0---0---0---0---1\0----------0---0---0---0---0---0---0------3---0---3---0---2---3---2------------------ #| PM------------------- P PM------------------------ P PM----------------------- PM------------ 1|-------------------------------------------------------------------------------------------------------------------------------------------------------- 2|-------------------------------------------------------------------------------------------------------------------------------------------------------- 3|-------------------------------------------------------------------------------------------------------------------------------------------------------- 4|-------------------------------------------------------------------------------------------------------------------------------------------------------- 5|--2----------------------------3\2-------------------------------3\2-----------------------------------------5-------5-------4---5---4------------------ 6|--0---0---0---0---0---0---0----1\0---0---0---0---0---0---0---0---1\0----------0---0---0---0---0---0---0------3---0---3---0---2---3---2------------------ +05 Bridge: #| PM--------------------------- 1|------------------------------------------------------------------------------------------------------------------------ 2|------------------------------------------------------------------------------------------------------------------------ 3|---------2---------------------2---------------------2------------------------------------------------------------------ 4|-----4---------------------4---------------------4---------------------------------------------------------------------- 5|-------------3---2-----------------3---2-----------------3---2-------4---4---4---4---4---2---3---4---------------------- 6|--2---------------------2---------------------2----------------------2---2---2---2---2---0---1---2---------------------- +06 Chorus Fill: #| PM------------ 1|---------------------------------------------------------------------------- 2|---------------------------------------------------------------------------- 3|----------------------------------------------------------------2----------- 4|------5---4---------5---4---------5---4---------5---2---5---2-------2------- 5|--4---3---2-----4---3---2-----4---3---2----2-------------------------------- 6|--2-------------2-------------2------------0-------------------------------- #| PM----------- PM----------- 1|---------------------------------------------------------------------------- 2|---------------------------------------------------------------------------- 3|------------------------------------2--------------------------------------- 4|------5---4---------5---2---5---2-------2----------------------------------- 5|--4---3---2-----2----------------------------5-------5-------4---5---5------ 6|--2-------------0----------------------------3---0---3---0---2---3---3------ +07 Rhythm Fill 2: #| sl V sl V sl V PM------------------- sl V sl V sl V PM------------------- 1|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5|--2---2----/7-------------2---2----/7-------------2---2----/7--------------5-------5-------4---5---4--------2---2----/7-------------2---2----/7-------------2---2----/7--------------5-------5-------4---5---4------ 6|--0---0---------6---5-----0---0---------6---5-----0---0---------6---5------3---0---3---0---2---3---2--------0---0---------6---5-----0---0---------6---5-----0---0---------6---5------3---0---3---0---2---3---2------ +08 Rhythm Fill 3: #| PM------------------- P PM------------------------ P PM----------------------- PM------------ 1|-------------------------------------------------------------------------------------------------------------------------------------------------------- 2|-------------------------------------------------------------------------------------------------------------------------------------------------------- 3|-------------------------------------------------------------------------------------------------------------------------------------------------------- 4|-------------------------------------------------------------------------------------------------------------------------------------------------------- 5|--2----------------------------3\2-------------------------------3\2-----------------------------------------5-------5-------4---5---4------------------ 6|--0---0---0---0---0---0---0----1\0---0---0---0---0---0---0---0---1\0----------0---0---0---0---0---0---0------3---0---3---0---2---3---2------------------ #| PM------------------- P PM------------------------ P PM----------------------- PM------------ 1|-------------------------------------------------------------------------------------------------------------------------------------------------------- 2|-------------------------------------------------------------------------------------------------------------------------------------------------------- 3|-------------------------------------------------------------------------------------------------------------------------------------------------------- 4|-------------------------------------------------------------------------------------------------------------------------------------------------------- 5|--2----------------------------3\2-------------------------------3\2-----------------------------------------5-------5-------4---5---4------------------ 6|--0---0---0---0---0---0---0----1\0---0---0---0---0---0---0---0---1\0----------0---0---0---0---0---0---0------3---0---3---0---2---3---2------------------ +09 Bridge: #| PM--------------------------- 1|------------------------------------------------------------------------------------------------------------------------ 2|------------------------------------------------------------------------------------------------------------------------ 3|---------2---------------------2---------------------2------------------------------------------------------------------ 4|-----4---------------------4---------------------4---------------------------------------------------------------------- 5|-------------3---2-----------------3---2-----------------3---2-------4---4---4---4---4---2---3---4---------------------- 6|--2---------------------2---------------------2----------------------2---2---2---2---2---0---1---2---------------------- +10 Chorus Fill: #| PM------------ 1|---------------------------------------------------------------------------- 2|---------------------------------------------------------------------------- 3|----------------------------------------------------------------2----------- 4|------5---4---------5---4---------5---4---------5---2---5---2-------2------- 5|--4---3---2-----4---3---2-----4---3---2----2-------------------------------- 6|--2-------------2-------------2------------0-------------------------------- #| PM----------- PM----------- 1|---------------------------------------------------------------------------- 2|---------------------------------------------------------------------------- 3|------------------------------------2--------------------------------------- 4|------5---4---------5---2---5---2-------2----------------------------------- 5|--4---3---2-----2----------------------------5-------5-------4---5---5------ 6|--2-------------0----------------------------3---0---3---0---2---3---3------ +11 Solo #| 1|------------------------------------------------------------- 2|-15-15-15-12----12---------------12-12----15b17-15b17-(15)-- 3|-------------14-----14b16---(14)-------14-------------------- 4|------------------------------------------------------------- 5|------------------------------------------------------------- 6|------------------------------------------------------------- #| 1|-------------------------------------------------- 2|-------------------------------------------------- 3|-12/14-14-14-14\12-12-12-12/14-14-14-14\12-12-12-- 4|-------------------------------------------------- 5|-------------------------------------------------- 6|-------------------------------------------------- #| 1|------------------------------------------ 2|------------------------------------------ 3|-14p12------------------------------------ 4|-------14--14p12-------------------------- 5|-----------------14--14p12\10------------- 6|------------------------------12-~-(12)-- #| 1|-------12-12-12-------12-12-12-------12-12-12-------12-12-12-- 2|-15b17----------15b17----------15b17----------15b17----------- 3|-------------------------------------------------------------- 4|-------------------------------------------------------------- 5|-------------------------------------------------------------- 6|-------------------------------------------------------------- #| 1|-------12-12-12h15p12-12h15p12-12h15p12-12-15-12-12-14-14-- 2|-15b17----------------------------------------------------- 3|----------------------------------------------------------- 4|----------------------------------------------------------- 5|----------------------------------------------------------- 6|----------------------------------------------------------- #| 1|-17p14----17p14----17p14-19p15----19p15----19p15-- 2|-------15-------15-------------17-------17-------- 3|-------------------------------------------------- 4|-------------------------------------------------- 5|-------------------------------------------------- 6|-------------------------------------------------- #| 1|-21p17----21p17----21p17----22b24-(22)------------------------- 2|-------17-------17-------17-------------9b10---(9)---9b10---9--- 3|----------------------------------------9b11---(9)---9b11---9--- 4|---------------------------------------------------------------- 5|---------------------------------------------------------------- 6|---------------------------------------------------------------- #| 1|------------------------------------------------------------------- 2|-9b10--9b10-----------------10---(10)----10-8-7---8\7---7---------- 3|-9b11--9b11--7--9--------7----------------------9-----9---9-7---7-- 4|--------------------7h9---------------------------------------9---- 5|------------------------------------------------------------------- 6|------------------------------------------------------------------- #| 1|------------------------------------------------------------------ 2|------------------------------------------------------------------ 3|-9p7---------------------------16b18-14-----14-16b18--14------14-- 4|-----9p7---7-9-7------------------------16----------------16------ 5|---------9-------9-8-7-------------------------------------------- 6|-----------------------10-7-------------------------------------- #| 1|------------------------------------ 2|------------------------------------ 3|-16b18-14----14-16b18-14--------14-- 4|----------16-------------16--16----- 5|------------------------------------ 6|------------------------------------ #| 1|----------------------------------------------------------------------- 2|-------17-------17------------17--------------------------------------- 3|-16b18----16b18----16b18---------16b18---(16)-\1/-\1/-\1/-\1/-\1/-\1/-- 4|----------------------------------------------------------------------- 5|----------------------------------------------accentuate-w/bar--------- 6|----------------------------------------------------------------------- #| 1|-21p17----21p17----21p17----21p17----21p17----21p17----- 2|-------17-------17-------17-------17-------17-------17-- 3|-------------------------------------------------------- 4|-------------------------------------------------------- 5|-------------------------------------------------------- 6|-------------------------------------------------------- #| 1|-22b24--22-22-22b24--22-22-22b24-~-~-(22)-- 2|-------------------------------------------- 3|-------------------------------------------- 4|-------------------------------------------- 5|-------------------------------------------- 6|-------------------------------------------- #| 1|-------------------------------------------------------- 2|-10p8p7------------------------------------------------- 3|--------9--9p7------------------------------------------ 4|---------------9--9p7-5--7b9---5------------------------ 5|----------------------------------7---(7)-~-~-~----5h7-- 6|------------------------------------------w/bar--------- #| 1|------------------------------------------------------ 2|------------------------------------------------------ 3|------------------------------------------------------ 4|------------------------------------------------------ 5|-4---(4)-~-~-~-~-----0----2--\1/-\1/-\1/-\1/-\1/-\1/-- 6|------------------------------------------------------ +12 Prayer Intro: #| 1|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4|------------5---------------------------5---------------------------5---------------------------5---------------------------5---------------------------5---------------------------5---------------------------5--------------- 5|--------7---------------7-----------7---------------7-----------7---------------7-----------7---------------7-----------7---------------7-----------7---------------7-----------7---------------7-----------7---------------7--- 6|----0-----------6---5-----------0-----------6---5-----------0-----------6---5-----------0-----------6---5-----------0-----------6---5-----------0-----------6---5-----------0-----------6---5-----------0-----------6---5------- +13 Bridge: #| PM--------------------------- PM--------------------------- 1|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 2|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 3|---------2---------------------2---------------------2----------------------2----------------------2---------------------2---------------------------------------------------------------- 4|-----4---------------------4---------------------4----------------------4----------------------4---------------------4-------------------------------------------------------------------- 5|-------------3---2-----------------3---2-----------------3---2------------------3---2------------------3---2-----------------3---2-----4---4---4---4---4---2---3---4---------------------- 6|--2---------------------2---------------------2----------------------2----------------------2---------------------2--------------------2---2---2---2---2---0---1---2---------------------- +14 Chorus Fill: #| PM------------ PM------------ 1|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3|----------------------------------------------------------------2--------------------------------------------------------------------------------------------------------------2------ 4|------5---4---------5---4---------5---4---------5---2---5---2-------2--------5---4-----------------------------------5---4---------5---4---------5---4---------5---2---5---2-------2-- 5|--4---3---2-----4---3---2-----4---3---2----2-----------------------------4---3---2-----2-------------------------4---3---2-----4---3---2-----4---3---2----2--------------------------- 6|--2-------------2-------------2------------0-----------------------------2-------------0-------------------------2-------------2-------------2------------0--------------------------- #| PM----------- PM----------- 1|---------------------------------------------------------------------------- 2|---------------------------------------------------------------------------- 3|------------------------------------2--------------------------------------- 4|------5---4---------5---2---5---2-------2----------------------------------- 5|--4---3---2-----2----------------------------5-------5-------4---5---5--2--- 6|--2-------------0----------------------------3---0---3---0---2---3---3--0--- +15 Rhythm Fill 2: #| sl V sl V BOOOM! sl V sl V sl V sl V sl V PM------------------- 1|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5|--2---2----/7-------------2---2----/7-------------2---2----/7-------------2---2----/7-------------2---2----/7-------------2---2----/7-------------2---2----/7--------------5-------5-------4---5---4------ 6|--0---0---------6---5-----0---0---------6---5-----0---0---------6---5-----0---0---------6---5-----0---0---------6---5-----0---0---------6---5-----0---0---------6---5------3---0---3---0---2---3---2------ +16 Outro: #| PM PM--- P PM---------------------- P PM---------------------- P PM---------------------- P 1|-------------------------------------------------------------------------------------------------------------------------------------------- 2|-------------------------------------------------------------------------------------------------------------------------------------------- 3|-------------------------------------------------------------------------------------------------------------------------------------------- 4|-------------------------------------------------------------------------------------------------------------------------------------------- 5|--2-------7-------------------3\2-----------7------------------3\2-----------7------------------3\2-----------7------------------3\2-------- 6|--0---0-------6---5---0---0---1\0---0---0------6---5---0---0---1\0---0---0------6---5---0---0---1\0---0---0------6---5---0---0---1\0-------- #| PM--- PM------- P PM--- PM------- P PM--- PM------- P PM--- PM------- P PM--------------------------- PM--------------------------- PM--------------------------- PM--------------------------- 1|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5|----------7------------------3\2-------------7------------------3\2-------------7------------------3\2-------------7------------------3\2-------------7-------------------------------7-------------------------------7-------------------------------7--------------------------- 6|--0---0------6---0---0---0---1\0-----0---0------6---0---0---0---1\0-----0---0------6---0---0---0---1\0-----0---0------6---0---0---0---1\0-----0---0-------0---0---0---0---0---0---0-------0---0---0---0---0---0---0-------0---0---0---0---0---0---0-------0---0---0---0---0------- #| PM------------------------------- 1|---------------------------------------------------------------------------- 2|---------------------------------------------------------------------------- 3|---------------------------------------------------------------------------- 4|---------------------------------------------------------------------------- 5|---------------------------------------------------------------------------- 6|--0---0---0---0---0---0---0---0---0----------------------------------------- [/cc] Note that I repeated sections where it was needed and evened out all the whitespace in regards to PalmMuting, slide, etc notations. I also created a tagging system for both what "part" we were on as well as the sequence of that part (really important for re-ordering data in a viz, especially when you have repeating "parts" that may or may not be EXACTLY the same). Which made things slightly more complicated than I anticipated, but not much. The cool thing about sequencing LINEAR rhythm parts (no multi-part overlapping yet, including solos) is that you can build Gantt charts out of it - and they actually make sense from a arrangement perspective. My Python way of converting this into a table was to use multiple dictionaries and be very conscience of column number and "line type" so they can iterated back through at the end and have the same orientation, string-wise. There are probably better ways to do this (ones that have more fault-tolerance as far as whitespace goes, etc), but this was the fastest way I could think of - and it only came out to around ~130 lines (and is already fast as hell). [cc lang="python"] import requests, pprint, json, pymssql, psutil, urllib import time, os, string, sys, time import pymssql mssql_db = pymssql.connect(host='localhost:1450', user='sa', password='****', database='FretLogic') mssql_cursor = mssql_db.cursor() pp = pprint.PrettyPrinter(indent=3)

For converting WELL FORMATTED (FULL) tablature to MSSQL Server Tables for later analysis...

f = open('sandmantab-modded.txt') line = f.readline() PMfretlogic = dict() E1fretlogic = dict() B2fretlogic = dict() G3fretlogic = dict() D4fretlogic = dict() A5fretlogic = dict() E6fretlogic = dict() PRTfretlogic = dict() POfretlogic = dict() part_type = ' ' nummPM = 0 nummE1 = 0 nummB2 = 0 nummG3 = 0 nummD4 = 0 nummA5 = 0 nummE6 = 0 for lineno, linestr in enumerate(f): print "line number: " + str(lineno) + ": " + linestr.rstrip() rowtype = linestr[0] #what string, what type of data print rowtype if rowtype == '+': part_type = str(linestr.rstrip()).replace('+','').replace(':','') part_order = str(part_type[0])+str(part_type[1]) print part_order part_type = part_type[2:] print part_type if rowtype == '?': #grab song data from ?string|shit ##Artist|Song|Album|link artist_data = str(linestr.rstrip()).replace('?','') artist = artist_data.split('|', 1)[0] song = artist_data.split('|', 2)[1] album = artist_data.split('|', 3)[2] links = artist_data.split('|', 4)[3] #print part_type for colno, linecol in enumerate(linestr): #print "line number: " + str(lineno) + " col number: " + str(colno) + ": " + linecol.rstrip() if rowtype == '#': #'PALM MUTER line' if linecol <> '|': PMfretlogic[nummPM] = str(linecol).replace("\n",'') PRTfretlogic[nummPM] = str(part_type) POfretlogic[nummPM] = str(part_order) nummPM = nummPM + 1 elif rowtype == '1': #'1E' if linecol <> '|': E1fretlogic[nummE1] = str(linecol).replace("\n",'') PRTfretlogic[nummE1] = str(part_type) POfretlogic[nummE1] = str(part_order) nummE1 = nummE1 + 1 elif rowtype == '2': #'2B' if linecol <> '|': B2fretlogic[nummB2] = str(linecol).replace("\n",'') PRTfretlogic[nummB2] = str(part_type) POfretlogic[nummB2] = str(part_order) nummB2 = nummB2 + 1 elif rowtype == '3': #'3G' if linecol <> '|': G3fretlogic[nummG3] = str(linecol).replace("\n",'') PRTfretlogic[nummG3] = str(part_type) POfretlogic[nummG3] = str(part_order) nummG3 = nummG3 + 1 elif rowtype == '4': #'4D' if linecol <> '|': D4fretlogic[nummD4] = str(linecol).replace("\n",'') PRTfretlogic[nummD4] = str(part_type) POfretlogic[nummD4] = str(part_order) nummD4 = nummD4 + 1 elif rowtype == '5': #'5A' if linecol <> '|': A5fretlogic[nummA5] = str(linecol).replace("\n",'') PRTfretlogic[nummA5] = str(part_type) POfretlogic[nummA5] = str(part_order) nummA5 = nummA5 + 1 elif rowtype == '6': #'6E' if linecol <> '|': E6fretlogic[nummE6] = str(linecol).replace("\n",'') PRTfretlogic[nummE6] = str(part_type) POfretlogic[nummE6] = str(part_order) nummE6 = nummE6 + 1 #pp.pprint(B2fretlogic) print 'cols ' + str(nummPM) + ' ' + str(nummE1) + ' ' + str(nummB2) + ' ' + str(nummG3) + ' ' + str(nummD4) + ' ' + str(nummA5) + ' ' + str(nummE6) print 'lines ' + str(lineno) for i in range(nummE1): try: if str(E1fretlogic[i]) == '1' and str(B2fretlogic[i]) == '2' and str(G3fretlogic[i]) == '3' and str(D4fretlogic[i]) == '4' and str(A5fretlogic[i]) == '5' and str(E6fretlogic[i]) == '6': pass elif str(E1fretlogic[i]) == '': pass else: print str(i) + '-' +str(artist) + ' ' + str(song) + ' ' + str(album) + ' ' + str(links) + ' ' +str(PRTfretlogic[i]) + ' ' + str(PMfretlogic[i]) + ' ' + str(E1fretlogic[i]) + ' ' + str(B2fretlogic[i]) + ' ' + str(G3fretlogic[i]) + ' ' + str(D4fretlogic[i]) + ' ' + str(A5fretlogic[i]) + ' ' + str(E6fretlogic[i]) mssql_cursor.execute("""insert into FretLogic.dbo.TabData (PickId, Test, Artist, Song, Album, TabLink, Part, PartOrder, PM, E1, B2, G3, D4, A5, E6) values ('""" + str(i) + """', GETDATE(), '""" + str(artist) + """', '""" + str(song) + """', '""" + str(album) + """', '""" + str(links) + """', '""" +str(PRTfretlogic[i]) + """', '""" +str(POfretlogic[i]) + """', '""" + str(PMfretlogic[i]) + """', '""" + str(E1fretlogic[i]) + """', '""" + str(B2fretlogic[i]) + """', '""" + str(G3fretlogic[i]) + """', '""" + str(D4fretlogic[i]) + """', '""" + str(A5fretlogic[i]) + """', '""" + str(E6fretlogic[i]) + """' )""") except: print 'cols ' + str(nummPM) + ' ' + str(nummE1) + ' ' + str(nummB2) + ' ' + str(nummG3) + ' ' + str(nummD4) + ' ' + str(nummA5) + ' ' + str(nummE6) print 'lines ' + str(lineno) print sys.exc_info()[0] #debug for fuckups print sys.exc_info()[1] #debug for fuckups print artist print song print album mssql_cursor.execute("update TabData set Vert = (E1 + CHAR(13) + B2 + CHAR(13) + G3 + CHAR(13) + D4 + CHAR(13) + A5 + CHAR(13) + E6)") mssql_db.commit() f.close() #Let's drink! [/cc]

On my TO DO List:

[unordered_list style="bullet"]

  • Actual note lookup (i.e. being able to name chords, E5, and single notes etc)
  • much less human intervention required on the source files
  • Lyrics as new line in tab reading?
  • Some type of 1:1 time references, some permitting

[/unordered_list] Regardless, I'm def going to "viz out" a few more song's off 'The Black Album' just for the hell of it. I think I can make some usability improvements over this one.