def __init__(self): self.pa = pyaudio.PyAudio() self.stream = self.open_mic_stream() self.tap_threshold = INITIAL_TAP_THRESHOLD self.noisycount = MAX_TAP_BLOCKS+1 self.quietcount = 0 self.errorcount = 0 self.notes = unpickle_it(piano_frequencies_pickle)
scales[scale_note]['major'] = [notes[x+key]['scale_note'] for x in major] scales[scale_note]['minor'] = [notes[x+key]['scale_note'] for x in minor] pickle_it(scales_pickle, scales) pprint(scales) def all_trichords(notes): trichords = {} major = [0, 4, 7] minor = [0, 3, 7] sept = [0, 4, 7, 10] for key, value in notes.items(): if value['octave'] == 1: scale_note = value['scale_note'] if scale_note not in trichords.keys(): trichords[scale_note] = {'major': [], 'minor': [], 'sept': []} trichords[scale_note]['major'] = [notes[x+key]['scale_note'] for x in major] trichords[scale_note]['minor'] = [notes[x+key]['scale_note'] for x in minor] trichords[scale_note]['sept'] = [notes[x+key]['scale_note'] for x in sept] pprint(trichords) pickle_it(trichords_pickle, trichords) if __name__ == '__main__': # get_all_piano_frequencies() notes = unpickle_it(piano_frequencies_pickle) # all_note_occurences(notes) all_scales(notes) # all_trichords(notes)