9
Challenge
Given a list a notes, you must return the corresponding tablature.
Notes
The notes must be in the range of A to G inclusive and the octave range being 2 to 6 inclusive. The format is note-octave with #
representing a sharp and b
representing a flat. E.g: A7
or F#3
.
Tabs
Tablature is a method of writing music, by diagrammatically representing the instrument. It is usually represented as five lines with numbers on them.
The numbers that are written on the lines represent the fret used to obtain the desired pitch. For example, the number 3 written on the top line of the staff indicates that the player should press down at the third fret on the high E (first string). Number 0 denotes the nut — that is, an open string.
Fret numbers may not be greater than 22 and the guitar is six string.
The tablature must be in the standard ASCII format. You must not include any technique indicators (hammer on, slide etc.). Separate each note by five dashes. In the case of double digits, reduce the number of dashes to four.
The beginning of the tab should look like this:
e |-----
B |-----
G |-----
D |-----
A |-----
E |-----
And the end should look like:
-----|
for all lines.
(source: justinguitar.com)
Example
Input: C3 C3 D3 E3 F3
Output:
e |-----------------------------------|
B |-----------------------------------|
G |-----------------------------------|
D |-----------------0-----2-----3-----|
A |-----3-----3-----------------------|
E |-----------------------------------|
Winning
The shortest code wins
Do we need to use appropriate strings in our output? What's to stop us from outputting tablature that only uses the E string? – danmcardle – 2014-10-13T18:37:32.607
@crazedgremlin You need to take into account the octaves. Only using the E string means that the note wouldn't be in the appropriate octave. – Beta Decay – 2014-10-13T18:39:48.853
To raise a note by one octave, we could add 12 frets to the fret value. Is there a rule to prevent this that I missed? – danmcardle – 2014-10-13T18:46:37.617
@crazedgremlin You may, but this only provides two octaves. – Beta Decay – 2014-10-13T18:47:58.823
I'm just being pedantic, but you never said I can't have a really long guitar with 1000 frets. – danmcardle – 2014-10-13T18:58:24.957
@crazedgremlin Haha I've edited that in, but I'd love to see a thousand fret guitar :) – Beta Decay – 2014-10-13T19:04:20.620
@steveverrill A double-neck guitar, combining a five string bass and standard tuning 24-fret guitar, could potentially span B0 to E6... – i alarmed alien – 2014-10-14T00:16:55.923
There were no close votes yesterday, when the question was being clarified. Would today's close voters care to explain what the problem is? I'm deleting my clarifications because as far as I am concerned the question is now pretty clear. The only things I can see wrong are that the range of a 22-fret guitar is exactly E2 to D6 (not complete octaves 2 and 6) and the I/O is not defined (I assume commandline,stdin,function argument are all acceptable, as well as stdout or function return.) – Level River St – 2014-10-14T21:13:07.357
Ok, there is another guitar tab question in the Related but it is completely different: it asks for chords, whereas this one asks for melody notes in specific octaves. This is not a duplicate of that one. Speak up before you closevote and these things can be clarified! – Level River St – 2014-10-14T23:14:13.863
I assume we need to use standard tuning? ;) – Valentin Grégoire – 2014-10-15T14:35:02.300
@ValentinGrégoire Yep :) – Beta Decay – 2014-10-15T14:36:04.390