I'm very interested in art experimentation as well as tech and sustainability. I recently participated in a live programming workshop meant for music creation. One of the guys conducting the workshop mentioned the fact of slight imperfections (usually not noticeable by the human regular ear) of human artists against programmed music. Somehow this made me think of how some imperfections lead to more interesting works than the one that was previously attempted. How could I work around a terminal toy that was "imperfect" in its attempts to play music?
I'm very interested in sustainability and de-escalating tech resources, so I refused to work towards AI, but I thought of working with GA. The idea is for the toy to attempt to reach a collection of notes, each attempt more close, but not quite until it reaches the correct ones.
In order to do this I chose python3 and a very simple GA structure, the same that would try to guess a word.
This is an example usage:
python3 tinear.py
TARGET: AABC
MAXIMUN GENERATIONS ALLOWED: 7
Generation: 1 String: AACC Fitness: 1
Generation: 2 String: AABC Fitness: 0
In this case it was lucky and guessed the right one the second time (generation 2). In order to play music directly from the terminal, I use os.system
defining a command with variable chords (the ones asked to the user at the execution) and play -n synth pl
.
The result is that each guess, the terminal plays the attempting tune, making it fun when doing some live coding jams.
I mixed the tinear attempts with some synthesizer tunes using teenage engineering devices and created some imperfect, yet fun music! You can find the script here.