Пример #1
0
 def test_chord_player_plays_chords(self):
     notePlayer = ChordPlayer(self.instr1, cycle([[0, 1], [1, 0]]).next,
                              velocity=cycle([120]).next,
                              release=cycle([12]).next,
                              clock=self.clock, interval=self.dtt(1, 4))
     notePlayer.resumePlaying()
     self.runTicks(96)
     expectedPlays = [
         ('chord', 0, [0, 1], 120),
         ('chord', 24, [1, 0], 120),
         ('chord', 48, [0, 1], 120),
         ('chord', 72, [1, 0], 120),
         ('chord', 96, [0, 1], 120)]
     self.assertEquals(self.instr1.plays, expectedPlays)
     self.assertEquals(self.instr1.stops,
                       [('chord', 12, [0, 1]), ('chord', 36, [1, 0]),
                        ('chord', 60, [0, 1]), ('chord', 84, [1, 0])])
Пример #2
0
               [38, 53, 55, 67, 69, 74],
               [38, 53, 55, 65, 67, 74],
               [36, 53, 55, 65, 67, 74],
               [36, 55, 57, 65, 67, 74],
               [36, 55, 57, 60, 67, 74],
               [36, 55, 57, 60, 64, 74],
               [36, 55, 57, 60, 64, 80],
               [36, 55, 57, 60, 64, 81],
               [36, 55, 57, 60, 64, 84],
               [36, 55, 57, 60, 63, 84],
               [36, 55, 57, 60, 64, 84],
               [36, 55, 57, 60, 69, 84],
               [36, 55, 57, 60, 69, 81],
               [36, 55, 57, 60, 69, 78],
               [36, 53, 55, 60, 69, 78],
               [36, 53, 55, 62, 69, 78]])

piano = piano_f()
piano.controlChange(reverb=120, sustain=100, chorus=50, vibrato=15)

r = W((0, 5), (12, 2), (-12, 3))
f = lambda chord: [r() + n for n in chord]
arp = ArpMap(f, ChordPatternArp(notes.next(), pattern))

player = ChordPlayer(piano, arp,
                     velocity=OrderedArp([127, 80, 90, 80, 90, 120, 120, 80]),
                     release=RandomArp([11, 10, 9, 8]))
resetter = clock.schedule(lambda: arp.reset(notes.next())
        ).startAfter((2, 1), (2, 1))
player.resumePlaying()
Пример #3
0
notes = cycle([[38, 50, 62, 65, 69, 80], [38, 50, 62, 65, 69, 84],
               [38, 50, 62, 65, 67, 84], [38, 50, 62, 65, 69, 84],
               [36, 50, 62, 65, 69, 84], [36, 55, 62, 65, 69, 84],
               [36, 55, 62, 67, 69, 84], [36, 55, 60, 67, 69, 84],
               [36, 53, 55, 67, 69, 84], [36, 53, 55, 67, 69, 81],
               [36, 53, 55, 65, 69, 81], [36, 53, 55, 65, 67, 81],
               [38, 53, 55, 65, 67, 81], [38, 53, 55, 67, 69, 81],
               [38, 53, 55, 67, 69, 74], [38, 53, 55, 65, 67, 74],
               [36, 53, 55, 65, 67, 74], [36, 55, 57, 65, 67, 74],
               [36, 55, 57, 60, 67, 74], [36, 55, 57, 60, 64, 74],
               [36, 55, 57, 60, 64, 80], [36, 55, 57, 60, 64, 81],
               [36, 55, 57, 60, 64, 84], [36, 55, 57, 60, 63, 84],
               [36, 55, 57, 60, 64, 84], [36, 55, 57, 60, 69, 84],
               [36, 55, 57, 60, 69, 81], [36, 55, 57, 60, 69, 78],
               [36, 53, 55, 60, 69, 78], [36, 53, 55, 62, 69, 78]])

piano = piano_f()
piano.controlChange(reverb=120, sustain=100, chorus=50, vibrato=15)

r = W((0, 5), (12, 2), (-12, 3))
f = lambda chord: [r() + n for n in chord]
arp = ArpMap(f, ChordPatternArp(notes.next(), pattern))

player = ChordPlayer(piano,
                     arp,
                     velocity=OrderedArp([127, 80, 90, 80, 90, 120, 120, 80]),
                     release=RandomArp([11, 10, 9, 8]))
resetter = clock.schedule(lambda: arp.reset(notes.next())).startAfter((2, 1),
                                                                      (2, 1))
player.resumePlaying()