def _append_octave(self, xpose: int = 0) -> list: tmp = transpose(list(self.template), xpose) if self.ascending: tmp.append(transpose(tmp[0], 12)) else: tmp.append(transpose(tmp[0], -12)) return tmp
def transpose(self, steps: int) -> list: """ Transposes other key numbers. :param steps: Size of transposition. :return: List of keynumbers. """ return transpose(self.template, steps)
def transposed(self, steps: int, new_name=None) -> "Scale": """ Produces transposed copy of scale template. :param steps: :param new_name: :return: """ s = Scale(new_name or self.name, transpose(self.template, steps)) return s
def _find_chords(self, *_): user_pattern = self._validate_user_chord( self._ui.line_edit_user_chord.text()) if user_pattern: root = user_pattern[0] root_pc = pitchclass(root) root_octave = octave(root) if root_octave > 0: user_pattern = transpose(user_pattern, -12 * root_octave) root = root_pc user_chord = Chord("User", user_pattern) mode = self.chord_match_mode if mode == ChordMatchMode.SUB: self._ui.dspin_threshold.setEnabled(False) self._find_sub_chords(user_chord) elif mode == ChordMatchMode.SUPER: self._ui.dspin_threshold.setEnabled(False) self._find_super_chords(user_chord) else: self._ui.dspin_threshold.setEnabled(True) threshold = self._ui.dspin_threshold.value() self._find_similar_chords(user_chord, threshold)
def update_ui(self, *_): template = self.template self._ui.line_edit_template.setText(self.keylist_to_string(template)) self._ui.line_edit_pattern.setText(interval_pattern(template)) chord = transpose(template, self.transpose) self._ui.line_edit_chord.setText(self.keylist_to_string(chord))
def _rotate_once(lst: list) -> list: acc = lst[1:] acc.append(transpose(lst[0], 12)) return acc
def _base_form(chord: list) -> list: head = keynumber(chord[0]) return transpose(chord, -head)
_add("Diminished 7", [0, 3, 6, 9]) _add("Minor sharp 9", [0, 3, 7, 11, 14]) _add("Minor 9", [0, 3, 7, 10, 14]) _add("Minor 6 9", [0, 3, 7, 9, 14]) _add("Minor 11", [0, 3, 7, 10, 14, 17]) _add("Minor add 9", [0, 3, 7, 14]) _add("Minor add 11", [0, 3, 7, 17]) _add("whole-6", [0, 2, 4, 6, 8, 10], "whole-tone cluster") _add("Cycle minor 3rds", [0, 3, 6, 9]) _add("Cycle major 3rds", [0, 4, 8]) _add("Cycle perfect 4ths", [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55]) _add("Cycle perfect 5ths", [0, 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77]) _add("Cycle augmented 5ths", [0, 8, 16]) _add("Cycle major 6ths", [0, 9, 18, 27]) _add("Cycle major 7ths", [0, 11, 22, 33, 44, 55], "1/2 cycle of major 7ths") _add("Cycle minor 7ths", [0, 10, 20, 30, 40, 50], "Cycle of minor 7ths") CHORD_DICTIONARY = {} """ Maps names to Chord objects. Unlike CHORD_TEMPLATE_DICTIONARY, where all chords are in the key of C, CHORD_DICTIONARY contains chords for all keys. """ for (template_name, root) in CHORD_TEMPLATE_DICTIONARY.items(): for key in range(0, 12): text = "%-3s %s" % (keyname(key), template_name) note_list = transpose(root.template, key) CHORD_DICTIONARY[text] = Chord(text, note_list)