Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Guitar neck diagram thingy

by Big Willy (Scribe)
on Mar 13, 2001 at 02:57 UTC ( #64009=CUFP: print w/ replies, xml ) Need Help??

This perl program is cool for those guitar/fretted-stringed instrument players who like a little bit o' help when it comes to rememebering scale positions. I always have a problem with some of the last major positions and it always helped me to look at the scales on a diagram. Try this guy:

#!/usr/bin/perl -w use strict; my %octave = ('A', '-', 'A#', '-', 'B', '-', 'C', '-', 'C#', '-', 'D', '-', 'D#', '-', 'E', '-', 'F', '-', 'F#', '-', 'G', '-', 'G#', '-'); my @strings = ('G', 'D', 'A', 'E'); my @notes = @ARGV; my $note; foreach $note (@notes) { $note = uc($note); if($note =~ /^([A-G])B$/) { if($1 eq "A") { $note = "G#"; } else { $note = chr(ord($1) - 1) . "#"; } } $octave{$note} = $note; } my @octave_old = sort keys %octave; my @octave_new = (); foreach (@octave_old) { push(@octave_new, $octave{$_}); } print " 0 1 2 3 4 5 6 7 8 9 10 11 1 +2\n"; foreach $note (@strings) { while ($note ne $octave_old[0]) { push(@octave_new, shift(@octave_new)); push(@octave_old, shift(@octave_old)); } foreach $note (@octave_new) { print "| $note "; if ($note !~ /[#&]/) { print " "; } } print "| $octave_new[0]\n"; }
So if I want to print out a diagram of major scale in C (C, D, E, F, G, A, B), this little jewel works great. Just type this on your console and out pops your diagram:

neckdia.pl C D E F G A B

   0    1    2    3    4    5    6    7    8    9   10   11   12
| G  | -  | A  | -  | B  | C  | -  | D  | -  | E  | F  | -  | G
| D  | -  | E  | F  | -  | G  | -  | A  | -  | B  | C  | -  | D
| A  | -  | B  | C  | -  | D  | -  | E  | F  | -  | G  | -  | A
| E  | F  | -  | G  | -  | A  | -  | B  | C  | -  | D  | -  | E

Boom, I got a major C diagram over one octave on my neck. I've got this setup for standard tuning on a four string bass, but it's easy to change that. Not far from the top of the program is a line that says

my @strings = ('G', 'D', 'A', 'E');
If I want a standard guitar tuning I just change this line of code to

my @strings = ('E', 'B', 'G', 'D', 'A', 'E');
Or if I want drop D tuning on my bass (who would want that, honestly?), bang:

my @strings = ('G', 'D', 'A', 'D');
This is pretty basic right now. I just whipped this up the other day out of frustration. Please note that if you enter flats on the command line that they will be switched to the appropriate shrap for simplicity sake. DO NOT put flats in the @strings array. That will produce unruly behavior.

Comment on Guitar neck diagram thingy
Download Code
Re: Guitar neck diagram thingy
by larsen (Parson) on Mar 13, 2001 at 14:07 UTC
Re: Guitar neck diagram thingy
by cei (Monk) on Mar 14, 2001 at 00:16 UTC
    Hmm. When I think drop D tuning on bass, I usually go with

    my @strings = ('G', 'D', 'A', 'D');

    But I'd like to try this for my NS/Stick...

    my @strings = ('A#', 'F', 'C', 'G', 'D', 'A', 'E', 'B');

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://64009]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (17)
As of 2014-10-30 17:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (208 votes), past polls