コード例 #1
0
ファイル: piano_test.py プロジェクト: bennymartinson/torrent
def test3():
    echo = effects.Echo()
    route(echo, midi)
    midi.setSustain(True)
    velocity = 100
    for x in range(1000):
        pitch = 60 + x
        echo.note(pitch, 0.1, velocity)
        time.sleep(0.15)
コード例 #2
0
ファイル: section.py プロジェクト: bennymartinson/torrent
 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
コード例 #3
0
ファイル: piano_test.py プロジェクト: bennymartinson/torrent
def test3():
    echo = effects.Echo()
    route(echo, midi)
    midi.setSustain(True)
    velocity = 100
    for x in range(1000):
        pitch = 60 + x
        echo.note(pitch, 0.1, velocity)
        time.sleep(0.15)
コード例 #4
0
ファイル: section.py プロジェクト: bennymartinson/torrent
 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
コード例 #5
0
ファイル: jazziness.py プロジェクト: bennymartinson/torrent
    def _calculate(self):
        smoothness = Smoothness.retrieve()
        while self.calculate:
            lh = smoothness.value('lefthand')
            rh = smoothness.value('righthand')

            self.swing = round(
                scale_constrain(lh, 0, 150, 0.5, 0.7) * 100) * 0.01
            self.jaggedness = scale_constrain(rh, 0, 150, 0., 1.)
            self.snapshots.append((lh + rh) * .5)
            self.snapshots = self.snapshots[-5:]

            if self.snapshots[0] <= .5 and self.snapshots[-1] > .5:
                midi.setSustain(False)
            elif self.snapshots[0] >= .5 and self.snapshots[-1] < .5:
                midi.setSustain(True)
            time.sleep(0.1)
コード例 #6
0
ファイル: effects.py プロジェクト: bennymartinson/torrent
def echos():
    print 'echoing'
    midi.setSustain(True)
    humanize = Humanize(delay_max = 0.01, velocity_max = 20)
    echo = Echo(decay=0.85, delay=0.2, decay_variability=0.1)
    gain = Gain()
    gain.fade(0,1,10)
    
    route(echo, humanize)
    route(humanize, gain)
    route(gain, midi)
    
    note_choices = [x + octave*12 for x in (4,5,7,11,12) for octave in (1,2,3,4,5,6,7,8)]
    print note_choices
    while True:
        t = time.time()
        echo.note(random.choice(note_choices), 0.15,60)
        time.sleep(random.choice((0.4,0.6)) - time.time() + t)
コード例 #7
0
ファイル: effects.py プロジェクト: bennymartinson/torrent
def echos():
    print 'echoing'
    midi.setSustain(True)
    humanize = Humanize(delay_max=0.01, velocity_max=20)
    echo = Echo(decay=0.85, delay=0.2, decay_variability=0.1)
    gain = Gain()
    gain.fade(0, 1, 10)

    route(echo, humanize)
    route(humanize, gain)
    route(gain, midi)

    note_choices = [
        x + octave * 12 for x in (4, 5, 7, 11, 12)
        for octave in (1, 2, 3, 4, 5, 6, 7, 8)
    ]
    print note_choices
    while True:
        t = time.time()
        echo.note(random.choice(note_choices), 0.15, 60)
        time.sleep(random.choice((0.4, 0.6)) - time.time() + t)