Beispiel #1
0
 def _start(self):
     self.fader.fade(0., 1., 15)
     self.octaves = Octaves(span=2)
     route(self.fader, self.octaves)
     route(self.octaves, midi)
     self.polys = []
     events.listen('facing_back', self.chord_change)
     events.listen('facing_front', self.chord_change)
     for _ in range(4):
         p = Polycrystalline(60)
         route(p, self.fader)
         self.polys.append(p)
         p.play()
Beispiel #2
0
    def __init__(self, octave=60):
        self.octave = octave
        self.time = time.time()
        #self.pitch_map = PitchMap([x+octave for x in 2,9,12,17,23,28,31], variance=50)
        chords = ((-10, -3, 0, 5, 11, 16, 19), (-17, -10, -3, 12, 17, 23, 26),
                  (-15, -7, 0, 11, 16, 21, 24), (-7, 0, 4, 9, 14, 19, 23))

        self.pitch_maps = []
        for chord in chords:
            self.pitch_maps.append(
                PitchMap([x + octave for x in chord], variance=50))

        self.pitch_map = self.pitch_maps[0]
        self.rhythm = random.choice(((1, 1, 2), (1, 1, 2, 1, 1, 1, 1, 2)))
        self.velocity_map = DataMap(
            [random.randint(60, 127) for _ in range(7)], variance=50)
        self.jaggedness = 0.

        Autonomous.__init__(self)
        events.listen('facing_front', self.front_shift)
        events.listen('facing_back', self.back_shift)
Beispiel #3
0
 def _setup(self):
     events.listen('facing_front', self.front_shift)
     events.listen('facing_back', self.back_shift)
     self.front_pitches = [x + 84 for x in 2, 4, 5, 7, 9, 11, 12, 14]
     self.back_pitches = [x + 84 for x in 1, 3, 5, 7, 8, 10, 12, 13]
     self.trem = Tremolo(self.front_pitches, 30, crescendo=False)
Beispiel #4
0
 def __init__(self, start_token=None, stop_token=None):
     if start_token is not None:
         events.listen(start_token, self.start)
     if stop_token is not None:
         events.listen(stop_token, self.stop)
     self._setup()
Beispiel #5
0
 def _setup(self):
     events.listen('facing_front', self.front_shift)
     events.listen('facing_back', self.back_shift)
     self.fader = Gain()
     self.fader.vel_multiplier = 0.5
     route(self.fader, midi)
Beispiel #6
0
    @staticmethod
    def stop_all():
        for section in open_sections:
            sprout(section.stop)
        events.disable()
        for pitch in [
                octave * 12 + p for p in (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
                for octave in (0, 1, 2, 3, 4, 5, 6, 7, 8)
        ]:
            midi.note(pitch, 5., 127, 5)
        midi.setSustain(False)
        print 'stopping'
        midi.silence = True


events.listen('stop_all_sections', Section.stop_all)

ap = AirPiano()


class AirPianoSection(Section):
    def _start(self):
        if not ap.playing:
            ap.run()

    def _stop(self):
        pass


class AirPiano2Section(Section):
    def _start(self):
Beispiel #7
0
 def _setup(self):
     events.listen('facing_front', self.front_shift)
     events.listen('facing_back', self.back_shift)