THEORY - "scales" Tablature
Official THEORY Tablature & Sheet Music »
caltech.edu!amongst!deadhead Fri May 29 16:02:01 PDT 1992
nntp-server.caltech.edu!amongst!deadhead
Subject: GUITAR_SCALES.PS (code that works)
Date: 28 May 92 22:15:37 GMT
Sender: news@cco.caltech.edu
Lines: 292
Nntp-Posting-Host: amongst.ugcs.caltech.edu
Hey, all.
My last posting may have given you problems. This is sure to work.
====================================CUT HERE==============================
%!PS-Adobe-2.0
%%Title: scales.ps
%Following is postscript code to print scales on a guitar fretboard, my
%apologies to non-guitar players. Currently it prints scales with a
%call like:
%
% [1 -3 4 5 -7] (Blues) draw_scale
%
%where the stuff in brackets is note numbers (using - for flats), and
%the stuff in parens is the title. See the bottom of this file for
%examples. It prints out about 10 scales, including all the church
%modes and some other stuff like harmonic minors and jazz scales. You
%can easily add scales using the same format. To print it just use your
%regular print command like lpr to send the file to a postscript
%printer.
%
%To change this code to work for bass guitar search for where I made
%bass comments and do those changes, though I haven't tested that I think
%it should work (look for %BASS).
%
%Hope this helps someone, I use them a lot for practicing.
%If someone comes up with other scales to print please post them.
%
%Rick Eesley
%
% This file contains code to generate guitar scales on a postscript
% printer. To print the file try : lpr file.ps
% fret func takes a starting x y location
/fret
{ % vertical line of 25 units
1 setlinewidth
moveto % Using args on stack
%BASS Change 5 to 3
stringspace 5 mul 10 add 0 rlineto
0 -3 rlineto
%BASS Change 5 to 3
stringspace 5 mul 10 add neg 0 rlineto
closepath
stroke
} def
/gstring
{
moveto % Using args on stack
3 setlinewidth
0 fretspace 17 mul rlineto
stroke
} def
/drawfretboard
{
newpath
/fretloc starty def
18 {
startx 5 sub fretloc fret
/fretloc fretloc fretspace add def
} repeat
/stringloc startx def
newpath
%BASS Change 6 to 4
6 {
stringloc starty gstring
/stringloc stringloc stringspace add def
} repeat
% Finally, draw in octave markers...
newpath
5 setlinewidth
35 665 moveto 30 0 rlineto
270 665 moveto 30 0 rlineto
35 135 moveto 30 0 rlineto
270 135 moveto 30 0 rlineto
stroke
} def
/drawstringbox %% Args are number, string number and fret number
%% where leftmost string and bottom pos == 0,0
{
%% First calculate the y position, using fret number on stack
3 setlinewidth
newpath
fretspace mul starty add 7 add
exch
stringspace mul startx add 13 sub
exch
moveto
gsave
26 0 rlineto
0 26 rlineto
-26 0 rlineto
closepath
gsave
1 setgray
dup
1 eq {
0.8 setgray
} if
fill
grestore
0 setgray
stroke
% Finally text out the deal
/str 4 string def
dup
0 lt { % less than 0 clause
neg
10 str cvrs
grestore
/Times-Roman findfont 15 scalefont setfont
6 8 rmoveto
(-) show
str show
}
{ % gtr than 0 clause
10 str cvrs
grestore
/Times-Roman findfont 15 scalefont setfont
9 8 rmoveto
str show
} ifelse
} def
% Convert a number to a note value
/num2note
{
notearray exch get
} def
% Convert a note value to a number
/note2num
{
% Grab the value on the stack
/findval exch def
/aye 0 def
/retval aye def
12 {
notearray aye get
findval eq {
/retval aye def
} if
/aye aye 1 add def
} repeat
retval % put it on the stack and return
} def
% Subtract 1 from a note number (really just (num-1) % 11
/num_minus1
{
dup
0 eq {
pop
11
}
{
1 sub
} ifelse
} def
% Draw the box and number onto the fretboard
/draw_string_num % top_of_stack is string_number, next_stack is num_of_note
{
/stringn exch def
/notes exch def
% get the starting note for this string
/mystart strnumarray stringn get def
/mycount notes note2num def % store the notes number
/row 0 def
{
mycount mystart eq {
exit
} if
row 40 gt {
20 0 div
exit
} if
/row row 1 add def
/mycount mycount num_minus1 def
} loop
notes stringn row drawstringbox
row 5 lt {
notes stringn row 12 add drawstringbox
} if
} def
% Just draws on each of the 6 strings
/draw_num
{
% grab the top of the stack
/srick exch def
srick 0 draw_string_num
srick 1 draw_string_num
srick 2 draw_string_num
srick 3 draw_string_num
%BASS Get rid of these next 2 lines
srick 4 draw_string_num
srick 5 draw_string_num
} def
% This is the main function to call, expecting an array of notes
% and a title on the stack
/draw_scale
{
% Should be an array of notes on the stack...
/title_str exch def
/scale_array exch def
% Title the page
/Times-Roman findfont 25 scalefont setfont
330 500 moveto
title_str show
330 450 moveto
/strr 3 string def
scale_array {
dup
0 lt {
neg
10 strr cvrs
(-) show
strr show
}
{
10 strr cvrs
strr show
} ifelse
10 0 rmoveto
} forall
% Put up a fretboard
drawfretboard
scale_array {
draw_num
} forall
% And write this page
showpage
} def
%% CODE BEGINS HERE
% Global vars
/startx 95 def
/starty 30 def
/stringspace 30 def
/fretspace 44 def
% Array of notes versus note_numbers
/notearray [ 7 -7 6 -6 5 -5 4 3 -3 2 -2 1 ] def
% Starting note for each string...by notenum
/strnumarray [ 9 4 11 6 2 9 ] def
% These guys draw the scales, the draw_scale function does a
% showpage call. To add more scales just put the note numbers
% in brackets, and the name in parentheses as shown
[1 2 3 4 5 6 7] (Major or Ionian) draw_scale
[1 2 -3 4 5 -6 -7] (Minor or Aeolian) draw_scale
[1 -3 4 5 -7] (Blues) draw_scale
[1 -2 -3 -5 -6 7] (Jazz Minor) draw_scale
[1 2 -3 4 5 -6 7] (Harmonic Minor) draw_scale
[1 -2 3 4 5 -6 -7] (Spanish Flemenco) draw_scale
[1 -2 -3 4 5 -6 7] (Phyrgian Mode) draw_scale
[1 2 -3 4 5 6 7] (Melodic Minor) draw_scale
[1 2 -3 4 5 6 -7] (Dorian Mode) draw_scale
[1 2 3 -5 5 6 7] (Lydian) draw_scale
[1 2 3 4 5 6 -7] (Mixolydian) draw_scale
[1 -2 -3 4 -5 -6 -7] (Locrian) draw_scale
=================================CUT HERE===================================
Later...
--stephen
--
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% deadhead@through.ugcs.caltech.edu | | /USA/91126/170-25/stephenthompson %
% " I'll let you be in my dreams if I can be in yours. " -- Bob Dylan %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nntp-server.caltech.edu!amongst!deadhead
Subject: GUITAR_SCALES.PS (code that works)
Date: 28 May 92 22:15:37 GMT
Sender: news@cco.caltech.edu
Lines: 292
Nntp-Posting-Host: amongst.ugcs.caltech.edu
Hey, all.
My last posting may have given you problems. This is sure to work.
====================================CUT HERE==============================
%!PS-Adobe-2.0
%%Title: scales.ps
%Following is postscript code to print scales on a guitar fretboard, my
%apologies to non-guitar players. Currently it prints scales with a
%call like:
%
% [1 -3 4 5 -7] (Blues) draw_scale
%
%where the stuff in brackets is note numbers (using - for flats), and
%the stuff in parens is the title. See the bottom of this file for
%examples. It prints out about 10 scales, including all the church
%modes and some other stuff like harmonic minors and jazz scales. You
%can easily add scales using the same format. To print it just use your
%regular print command like lpr to send the file to a postscript
%printer.
%
%To change this code to work for bass guitar search for where I made
%bass comments and do those changes, though I haven't tested that I think
%it should work (look for %BASS).
%
%Hope this helps someone, I use them a lot for practicing.
%If someone comes up with other scales to print please post them.
%
%Rick Eesley
%
% This file contains code to generate guitar scales on a postscript
% printer. To print the file try : lpr file.ps
% fret func takes a starting x y location
/fret
{ % vertical line of 25 units
1 setlinewidth
moveto % Using args on stack
%BASS Change 5 to 3
stringspace 5 mul 10 add 0 rlineto
0 -3 rlineto
%BASS Change 5 to 3
stringspace 5 mul 10 add neg 0 rlineto
closepath
stroke
} def
/gstring
{
moveto % Using args on stack
3 setlinewidth
0 fretspace 17 mul rlineto
stroke
} def
/drawfretboard
{
newpath
/fretloc starty def
18 {
startx 5 sub fretloc fret
/fretloc fretloc fretspace add def
} repeat
/stringloc startx def
newpath
%BASS Change 6 to 4
6 {
stringloc starty gstring
/stringloc stringloc stringspace add def
} repeat
% Finally, draw in octave markers...
newpath
5 setlinewidth
35 665 moveto 30 0 rlineto
270 665 moveto 30 0 rlineto
35 135 moveto 30 0 rlineto
270 135 moveto 30 0 rlineto
stroke
} def
/drawstringbox %% Args are number, string number and fret number
%% where leftmost string and bottom pos == 0,0
{
%% First calculate the y position, using fret number on stack
3 setlinewidth
newpath
fretspace mul starty add 7 add
exch
stringspace mul startx add 13 sub
exch
moveto
gsave
26 0 rlineto
0 26 rlineto
-26 0 rlineto
closepath
gsave
1 setgray
dup
1 eq {
0.8 setgray
} if
fill
grestore
0 setgray
stroke
% Finally text out the deal
/str 4 string def
dup
0 lt { % less than 0 clause
neg
10 str cvrs
grestore
/Times-Roman findfont 15 scalefont setfont
6 8 rmoveto
(-) show
str show
}
{ % gtr than 0 clause
10 str cvrs
grestore
/Times-Roman findfont 15 scalefont setfont
9 8 rmoveto
str show
} ifelse
} def
% Convert a number to a note value
/num2note
{
notearray exch get
} def
% Convert a note value to a number
/note2num
{
% Grab the value on the stack
/findval exch def
/aye 0 def
/retval aye def
12 {
notearray aye get
findval eq {
/retval aye def
} if
/aye aye 1 add def
} repeat
retval % put it on the stack and return
} def
% Subtract 1 from a note number (really just (num-1) % 11
/num_minus1
{
dup
0 eq {
pop
11
}
{
1 sub
} ifelse
} def
% Draw the box and number onto the fretboard
/draw_string_num % top_of_stack is string_number, next_stack is num_of_note
{
/stringn exch def
/notes exch def
% get the starting note for this string
/mystart strnumarray stringn get def
/mycount notes note2num def % store the notes number
/row 0 def
{
mycount mystart eq {
exit
} if
row 40 gt {
20 0 div
exit
} if
/row row 1 add def
/mycount mycount num_minus1 def
} loop
notes stringn row drawstringbox
row 5 lt {
notes stringn row 12 add drawstringbox
} if
} def
% Just draws on each of the 6 strings
/draw_num
{
% grab the top of the stack
/srick exch def
srick 0 draw_string_num
srick 1 draw_string_num
srick 2 draw_string_num
srick 3 draw_string_num
%BASS Get rid of these next 2 lines
srick 4 draw_string_num
srick 5 draw_string_num
} def
% This is the main function to call, expecting an array of notes
% and a title on the stack
/draw_scale
{
% Should be an array of notes on the stack...
/title_str exch def
/scale_array exch def
% Title the page
/Times-Roman findfont 25 scalefont setfont
330 500 moveto
title_str show
330 450 moveto
/strr 3 string def
scale_array {
dup
0 lt {
neg
10 strr cvrs
(-) show
strr show
}
{
10 strr cvrs
strr show
} ifelse
10 0 rmoveto
} forall
% Put up a fretboard
drawfretboard
scale_array {
draw_num
} forall
% And write this page
showpage
} def
%% CODE BEGINS HERE
% Global vars
/startx 95 def
/starty 30 def
/stringspace 30 def
/fretspace 44 def
% Array of notes versus note_numbers
/notearray [ 7 -7 6 -6 5 -5 4 3 -3 2 -2 1 ] def
% Starting note for each string...by notenum
/strnumarray [ 9 4 11 6 2 9 ] def
% These guys draw the scales, the draw_scale function does a
% showpage call. To add more scales just put the note numbers
% in brackets, and the name in parentheses as shown
[1 2 3 4 5 6 7] (Major or Ionian) draw_scale
[1 2 -3 4 5 -6 -7] (Minor or Aeolian) draw_scale
[1 -3 4 5 -7] (Blues) draw_scale
[1 -2 -3 -5 -6 7] (Jazz Minor) draw_scale
[1 2 -3 4 5 -6 7] (Harmonic Minor) draw_scale
[1 -2 3 4 5 -6 -7] (Spanish Flemenco) draw_scale
[1 -2 -3 4 5 -6 7] (Phyrgian Mode) draw_scale
[1 2 -3 4 5 6 7] (Melodic Minor) draw_scale
[1 2 -3 4 5 6 -7] (Dorian Mode) draw_scale
[1 2 3 -5 5 6 7] (Lydian) draw_scale
[1 2 3 4 5 6 -7] (Mixolydian) draw_scale
[1 -2 -3 4 -5 -6 -7] (Locrian) draw_scale
=================================CUT HERE===================================
Later...
--stephen
--
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% deadhead@through.ugcs.caltech.edu | | /USA/91126/170-25/stephenthompson %
% " I'll let you be in my dreams if I can be in yours. " -- Bob Dylan %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Return to THEORY Tablature »