Exemple #1
0
    def __init__(self, humanize=None, echo=None, gain=None):
        if humanize is not None:
            self.humanize = humanize
        else:
            self.humanize = Humanize(delay_max=0.01, velocity_max=50)

        if echo is not None:
            self.echo = echo
        else:
            self.echo = Echo(decay=0.85, delay=0.2, decay_variability=0.1)

        if gain is not None:
            self.gain = gain
        else:
            self.gain = Gain()
            self.gain.fade(0, 1, 10)

        self.notes = (4, 5, 7, 11, 12)
        self.octaves = (2, 3, 4, 6, 7, 8)
Exemple #2
0
class HumanizedRepetition(Autonomous):
    humanize = None
    echo = None
    gain = None

    def __init__(self, humanize=None, echo=None, gain=None):
        if humanize is not None:
            self.humanize = humanize
        else:
            self.humanize = Humanize(delay_max=0.01, velocity_max=50)

        if echo is not None:
            self.echo = echo
        else:
            self.echo = Echo(decay=0.85, delay=0.2, decay_variability=0.1)

        if gain is not None:
            self.gain = gain
        else:
            self.gain = Gain()
            self.gain.fade(0, 1, 10)

        self.notes = (4, 5, 7, 11, 12)
        self.octaves = (2, 3, 4, 6, 7, 8)

    def _play(self):
        midi.setSustain(True)

        route(self.echo, self.humanize)
        route(self.humanize, self.gain)
        route(self.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)
        ]

        while self.playing:
            t = time.time()
            self.echo.note(random.choice(note_choices), 0.15, 40)
            time.sleep(random.choice((0.2, 0.4)) - time.time() + t)
Exemple #3
0
class HumanizedRepetition(Autonomous):
    humanize = None
    echo = None
    gain = None
    
    def __init__(self, humanize=None, echo=None, gain=None):
        if humanize is not None:
            self.humanize = humanize
        else:
            self.humanize = Humanize(delay_max = 0.01, velocity_max = 50)
        
        if echo is not None:
            self.echo = echo
        else:
            self.echo = Echo(decay=0.85, delay=0.2, decay_variability=0.1)
        
        if gain is not None:
            self.gain = gain
        else:
            self.gain = Gain()
            self.gain.fade(0,1,10)
        
        self.notes = (4,5,7,11,12)
        self.octaves = (2,3,4,6,7,8)
        
    
    def _play(self):
        midi.setSustain(True)
        
        route(self.echo, self.humanize)
        route(self.humanize, self.gain)
        route(self.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)]
        
        while self.playing:
            t = time.time()
            self.echo.note(random.choice(note_choices), 0.15,40)
            time.sleep(random.choice((0.2,0.4)) - time.time() + t)
Exemple #4
0
 def __init__(self, humanize=None, echo=None, gain=None):
     if humanize is not None:
         self.humanize = humanize
     else:
         self.humanize = Humanize(delay_max = 0.01, velocity_max = 50)
     
     if echo is not None:
         self.echo = echo
     else:
         self.echo = Echo(decay=0.85, delay=0.2, decay_variability=0.1)
     
     if gain is not None:
         self.gain = gain
     else:
         self.gain = Gain()
         self.gain.fade(0,1,10)
     
     self.notes = (4,5,7,11,12)
     self.octaves = (2,3,4,6,7,8)