def main():
    menu = """
    Welcome to Music Theory!
    You can exit by typing exit, q, quit, or x.
    
        1 - Get a key
        2 - Get a scale/mode
        3 - Get a chord/triad
    """
    while True:
        inp = checkInput(menu)
        if inp == False: break
        try:
            inp = int(inp)
            if inp == 1:
                root = getRoot()
                if not root: pass
                printScale(dia.get_notes(root))
            elif inp == 2:
                getScale()
            elif inp == 3:
                getTriad()
            else: pass
        except ValueError:
            print "Value Error: inp not ok"
            pass
        except TypeError:
            print "Type Error: inp not ok"
            pass
Exemple #2
0
 def test_get_notes(self):
     list(
         map(
             lambda x: self.assertEqual(
                 self.scale[x], diatonic.get_notes(x),
                 'Invalid notes for key %s' % self.scale[x]),
             list(self.scale.keys())))
Exemple #3
0
	def change_scale(self):
		
		if self.chord != self.state["chord"]:
			if self.verbose:
				if self.no_fluidsynth:
					sys.stdout.write("|");
			self.state["scale"] = \
				diatonic.get_notes(self.key)
			for n in self.chord:
				if n not in self.state["scale"]:
					self.replace_scale_note(n)
Exemple #4
0
def accidentals(a_list):
    """
    Takes a single NoteList object.

    Returns a list of NoteNode objects from the melody that do not exist
    in the key defined by the first bar in the melody.
    """
    key = a_list.track.bars[0].key
    notes_in_key = get_notes(key.name)
    return [
        note for note in a_list
        if note.name not in notes_in_key and not note.is_rest
    ]
Exemple #5
0
def accidentals(a_list):
    """
    Takes a single NoteList object.

    Returns a list of NoteNode objects from the melody that do not exist
    in the key defined by the first bar in the melody.
    """
    key = a_list.track.bars[0].key
    notes_in_key = get_notes(key.name)
    return [
        note for note in a_list
        if note.name not in notes_in_key
        and not note.is_rest
    ]
Exemple #6
0
	def reset_state(self):
		self.state = {
			'chord': [],
			'chords': [], 
			'progression': self.progression, 
			'progression_index': 0, 
			'iteration_tick': 0,
			'bpm': self.bpm, 
			'tick': 0, 
			'meter': self.meter, 
			'resolution': self.resolution, 
			'key': self.key,
			'scale': diatonic.get_notes(self.key), 
			'wild': self.block.get_wildness(0,0),
			'tick_function': self.tick_function,
			'paint_function': self.paint_function,
			'update_function': self.update_function,
			'swing': self.block.swing,
			}
 def Notes(self):
     """Returns a list of the notes in the scale"""
     return dia.get_notes(self.root)
 def test_get_notes(self):
     map(lambda x: self.assertEqual(self.scale[x], diatonic.get_notes(x),
         'Invalid notes for key %s' % self.scale[x]), self.scale.keys())