Welcome to Fractal Forums

Fractal Art => Other Artforms => Topic started by: huggmeister on January 06, 2016, 09:28:35 PM




Title: Sound from elementray cellular automaton
Post by: huggmeister on January 06, 2016, 09:28:35 PM
Hi! Just upploaded some sound generated by a program i wrote to soundclod
https://soundcloud.com/shd7x2uxazj6/rule90-bugged?in=shd7x2uxazj6/sets/sound-from-elementary-cellular-automaton

this was a simple one-dimensional cellular automaton with only two values.
Each iteration, cells with value 1 will be played as notes and pitch is the cells place in the lattice.

What are some other ways to generate sound from cellular automatons?


Title: Re: Sound from elementray cellular automaton
Post by: DarkBeam on November 04, 2016, 02:58:21 PM
Nice menacing music :D


Title: Re: Sound from elementray cellular automaton
Post by: Sabine on November 04, 2016, 04:37:56 PM
Hm the axeman will come around the corner any second! :verysurprised:
Can't help you with your question, but greatly enjoyed your experiment.


Title: Re: Sound from elementray cellular automaton
Post by: claude on November 04, 2016, 07:53:22 PM
What are some other ways to generate sound from cellular automatons?

I did a little experiment converting cells directly to audio samples, here's rule 110 starting from random values evolving to more ordered state:
https://mathr.co.uk/misc/2016-11-04_cellular_noise_rule110_delay200.ogg
see https://en.wikipedia.org/wiki/Rule_110

here's my code that outputs raw unsigned 8bit samples to stdout:
Code:
// gcc -std=c99 -Wall -Wextra -pedantic -O3 -o cellular cellular.c 

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
  unsigned char table[8] = { 0, 1, 1, 1, 0, 1, 1, 0 };
  int length = 8000 * 30;
  int delay = 200;
  unsigned char *buffer = malloc(length);
  for (int i = 0; i <= delay; ++i)
  {
    buffer[i] = -(rand() / (double) RAND_MAX > 0.5);
  }
  for (int i = delay + 1; i < length; ++i)
  {
    int j = i - delay;
    unsigned char s = 0;
    s += (!!buffer[j - 1]) << 2;
    s += (!!buffer[j    ]) << 1;
    s += (!!buffer[j + 1]);
    buffer[i] = -table[s];
  }
  fwrite(buffer, length, 1, stdout);
  free(buffer);
  return 0;
}