Cellular Automata Music in Basic
FreeBasic source:
CApieces.bas: one-dimensional CA midi ensemble
(bass, cello and two wind)
Though many state diagrams of the elementary one-dimensional (k=2, r=1.5) cellular automata
look rather dull, judicious sampling will reveal their substantial sonic potential.
The particular real time CA-to-midi mapping applied here, is straightforward and intuitive,
generating a remarkable range of sturdy rhythms and bouncing motifs from these quietly
swopping cells.
Hear The Ensemble windin' its way through a ten-minute long
random rule jam. (midi-file, 18 kB zipped)
Keys for
CApieces.exe (win32):
- [Esc] quit program
- [Tab] input transition rule (Enter)
append "e" for an elementary CA, and "r" for a reversible one
- [Enter] random symmetric rule
- [Ctrl]+[Enter] fully random rule
- [i] invert rule
- [m] mirror reflect
- [Backspc] find cycle length
- [Up] or [Down arrow] change window size
- [Left] or [Right arrow] rotate grid left/right
- [Pg Up] or [Pg Down] change voice spacing
- [F1]...[F8] choose modal scale
- [Space] shuffle scale notes
- [+] or [-] change tempo
- [s] save CA parameters [###] (Enter)
- [l] load CA piece [###] (Enter)
- [Insert] seed with a single alive cell
- Press any other key for a random state
The actual pieces are determined by:
- One of 65535 transition rules, try for instance
18e, 26e sparse triangles, 18r, 73e lounge, 83e march,
60e, 90e polyrhythmic triangles, 105e, 107e favourites,
110e dirges, 193e skin food, 150e, 225e hors catégorie,
167e fat triangles, 9r, 24r, 27r, 130r second order bounces.
See
the complete set of 256 elementary cellular automata, and some
second order generalizations.
- The initial cell activations. For one rule, different starting states
will often lead to different cycles.
- The grid size or CA modulus. Even sizes generally favour short repeating
motifs (small periods), while odd and prime sizes in particular allow for
endless chains of continuously shifting variations.
- The column-to-instrument mapping. To vary the rhythmic pattern, you can
change both the horizontal position of the grid and the distance between
the four voices. Note that the melodies shift accordingly.
- The modal scale: press a function key to transpose into another mode,
then shuffle the scale to tune up the CA.
- The speed.
You can save up to 1000 CA pieces from one session, imaginatively called
"piece001.par" to "piece999.par". A few master samples have been included.
QBasic source:
CAsounds.bas: continuous-valued CA model
of a complex vibrating string (one for each channel).
This program feeds a continuous-valued cellular automaton with sound waves and
dumps the updates in a standard .wav file. What happens if a single string must
bear the weight of a full chord? The CA being second order accurate only,
tremulous little tinkling tones soon ripple the initial signal.
This one was real fun to write. Besides the CA kernel, it contains a
barebones three-operator FM-synthesizer and a routine for making diatonic
chords. It can mindlessly churn out an endless dominant progression, as well
as produce totally insane random noise.
Keys for
CAsounds.exe (win32):
- [Esc] quit program
- [0]...[3] set thirds stack
- [F1]...[F7] choose scale degree,
next press [0]...[3] for an inversion
- [Enter] switch to loop mode
- [Space] skip CA updates
- [Backspc] reverse the simulation
- [+] or [-] adjust wave amplitude
- [Tab] choose left/right string,
[Up] or [Down arrow] to change wave speed
- Press any other key for random noise
Node
more CA stuff
This work is licensed under a Creative Commons License.