Example #1
0
        def next(self):
                keys = PentatonicKeyboard().notes
                self.keys = list(keys)
                keycount = len(self.keys)
                stretch_length = random.randint(2,5)
                left_low = random.randint(keycount/4,(keycount/2))
                left_range = random.randint(1,8)
                mids = HSeq(self.keys.__getslice__(left_low,left_low+left_range))
                right = HSeq(self.keys.__getslice__(keycount-(keycount/4), keycount-1))

                finger1 = Finger(
                length = 16,
                note = Wandering(mids),
                duration = Oscilating([2,4,8,16,32]),
                velocity = Randomized(range(20,127)),
                rest = Randomized([2,4,8,16,32])
                )

                finger2 = Finger(
                        length = 160,
                        note = Wandering(right),
                        duration = Randomized(range(2,80)),
                        velocity = Wandering(range(50,90)),
                        rest = Randomized([1,2,3,4,5])
                        )

                finger3 = Finger(
                length = 16,
                note = Wandering(mids),
                duration = Randomized([2,4,8,16,32]),
                velocity = Randomized(range(20,127)),
                rest = Oscilating([2,4,8,16,32])
                )


                x=800
                
                drone = (finger1.next(256) | transforms.stretch(.5))*2
                #drone = multiply(drone,[-3])
                measure = drone.next_offset()
                #metrenome 
                alpha = (drone*2)+(mutate(drone,1,2,1,2,0))+(drone*2)+(mutate(drone,1,2,1,0,1))+(drone*2)+(mutate(drone,1,2,1,0,1))+(drone*2)
                drone2 = (finger3.next(256) | transforms.stretch(1))*2
                mutated_drone2 = (mutate(drone2,1,2,1,0,1))
                beta = (drone*2)+(mutated_drone2)+(drone2*2)+(mutated_drone2)+(drone2*2)+(mutated_drone2)+(drone2*2)
                solo1 = finger2.next(measure)+(mutate(finger2.next(measure),octave=1) | delay(measure))+(finger2.next(measure) | delay(measure))
                output = alpha//(beta | delay(measure*2))
                self.hand = [finger1,finger2]
                self.last = output | transforms.stretch(1)
                try:
                        player.play([self.last | midi_pitch()])
                except Exception as e:
                        print e
Example #2
0
        def next(self, mutation_matrix=[0,0,0,0,0]):
                measure = metrenome(120,octave=5, bpm=120)
                voice1 = measure |mutate(1,2,0,0,0)
                half_measure = metrenome(120,octave=5, bpm=240)
                delay = metrenome(10,octave=5, bpm=120)
                new = half_measure | delay(delay.next_offset())

                self.last = measure // voice1

                try:
                        player.play([self.last | midi_pitch()])
                except Exception as e:
                        print e
Example #3
0
        def next(self):
                keys = MinorKeyboard().notes
                self.keys = list(keys)
                keycount = len(self.keys)
                base = Randomized([40,80,120,240]).next()
                measure = metrenome(base/2,octave=5, bpm=base)
                #two sequences that make different audible metrenomes
                tick = metrenome(base/2,octave=10, bpm=base)
                tock = metrenome(base/2,octave=10, bpm=base, velocity=Randomized([0,20,40,60,80,90]).next()) | mutate(0,0,30,0,0)


                finger1 = Finger(
                length = measure.next_offset(),
                note = Wandering(HSeq(self.keys.__getslice__(20,23))),
                duration = Wandering([4,8,16,32,64]),
                velocity = Wandering(range(50,51)),
                rest = Randomized([8])
                )

                finger2 = Finger(
                length = measure.next_offset(),
                note = Wandering(HSeq(self.keys.__getslice__(23,24))),
                duration = Wandering([4,8,16,32,64]),
                velocity = Wandering(range(30,41)),
                rest = Randomized([8])
                )

                finger3 = Finger(
                length = measure.next_offset(),
                note = Wandering(HSeq(self.keys.__getslice__(26,27))),
                duration = Wandering([4,8,16,32,64]),
                velocity = Wandering(range(30,41)),
                rest = Randomized([8])
                )

                transpositions = Randomized([-2,2,4,6,8])

                def fade_mutate(incoming, count, mutation_matrix=[0,2,30,0,0]):
                        output = OSequence()
                        last = incoming
                        for r in xrange(16):
                                current = last | mutate(mutation_matrix[0], mutation_matrix[1], mutation_matrix[2], mutation_matrix[3], mutation_matrix[4])
                                output += (tock//incoming // current) | transpose(transpositions.next())
                                last = current
                        return output

                def generate_jazz():
                        seq_1 = fade_mutate(finger1.next(measure.next_offset()),4)
                        seq_2 = fade_mutate(finger1.next(measure.next_offset()),4)
                        output = seq_1 // seq_2
                        return output

                output = generate_jazz()//(generate_jazz() | delay(measure.next_offset()*1))//(generate_jazz() | delay(measure.next_offset()*2))
                

                self.hand = [finger1]
                sequence_1 = (output)

                self.last = sequence_1
                #print self.last | midi_pitch()
                try:
                        player.play([self.last | midi_pitch()])
                except Exception as e:
                        print e