Created
July 13, 2014 16:24
-
-
Save rxw1/16bfd219b18a8cd9fca9 to your computer and use it in GitHub Desktop.
Disassemble guitar tabs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|--0--2--|--3----2--0-------0--2--|-------------0----------|------------------------|--------------------0--2--|--3----2--0-------0--2--|-------------0----------|---------------------------|---------------0--2--|---------------------|------------------3-----|--0---------------------|------------------------|-------------------------|-------3-----0----------|-------5-----2-------0--|----------------------------|-------------------7-----|-------------5-------3--|--2----0-----3-------1--|--0----5--0--2-------0--|-------------------0-----|--------------------------|-------------------------|---------------------------|---------------------|-------------------| | |
|--------|-------------4----------|--0----2--4-------3--1--|--0---------------------|--0-----------------------|-------------4----------|--0----2--4-------3--1--|--0------------------------|---------------------|---------------0-----|--3-------1--0-------3--|----------3--1----------|----------0--1----0-----|-------------------3-----|--0-------3----------3--|--1-------5-------2-----|--3----2--0--------------0--|--0-------------------7--|--9----7--5-------5-----|----------3-------3-----|------------------2-----|--4-------------------0--|--1-----3-----0-----1-----|--------0----------------|---------------------------|---------------0-----|-------------------| | |
|--------|------------------------|------------------------|-------2--0-------0--2--|-----2--0-----------------|------------------------|------------------------|-------2--0--------0----0--|--0------------------|--0---------------0--|-------2----------------|-------4----------4--2--|--1----2-------------2--|--2-------------------2--|------------------4-----|------------------------|-------------4-3-4-3-4-3----|-------------------------|------------------------|------------------------|------------------------|-------4-----------------|-----------2-----------0--|--2-----------0----------|-------------0----0--------|------------------0--|-------------------| | |
|--------|------------------------|------------------------|-------------4----------|-----------4--2-----------|------------------------|------------------------|-------------4-2-4---4-----|--0------------------|--0------------------|-------0----------------|------------------0-----|--2----------2----------|-------------------0-----|------------------------|-------------0----------|-------2-----4--------------|--------------1----------|------------------------|--0---------------------|------------------------|-------------------------|-----2--4--------1--2-----|-----------4-------4--2--|--1----2--4-----4---4-2-4--|--2------------------|--2----------------| | |
|--------|-------0-----2----0-----|------------------------|-------0-----2----0-----|--------2-----------------|-------0-----2----0-----|------------------------|-------3-----5-------5-----|--2------------------|--2------------------|------------------2-----|--3----------0----------|-------0----------------|--0--2--0----------------|-------2-----3----------|--0----4----------1-----|--2-------------------------|--2--1--2--4-------------|--7----5-----4----------|-------3-----2----------|--3----2-----0----------|--2-------3--2--0--------|--0-----------------------|-----4--6----------0-----|--2----0-----2-------------|---------------------|--2----------------| | |
|--3--2--|--0---------------------|--3----2-----0----2-----|--3---------------------|--3-----------0--2--3--2--|--0---------------------|--3----2-----0----2-----|--3------------------------|--3------------3--2--|--3------------3-----|--2----------3----------|-------4----------------|------------------0-----|-----------3--2----------|--3---------------4-----|------------------------|---------------------2------|-------------------7-----|------------------5-----|------------------3-----|------------------2-----|-------------------4-----|--------------3-----------|--2-----------0----------|---------------------------|--0------------3-----|--0----------------| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reads a file containing a guitar tabulature. | |
# Returns a sorted tabulature with all the unique patterns. | |
File.read(ARGV[0]).split.map{|x|x.split'|'}.transpose.map{|x|x.map{|y|y.scan(/./)}}.map(&:transpose).flatten(1).uniq.sort.transpose.map{|x|x.join('-')} | |
# For sample input see bouree.txt below. The whole tab should be without linebreaks except the one separating the strings. The output should look like this: | |
# "----------------------------------------------------------------------------------------------------------------------0-0-0-0-0-0-1-2-2-2-2-3-3-3-5-5-7" | |
# "----------------------------------------------------------------------0-0-0-0-0-1-1-1-2-2-2-3-3-3-3-3-3-4-4-5-5-7-7-9----------------------------------" | |
# "------------------------------------0-0-0-0-0-1-2-2-2-2-2-3-4-4-4-4-4----------------------------------------------------------------------------------" | |
# "----------------1-1-2-2-2-2-4-4-4-4---------0-2---------0---------0-4---------------2-----2---------0-4-----------------------------------0------------" | |
# "------0-1-2-3-4---2-----0-2---0-2-5-----0-2-2-------0-3---------------------2-6---0-----1---------2-------2-------5-7---------0-3-------0-------2-2-4--" | |
# "--2-3-----------------0---0-----------0-----3-----2-----------2-4-------0-3-----------2-------2-3-------------5---------0-3-4---------2-------0-------7" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment