def find(self): """ Returns count, instanecs """ count = 0 instances = [] chord_sequences = self.sequences_of(3) for sequence in chord_sequences: if sequence[0].half_diminished: if sequence[1].dominant: if sequence[2].minor: # It's 0 7 -, check intervals interval1 = interval(sequence[0].root, sequence[1].root) interval2 = interval(sequence[1].root, sequence[2].root) if interval1 == P4: if interval2 == P4: count += 1 instances.append(sequence) return count, instances
def find(self): """ Returns count, instances """ count = 0 instances = [] chord_sequences = self.sequences_of(5) for sequence in chord_sequences: # Frist bar is e.g. C-7 C-7/Bb if sequence[0].minor: if sequence[0].root == sequence[1].root: if sequence[1].bass_note: if interval(sequence[0].root, sequence[1].bass_note) == m7: # bars 2&3 are a minor 251 of 5 interval1 = interval(sequence[0].root, sequence[2].root) interval2 = interval(sequence[2].root, sequence[3].root) interval3 = interval(sequence[3].root, sequence[4].root) if sequence[2].half_diminished: if sequence[3].dominant: if sequence[4].minor: if interval1 == M6: if interval2 == P4: if interval3 == P4: count += 1 instances.append(sequence) return count, instances
def find(self): """ Returns count, instanecs """ count = 0 instances = [] chord_sequences = self.sequences_of(4) for sequence in chord_sequences: if sequence[0].minor: if sequence[1].minor: if sequence[ 2].dominant: # It's major, minor, minor, dominant, check intervals if sequence[3].major: interval1 = interval(sequence[0].root, sequence[1].root) interval2 = interval(sequence[1].root, sequence[2].root) interval3 = interval(sequence[2].root, sequence[3].root) if interval1 == P4: if interval2 == P4: if interval3 == P4: count += 1 instances.append(sequence) return count, instances
def find(self): """ returns count, instances """ count = 0 instances = [] chord_sequences = self.sequences_of(4) for sequence in chord_sequences: if [c for c in sequence if not c.dominant]: continue # Do they move in fourths? interval1 = interval(sequence[0].root, sequence[1].root) interval2 = interval(sequence[1].root, sequence[2].root) interval3 = interval(sequence[2].root, sequence[3].root) if interval1 == P4 and interval2 == P4 and interval3 == P4: count += 1 instances.append(sequence) return count, instances
def find(self): """ Returns count, instances """ count = 0 instances = [] chord_sequences = self.sequences_of(2) for sequence in chord_sequences: if sequence[0].dominant and sequence[1].dominant: if interval(sequence[0].root, sequence[1].root) == P4: count += 1 instances.append(sequence) return count, instances
def test_interval(self): self.assertEqual('Perfect Fourth', music.interval('C', 'F'))
def test_interval_crosses_octave(self): self.assertEqual('Major Third', music.interval('G', 'B'))