Skip to content

Instantly share code, notes, and snippets.

@Silverwolf90
Created June 5, 2014 20:39
Show Gist options
  • Save Silverwolf90/231943b0422f3eab3e7b to your computer and use it in GitHub Desktop.
Save Silverwolf90/231943b0422f3eab3e7b to your computer and use it in GitHub Desktop.
MAX_STRINGS = 6
MAX_FRETS = 12
def note_filter(key):
if key in ['C','G','D','A','E','B','F#','C#']:
return ['C','C#','D','D#','E','F','F#','G','G#','A','A#','B',]
else:
return ['C','Db','D','Eb','E','F','Gb','G','Ab','A','Bb','B']
def string_prep(start, notes):
#This function is intended to provide an organized string of notes that can be used to generate the
#note values for a guitar string
prepared_notes = []
note_counter = 0
found_note = 0
while note_counter < len(notes):
if notes[note_counter] == start:
found_note = note_counter #records the location of the open string note in the raw note list
while note_counter < len(notes):
prepared_notes.append(notes[note_counter])
print prepared_notes
note_counter = note_counter + 1
if note_counter > 11:
print note_counter
note_counter = 0 #starts over at beginning of notes
print found_note
elif note_counter == found_note :#breaks out of prepared list creation
print note_counter
return prepared_notes
else:
note_counter = note_counter + 1
class string(object):
# returns a list of note objects that contain a fret and a pitch value
string = []
fret = 0
def __init__(self):
def create_string(self,filtered_notes):
fret = 0
for pitch in filtered_notes:
string.append(note(pitch,fret))
fret = fret + 1
return string
class note(object):
def __init__(self,pitch,fret):
self.pitch = pitch
self.fret = fret
#attempt to generate an E_String
string_1 = string(string_prep('E',note_filter('E')))
print string_1.filtered_notes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment