def rhythm_6_17_left(self, chord: Chord) -> [Chord]: rhythm = [] new_chord = NoteSeq() new_chord.append(chord.first_note.octave_shift(-1)) new_chord.append(chord.first_note.octave_shift(-2)) rhythm.append(new_chord.stretch_dur(12 / self.subdivided)) rhythm.append(new_chord.stretch_dur(12 / self.subdivided)) rhythm.append(new_chord.stretch_dur(8 / self.subdivided)) return rhythm
def rhythm_heart_and_soul_right(self, chord: Chord) -> [NoteSeq]: rhythm = [] new_chord = chord silence_chord = NoteSeq("R") rhythm.append(silence_chord.stretch_dur(8 / self.subdivided)) rhythm.append(new_chord.stretch_dur(4 / self.subdivided)) rhythm.append(new_chord.stretch_dur(4 / self.subdivided)) rhythm.append(silence_chord.stretch_dur(8 / self.subdivided)) rhythm.append(new_chord.stretch_dur(4 / self.subdivided)) rhythm.append(new_chord.stretch_dur(4 / self.subdivided)) return rhythm
def josquin(): main_theme = NoteSeq("file://josquin") theme1 = main_theme.stretch_dur(0.66666) theme2 = main_theme[0:24].stretch_dur(2).transp(Note("C")) theme3 = main_theme[0:50] midi = Midi(3, tempo=80) midi.seq_notes(theme1, track=0) midi.seq_notes(theme2, track=1) midi.seq_notes(theme3, track=2) midi.write("midi/josquin.mid")
def abstraction(): a = NoteSeq("C4. Eb8") a1 = a.transp(5).stretch_dur(0.5) a2 = a.inv("Db''") a3 = a1.inv(8) A = a + a1 + a2 + a3 A2 = A.transp(2) B = a1.transp(8) + a1.transp("Eb''") c = NoteSeq([Note(x.value, dur=0.125) for x in a + a1]) C = (c.inv("Ab''") + c.inv(10) + c.stretch_inverval(2).transp(2) + c.inv("G''") + c.inv("E''").stretch_inverval(1) + c.inv("A").stretch_inverval(1)) a4 = a.stretch_dur(2).inv(6) Part1 = A + NoteSeq("C2") + A2 + B Part2 = C + a4 midi = Midi(1, tempo=90) midi.seq_notes(Part1 + Part2, track=0) midi.write("midi/abstraction.mid")
def test_stretch_dur(self): seq1 = NoteSeq("C4 D8 E8") seq2 = NoteSeq("C8 D16 E16") seq3 = NoteSeq("C2 D4 E4") self.assertEqual(seq1.stretch_dur(.5), seq2) self.assertEqual(seq1.stretch_dur(2), seq3)
def stretch_dur(self, factor): return Chord(NoteSeq.stretch_dur(self, factor).items, first_note=self.first_note, name=self.name)