THEORY - "guitarscales" Tablature
Official THEORY Tablature & Sheet Music »
BUG ALERT! The previous posting of this program had a small error.
If you asked for a C dorian, you'd get a D dorian. All other modes
were shifted too. Here is the correct version:
-------------------------------------------------------------------
Here's a nifty little program I wrote to help guitar players learn
their scales.
You specify the starting note and the mode (Ionian,Lydian, etc), and
it produces two diagrams.
o The first is just a picture of the guitar neck showing where the all
of the notes are.
o The second shows you where the notes are for the particular tonic/mode
that you desire.
My Ibanez has 24 frets, but if you have fewer, you can easily modify
the program (just change MAXFRETS).
You can also easily modify the program to produce scales for different
tunings by changing the "guitar" array. EX: for the King's X/Pearl
Jam/Sound Garden/Neil Young "D" tuning, set it to {4,11,7,2,9,2}
With a little doing, you should be able to modify for instruments
with different number of stings (change MAXFRETS and fix draw_bound()
where it draws the "pearl inlays" on the neck).
BE FOREWARNED! This can produce W I D E output!
columns required = 6 + 6 * MAXFRETS
Example: 6 + 6 * 24 frets = 150 columns needed.
Good luck!
--------------------------------------------------------------------
#include <stdio.h>
/* Version 1.1 C dorian was really a D dorian, etc. */
/* guitar_scales.c */
/* By William A. Huston */
/* huston@ap040.ti.com or huston@mksol.dseg.ti.com */
/* Submitted to the alt.guitar 3 Jun 92 */
/* You are free to use/copy/modify, as long as you keep */
/* all of these comments intact. Thanks and enjoy! */
/* change this to be the number of frets desired. */
/* BE FOREWARNED! This can produce W I D E output! */
/* columns required = 6 + 6 * MAXFRETS */
/* Example: 6 + 6 * 24 frets = 150 columns needed */
#define MAXFRET 24
#define STRING 6
char *note_text[12] =
{ " C ", /* 0 */
"C#/Db", /* 1 */
" D ", /* 2 */
"D#/Eb", /* 3 */
" E ", /* 4 */
" F ", /* 5 */
"F#/Gb", /* 6 */
" G ", /* 7 */
"G#/Ab", /* 8 */
" A ", /* 9 */
"A#/Bb", /* 10 */
" B " }; /* 11 */
/* change the following if you use a non-standard tuning */
char guitar[STRING] = {4,11,7,2,9,4} ; /* E=4 (hi), B=11, G,D,A,E (lo) */
char mode_start[7] = {0,2,4,5,7,9,11} ; /* intervals relative to tonic for ion
ian */
char *mode_text[7] = {"Ionian","Dorian","Phrygian",
"Lydian","Mixolydian","Aeolian","Locrian"};
char note_value[12];
void draw_bound(int string)
{
int fret;
printf("\n ");
for (fret =1; fret <= MAXFRET; fret ++)
{
if (((string == 2) && ((fret == 3 ) || (fret == 5 ) || (fret == 7 ) || (
fret ==9 ) ||
(fret == 15) || (fret == 17) || (fret == 19) || (
fret ==21)
)
) ||
(((string == 1) || (string == 3)) &&
((fret == 12) || (fret == 24))
)
)
printf("|=(*)="); /* a pearl inlay! */
else
printf("|=====");
}
printf("|\n");
}
/* draw the top line */
void draw_first()
{
int fret;
printf("\n\n ");
for (fret =1;fret <=MAXFRET;fret++)
printf("|=====");
printf("|\n");
}
main(argc,argv)
int argc;
char *argv[];
{
static int tonic = -1;
static int mode = -1;
char junk[100];
int k,x,i,string,fret,crap;
if (argc == 3)
{
sscanf(argv[1],"%d",&tonic);
sscanf(argv[2],"%d",&mode);
}
while (tonic <0 || tonic >11)
{
for (x=0;x<12;x++)
printf ("\t\t%3d : %s\n",x,note_text[x]);
printf("\n What tonic? ");
gets(junk);
sscanf(junk,"%d",&tonic);
if (tonic <0 || tonic >11)
printf("*** %d is an invalid input!\n",tonic);
else
printf("The tonic you selected was %d (%s)\n",tonic,note_text[tonic]);
}
while (mode <0 || mode >6)
{
for (x=0;x<7;x++)
printf ("\t\t%3d : %s\n",x,mode_text[x]);
printf("\n What mode? ");
gets(junk);
sscanf(junk,"%d",&mode);
if (mode <0 || mode >11)
printf("*** %d is an invalid input!\n",mode);
}
printf("\nYou have picked a %s %s scale.\n\n",note_text[tonic],mode_text[mode])
;
k = mode_start[mode];
for (x=0;x<7;x++)
{
i = mode_start[(x+mode) % 7];
printf("%2d: %s\n",x+1,note_text[(tonic+i-k+12) % 12]);
note_value[(tonic+i-k+12) % 12] = x + 1 ;
}
/* print neck all notes */
draw_first();
for (string =0; string <STRING; string++)
{
for (fret =0;fret <=MAXFRET;fret++)
printf("%s|",note_text[(guitar[string]+fret) % 12]);
draw_bound(string);
}
printf("\n\n ");
for (fret =1;fret <=MAXFRET ;fret++)
printf(" %2d ",fret);
printf("\n");
/* print scale on neck */
draw_first();
for (string = 0; string <STRING; string++)
{
for (fret =0;fret <=MAXFRET;fret++)
{
if ( note_value[ (guitar[string]+fret) % 12 ])
printf("%3d |",note_value[ (guitar[string]+fret) % 12 ]);
else
printf(" |");
}
draw_bound(string);
}
}
--
Bill Huston 214-480-4610
Texas Instruments (Dallas/Forest Ln), ICC
MSG: ZAPA email: huston@ap040.csc.ti.com
If you asked for a C dorian, you'd get a D dorian. All other modes
were shifted too. Here is the correct version:
-------------------------------------------------------------------
Here's a nifty little program I wrote to help guitar players learn
their scales.
You specify the starting note and the mode (Ionian,Lydian, etc), and
it produces two diagrams.
o The first is just a picture of the guitar neck showing where the all
of the notes are.
o The second shows you where the notes are for the particular tonic/mode
that you desire.
My Ibanez has 24 frets, but if you have fewer, you can easily modify
the program (just change MAXFRETS).
You can also easily modify the program to produce scales for different
tunings by changing the "guitar" array. EX: for the King's X/Pearl
Jam/Sound Garden/Neil Young "D" tuning, set it to {4,11,7,2,9,2}
With a little doing, you should be able to modify for instruments
with different number of stings (change MAXFRETS and fix draw_bound()
where it draws the "pearl inlays" on the neck).
BE FOREWARNED! This can produce W I D E output!
columns required = 6 + 6 * MAXFRETS
Example: 6 + 6 * 24 frets = 150 columns needed.
Good luck!
--------------------------------------------------------------------
#include <stdio.h>
/* Version 1.1 C dorian was really a D dorian, etc. */
/* guitar_scales.c */
/* By William A. Huston */
/* huston@ap040.ti.com or huston@mksol.dseg.ti.com */
/* Submitted to the alt.guitar 3 Jun 92 */
/* You are free to use/copy/modify, as long as you keep */
/* all of these comments intact. Thanks and enjoy! */
/* change this to be the number of frets desired. */
/* BE FOREWARNED! This can produce W I D E output! */
/* columns required = 6 + 6 * MAXFRETS */
/* Example: 6 + 6 * 24 frets = 150 columns needed */
#define MAXFRET 24
#define STRING 6
char *note_text[12] =
{ " C ", /* 0 */
"C#/Db", /* 1 */
" D ", /* 2 */
"D#/Eb", /* 3 */
" E ", /* 4 */
" F ", /* 5 */
"F#/Gb", /* 6 */
" G ", /* 7 */
"G#/Ab", /* 8 */
" A ", /* 9 */
"A#/Bb", /* 10 */
" B " }; /* 11 */
/* change the following if you use a non-standard tuning */
char guitar[STRING] = {4,11,7,2,9,4} ; /* E=4 (hi), B=11, G,D,A,E (lo) */
char mode_start[7] = {0,2,4,5,7,9,11} ; /* intervals relative to tonic for ion
ian */
char *mode_text[7] = {"Ionian","Dorian","Phrygian",
"Lydian","Mixolydian","Aeolian","Locrian"};
char note_value[12];
void draw_bound(int string)
{
int fret;
printf("\n ");
for (fret =1; fret <= MAXFRET; fret ++)
{
if (((string == 2) && ((fret == 3 ) || (fret == 5 ) || (fret == 7 ) || (
fret ==9 ) ||
(fret == 15) || (fret == 17) || (fret == 19) || (
fret ==21)
)
) ||
(((string == 1) || (string == 3)) &&
((fret == 12) || (fret == 24))
)
)
printf("|=(*)="); /* a pearl inlay! */
else
printf("|=====");
}
printf("|\n");
}
/* draw the top line */
void draw_first()
{
int fret;
printf("\n\n ");
for (fret =1;fret <=MAXFRET;fret++)
printf("|=====");
printf("|\n");
}
main(argc,argv)
int argc;
char *argv[];
{
static int tonic = -1;
static int mode = -1;
char junk[100];
int k,x,i,string,fret,crap;
if (argc == 3)
{
sscanf(argv[1],"%d",&tonic);
sscanf(argv[2],"%d",&mode);
}
while (tonic <0 || tonic >11)
{
for (x=0;x<12;x++)
printf ("\t\t%3d : %s\n",x,note_text[x]);
printf("\n What tonic? ");
gets(junk);
sscanf(junk,"%d",&tonic);
if (tonic <0 || tonic >11)
printf("*** %d is an invalid input!\n",tonic);
else
printf("The tonic you selected was %d (%s)\n",tonic,note_text[tonic]);
}
while (mode <0 || mode >6)
{
for (x=0;x<7;x++)
printf ("\t\t%3d : %s\n",x,mode_text[x]);
printf("\n What mode? ");
gets(junk);
sscanf(junk,"%d",&mode);
if (mode <0 || mode >11)
printf("*** %d is an invalid input!\n",mode);
}
printf("\nYou have picked a %s %s scale.\n\n",note_text[tonic],mode_text[mode])
;
k = mode_start[mode];
for (x=0;x<7;x++)
{
i = mode_start[(x+mode) % 7];
printf("%2d: %s\n",x+1,note_text[(tonic+i-k+12) % 12]);
note_value[(tonic+i-k+12) % 12] = x + 1 ;
}
/* print neck all notes */
draw_first();
for (string =0; string <STRING; string++)
{
for (fret =0;fret <=MAXFRET;fret++)
printf("%s|",note_text[(guitar[string]+fret) % 12]);
draw_bound(string);
}
printf("\n\n ");
for (fret =1;fret <=MAXFRET ;fret++)
printf(" %2d ",fret);
printf("\n");
/* print scale on neck */
draw_first();
for (string = 0; string <STRING; string++)
{
for (fret =0;fret <=MAXFRET;fret++)
{
if ( note_value[ (guitar[string]+fret) % 12 ])
printf("%3d |",note_value[ (guitar[string]+fret) % 12 ]);
else
printf(" |");
}
draw_bound(string);
}
}
--
Bill Huston 214-480-4610
Texas Instruments (Dallas/Forest Ln), ICC
MSG: ZAPA email: huston@ap040.csc.ti.com
Return to THEORY Tablature »