def __create_chord_on_diatonic_without_type(self, diatonic_tone): from tonalmodel.tonality import Tonality from tonalmodel.modality import ModalityType from harmonicmodel.tertian_chord_template import TertianChordTemplate diatonic_tonality = Tonality.create(ModalityType.Major, diatonic_tone) tone_scale = diatonic_tonality.annotation self.chord_basis = [] base_tone = None for i in range(0, 3): tone = tone_scale[(2 * i) % (len(tone_scale) - 1)] if i == 0: base_tone = tone pitch_a = DiatonicPitch(1, diatonic_tone) b_octave = 2 if base_tone.diatonic_index > tone.diatonic_index else 1 pitch_b = DiatonicPitch(b_octave, tone.diatonic_symbol) interval = Interval.create_interval(pitch_a, pitch_b) self.chord_basis.append(interval) self.__tones.append((tone, interval)) self.__set_inversion() self.__chord_type = TertianChordTemplate.get_chord_type( self.chord_basis)
def __create_chord_on_scale_degree(self): from harmonicmodel.tertian_chord_template import TertianChordTemplate root_index = self.chord_template.scale_degree - 1 tone_scale = self.diatonic_tonality.annotation self.chord_basis = [] base_tone = None for i in range(0, 3): tone = tone_scale[(root_index + 2 * i) % (len(tone_scale) - 1)] if i == 0: base_tone = tone pitch_a = DiatonicPitch(1, tone_scale[root_index].diatonic_symbol) b_octave = 2 if base_tone.diatonic_index > tone.diatonic_index else 1 pitch_b = DiatonicPitch(b_octave, tone.diatonic_symbol) interval = Interval.create_interval(pitch_a, pitch_b) self.chord_basis.append(interval) self.__tones.append((tone, interval)) self.__set_inversion() self.__chord_type = TertianChordTemplate.get_chord_type( self.chord_basis)