def run_wordstrument(self, text_in, scale, midi=None): if text_in is None or text_in == '': template_values = { 'http_get': True, 'error': "No text to put into the wordstrument. Try again." } return template_values text_in = text_in.strip() raw_notes = Sequence(text_in) raw_notes_str = raw_notes.to_str() raw_notes.set_scale(scale.strip()) raw_notes.snap_to_key() raw_notes.snap_to_time_signature() in_key_notes_str = raw_notes.to_str() # tablature fretboard = tablature.GuitarFretboard(tablature.six_string_std) tab = tablature.GuitarTabSequence(fretboard, raw_notes) template_values = { 'http_get': False, 'text_in': text_in, 'root': raw_notes.get_root(), 'scale_used': raw_notes.get_scale_name(), 'scales': get_scale_names(), 'vextab_codes': tab.split_str(), 'abc_notation': raw_notes.to_abc_notation(), 'chrange': range(128), 'url_query': urllib.urlencode(dict([['q',text_in],['s',raw_notes.get_scale_name()]])) } return template_values
def get(self): template_values = { 'http_get': True, 'scales': get_scale_names() } path = os.path.join( os.path.dirname(__file__), '..', 'templates', 'guitarscalefinder.html' ) self.response.out.write(template.render(path, template_values))
def get(self): input = self.request.get('q') if input is not None and input != '': template_values = self.run_wordstrument( urllib.unquote_plus(self.request.get('q')), urllib.unquote_plus(self.request.get('s')) ) else: template_values = { 'http_get': True, 'scales': get_scale_names(), } path = os.path.join( os.path.dirname(__file__), '..', 'templates', 'wordstrument.html' ) self.response.out.write(template.render(path, template_values))
def runGuitarScaleFinder(self, root, scale, tuning=None): try: gsf = GuitarScaleFinder(root, scale) print gsf.to_str() template_values = { 'http_get': False, 'root': root, 'scale_used': scale, 'scales': get_scale_names(), 'vextab_codes': gsf.split_str(12) } except DeadlineExceededError: template_values = { 'http_get': True, 'error': "The request has timed out, please try another." } return template_values