[livecode] live coding and genetic programming

From: Dave Griffiths <dave_at_pawfal.org>
Date: Tue, 21 Sep 2004 11:14:43 +0100

Hi all,

Just thought I'd come back to a topic I brought up ages ago, incorporating
genetic programming into live coding - I think they go well together - but of
course it totally depends on the application, it's really hard to evolve high
level general purpose languages, for instance.

So for my simple little melody language, I've rigged up a live coding
environment where you can flip freely between editing and evolving code.

Here are some screenshots:
The live coding editor, the code is on the left, the result is on the right:
http://www.pawfal.org/nebogeo/images/npeditor.png

And mutating the same pattern in the breeder, the original is the top left
pattern - left clicking on the pattern selects it and grows a new generation
of mutated copies:
http://www.pawfal.org/nebogeo/images/npbreeder.png

For a little more explanation, this is an extract from the half written
documentation:

---8<---

Lsystems are specified by the following convention:

axiom rule1 rule2 rule3 ...

Where the dividing characters can be any whitespace chars including newline.
It's often clearer to write them in the following form:

axiom
rule1
rule2
rule3
...

Using lsystems to create music

Noisepattern encorages 2 forms of expression, live programming and live
(human guided) genetic programming. you are free to flip between the the two
quickly and continously.

Examples:

First we write a simple scorecode lsystem that creates a nice melody:

!1
2---2---2---2---2
o.+o.+o.2.2

Which after 2 generations expands to:

!o.+o.+o.o.+o.+o.2.2.o.+o.+o.2.2---o.
+o.+o.o.+o.+o.2.2.o.+o.+o.2.2---o.+o.
+o.o.+o.+o.2.2.o.+o.+o.2.2---o.+o.+o.
o.+o.+o.2.2.o.+o.+o.2.2---o.+o.+o.o.+
o.+o.2.2.o.+o.+o.2.2

Then we flip the code editor into it's breeder mode which gives us 4 identical
copies of this melody. They are identical as the mutation rate is set to 0 by
default. Move this - to quite a low amount, try something like 0.1, then click
on one of the melodies.

There are now 3 mutated versions of this melody to audition, namely:

!o.+o-+4.o.+o-+4.2.\.\---o.+o-+4.o.+o
-+4.2.\.\---o.+o-+4.o.+o-+4.2.\.\!|-o
.+o-+4.o.+o-+4.2.\.\-.-o.+o-+4.o.+o-+
4.2.\.\

!\.+o.+o.\.+o.+o.2.2.\.+o.+o.2.2---<-
--\.+o.+o.\.+o.+o.2.2.\.+o.+o.2.2---\
.+o.+o.\.+o.+o.2.2.\.+o.+o.2.2+--\.+o
.+o.\.+o.+o.2.2.\.+o.+o.2.2

!o.+oo.+o1+o.4.2---o.+o1+o.4.2--.o.+o
1+o.4.2---o.+o1+o.4.2---o.+o1+o.4.2+o
.4.o.+o1+o.4.2---o.+oo.+o1+o.4.2---o.
+o1+o.4.2--.o.+o1+o.4.2---o.+o1+o.4.2
---o.+o1+o.4.2+o.4.o.+o1+o.4.2--.o.+o
o.+o1+o.4.2---o.+o1+o.4.2--.o.+o1+o.4
.2---o.+o1+o.4.2---o.+o1+o.4.2+o.4.o.
+o1+o.4.2---o.+oo.+o1+o.4.2---o.+o1+o
.4.2--.o.+o1+o.4.2---o.+o1+o.4.2---o.
+o1+o.4.2+o.4.o.+o1+o.4.2---o.+oo.+o1
+o.4.2---o.+o1+o.4.2--.o.+o1+o.4.2---
o.+o1+o.4.2---o.+o1+o.4.2+o.4.o.+o1+o
.4.2

Whether these are good or bad is entirely up to you, right click on each
one to play it. There is no interruption of the playback as you listen and
mutate, the idea is to throw caution to the wind and play it live, like an
instrument.

When you one that's cool (perhaps the big long one above) you can flip the
view back to the live coding one to see and edit the code responsible.

!1
2---2--.2---2---2
o.+o1+o.4.2

All this mutation has really done to make the result much longer, is insert a
1 in the second rule.
Received on Tue Sep 21 2004 - 10:15:53 BST

This archive was generated by hypermail 2.4.0 : Sun Aug 20 2023 - 16:02:24 BST