Ejemplo n.º 1
0
    def testSave():
        n_delay = 3
        n_mod = 2
        n_voice = 2
        n_envelope = 3

        pheno = ga.Pheno()

        pheno.randomize(n_delay=n_delay,
                        n_envelope=n_envelope,
                        n_modulation=n_mod,
                        n_voice=n_voice)

        print pheno.nome
        db.save_nome(pheno.nome)

        n_delay = 5
        n_voice = 3

        pheno = ga.Pheno()
        pheno.randomize(n_delay=n_delay,
                        n_envelope=n_envelope,
                        n_modulation=n_mod,
                        n_voice=n_voice)
        print pheno.nome
        db.save_nome(pheno.nome)
Ejemplo n.º 2
0
    def create_pheno(self, evt):

        self.kill_pheno()

        pheno = ga.Pheno()

        pheno.randomize(n_sequences=self.n_sequence.GetValue(),
                        n_amp_map=self.n_amp_map.GetValue(),
                        n_note_map=self.n_note_map.GetValue(),
                        n_noise=1,
                        n_envelope=self.n_envelope.GetValue(),
                        n_osc=self.n_osc.GetValue(),
                        n_offbeat=self.n_offbeat.GetValue(),
                        n_enveloped_noise=self.n_enveloped_noise.GetValue(),
                        n_filter=self.n_filter.GetValue(),
                        sequence_len=self.sequence_len.GetValue())

        self.pheno = pheno
        self.build_server_pheno()
Ejemplo n.º 3
0
    def load_nome_from_row(self, row):
        #print row
        nome = ga.Pheno(row['title'], row['composer'])
        nome.id = row['id']
        nome.mum_id = row['mum_id']
        nome.dad_id = row['dad_id']

        self.nome_pool[nome.id] = nome

        s = select([self.genes],
                   and_(self.nome_genes.c.nome_id == nome.id,
                        self.genes.c.id == self.nome_genes.c.gene_id))
        result = self.conn.execute(s)

        for row in result:
            key = row['id']
            if key in self.gene_pool:
                gene = self.gene_pool[key]
            else:
                print "ZZZ", row[1]
                cc = eval(
                    "ga." +
                    row['type'])  # create class from the name in type field
                print cc
                gene = cc()

                gene.id = row['id']

                gene.data = row['data']
                self.gene_pool[gene.id] = gene

            nome.genes.append(gene)

        result.close()
        # print nome
        return nome
Ejemplo n.º 4
0
        self.proc.wait()
        print " dead"
        self.proc = None
        print " . . . . . quitted "


if __name__ == "__main__":

    import ga

    n_voice = 3
    n_delay = 3
    n_envelope = 3
    n_beat_modulation = 3

    pheno = ga.Pheno()
    pheno.randomize(n_envelope=n_envelope,
                    n_beat_modulation=n_beat_modulation,
                    n_delay=n_delay,
                    n_voice=n_voice)  #n_src,n_delay,n_connect, n_voice)

    print "-----------------------------------------------"
    #quit

    c = Client(debug=False)
    c.build(pheno)
    c.send("build.play()")

    while True:
        try:
            text = c.q.get(block=True)