def test__get_all_transforms_minimal(self): fileloader.load(constants.TEST_MIDI + 'maj3_scalar.mid', False) chords.write('C') alto = sequences.alto() g4 = sequences.Note(alto, 0, 96, pitches.MIDI_VALUES['G4']) b4 = sequences.Note(alto, 96, 192, pitches.MIDI_VALUES['B4']) alto.add_entities(g4, b4) self.assertEqual(124, len(transforms.get_all_transforms(0, 96, 4)))
def test__root_tendency_score(self): fileloader.load(constants.TEST_MIDI + 'quarter_arpeg.mid', False) chords.write('G') chords.write('E-', beat=2) g = 55 e = 64 beat1 = time.beat_at_index(0) beat2 = time.beat_at_index(1) beat3 = time.beat_at_index(2) self.assertEqual(vars.FIRST_BEAT_BASS_ROOT, note_picker.bass_note_tendency_score(g, beat1)) self.assertEqual(vars.BASS_ROOT_SAME_CHORD, note_picker.bass_note_tendency_score(g, beat2)) self.assertEqual(vars.BASS_NOTE_NEW_CHORD, note_picker.bass_note_tendency_score(e, beat3))
def test__get_all_transforms(self): fileloader.load(constants.TEST_MIDI + 'maj3_scalar.mid', False) chords.write('C') alto = sequences.alto() tenor = sequences.tenor() bass = sequences.bass() g4_alto = sequences.Note(alto, 0, 96, pitches.MIDI_VALUES['G4']) b4_alto = sequences.Note(alto, 96, 192, pitches.MIDI_VALUES['B4']) e4_tenor = sequences.Note(tenor, 0, 96, pitches.MIDI_VALUES['E4']) g4_tenor = sequences.Note(tenor, 96, 192, pitches.MIDI_VALUES['G4']) c4_bass = sequences.Note(bass, 0, 96, pitches.MIDI_VALUES['C4']) e4_bass = sequences.Note(bass, 96, 192, pitches.MIDI_VALUES['E4']) alto.add_entities(g4_alto, b4_alto) tenor.add_entities(e4_tenor, g4_tenor) bass.add_entities(c4_bass, e4_bass) t = transforms.get_all_transforms(0, 96, 3) e = 1
def test__ChordProgression_chords_in_measure(self): fileloader.load(constants.TEST_MIDI + 'mixed_meter.mid', False) measure_0 = time.measure(0) measure_1 = time.measure(1) measure_3 = time.measure(3) chords.write('C') chords.write('A-', measure=0, beat=1) chords.write('E-', measure=0, beat=2) chords.write('G', measure=0, beat=3) chords.write('G', measure=3, beat=0) chords.write('C', measure=3, beat=3) self.assertEqual(4, len(chords.in_measure(measure_0))) self.assertEqual(0, len(chords.in_measure(measure_1))) self.assertEqual(2, len(chords.in_measure(measure_3)))
def four_eight(): chords.write('F', measure=0) chords.write('C7', measure=0, beat=1) chords.write('A-', measure=0, beat=2) chords.write('G-', measure=0, beat=3) chords.write('F', measure=1) chords.write('Bb', measure=1, beat=2) chords.write('F', measure=2) chords.write('C', measure=2, beat=1) chords.write('D-', measure=2, beat=2) chords.write('Bb', measure=2, beat=3) chords.write('F', measure=3) chords.write('C7', measure=3, beat=2)
def six_four(): chords.write('C-', measure=0, beat=0) chords.write('Ab', measure=0, beat=3) chords.write('G7', measure=1) chords.write('C-', measure=1, beat=2) chords.write('F-', measure=1, beat=3) chords.write('C-', measure=2) chords.write('Ddim', measure=2, beat=3) chords.write('G7', measure=3, beat=3)
def three_four(): chords.write('C', measure=0, beat=0) chords.write('Eb', measure=1) chords.write('Ab', measure=2) chords.write('G7', measure=3) chords.write('C-', measure=3, beat=2)
def two_four(): chords.write('C', measure=0, beat=0) chords.write('G', measure=2) chords.write('C', measure=3) chords.write('D-', measure=4) chords.write('G7', measure=4, beat=1) chords.write('A-', measure=5) chords.write('F', measure=6) chords.write('G', measure=7)
def key_changes(): chords.write('C') chords.write('F-', measure=0, beat=2) chords.write('Bb7', measure=0, beat=3) chords.write('Eb', measure=1) chords.write('A-', measure=2) chords.write('D7', measure=2, beat=1) chords.write('G', measure=2, beat=2) chords.write('B-', measure=3) chords.write('E7', measure=3, beat=2) chords.write('A', measure=4)
def mixed_meter(): chords.write('C') chords.write('G', beat=2) chords.write('C', measure=1) chords.write('G', measure=1, beat=1) chords.write('C', measure=1, beat=2) chords.write('C7', measure=1, beat=3) chords.write('F', measure=2) chords.write('D7sus', measure=2, beat=3) chords.write('G', measure=3) chords.write('G7', measure=3, beat=3) chords.write('C', measure=4) chords.write('A-', measure=4, beat=3) chords.write('F', measure=5) chords.write('F#dim', measure=6) chords.write('A7', measure=7) chords.write('D', measure=8) chords.write('A', measure=8, beat=1) chords.write('D7', measure=9) chords.write('G7', measure=9, beat=2) chords.write('C', measure=10)
def simple(): chords.write('C') chords.write('A-', beat=2) chords.write('E-', measure=1) chords.write('F', measure=1, beat=1) chords.write('G', measure=1, beat=2) chords.write('A-', measure=2) chords.write('C', measure=2, beat=2) chords.write('G', measure=3, beat=2) chords.write('E7', measure=3, beat=3)
def nine_eight(): chords.write('G') chords.write('D7', measure=0, beat=2) chords.write('C', measure=1) chords.write('G', measure=1, beat=1) chords.write('A-', measure=1, beat=2) chords.write('G', measure=2) chords.write('A-', measure=2, beat=1) chords.write('G', measure=2, beat=2) chords.write('D', measure=3) chords.write('A7', measure=3, beat=1) chords.write('D', measure=3, beat=2)
def six_eight(): chords.write('C-') chords.write('Ab', measure=0, beat=3) chords.write('Abdim', measure=1) chords.write('G7', measure=1, beat=3) chords.write('Bb7', measure=1, beat=5) chords.write('Eb', measure=2) chords.write('F-', measure=2, beat=3) chords.write('G7', measure=3)