Colored Wolfram Automata With Sound Input
Overview
Modified the "Wolfram Automata" example in processing to do the following:
- Radiate from a center point
- Use colors (Red, Green, Blue)
- Change the ruleset in response to sound, keyboard, or mouse input
- Work online
Pictures
Below are a couple of pictures of it running, click for larger versions:


Movies
It's terribly hard to find a video capture program that handles sound and doesn't suck. The one I used has crappy quality and causes weird stuff like black boxes occasionally. Run the actual program for much better results. All music was obtained via royalty free music.
- Ghost Procession -- Very simple song, shows them obviously reacting when a drum beat hits
- Frost Waltz -- Harder to see a 1-to-1 correspondance to sound and behaviour, but makes much nicer patterns
Simplified Online Version
Available here, it has a much smaller window, and only supports mouse input. The code is embedded in the html page, with the only real change being the fact that you can't have a global variable named the same as a function (rules in this case). It runs a little slow in some browsers without proper Javascript support. I'm guessing it will fail miserably in Internet Explorer, since it breaks standards and has the worst JS interpreter. Usage:
- Mouse click: Will invert the ruleset while held down
- Refresh page: To start a new generation early
Design for Music Input
Other forms of input are pretty self explanatory, the music input was not. Basically it is taking the fast fourier transform, averaging it, taking ten of those (one for each rule) and then mapping that to a rule (ie. Off, Blue, Red, Green). This doesn't work at all though, because constantly changing rules means you don't get pretty repeated patterns. I tried several things, such as keeping track of the maximums, but had the best luck with comparing the previous value to the current one, and incrementing or decrementing appropriately.
I also found that it takes a while for the rule corresponding to no active neighbors to change, so I set up the initial pattern as random noise, which makes it so changes start coming right when the first piece of sound is played.
Frames and music playback in Processing don't necessarily sync. This results in 2 issues. First that playing back a song doesn't produce the same results, and that sometimes events are slightly out of sync (You see it before hearing it, by a frame or 2). I added a little bit of alleviation to the latter by averaging previous values.
A tolerance is needed for each individual song. Since quickly changing the ruleset kills the ability to make patterns, faster paced songs usually need a higher tolerance to get decent results.
Code
- wolframKeyboardInput.pde -- The simple version that takes mouse and keyboard events. Usage:
- Mouse click: Inverts ruleset for as long as depressed
- r: Toggles random generation on new iteration. If off it uses the old pattern
- Enter: Starts a new generation early. A new generation starts automatically when the screen is filled
- Space: Randomize ruleset
- 0 to 9: Set the corresponding rule (0-9) to what's currently in the buffer, defined below.
- a: Set the buffer to 0 (Off)
- s: Set the buffer to 1 (Blue)
- d: Set the buffer to 2 (Green)
- f: Set the buffer to 3 (Red)
- Example, change rule 2 to be red: f 2
- Note: That if you have a way to see stdout, then every keypress will spit out the buffer and whether random generation is on or off
- wolframMusicInput.pde -- There are two variables you need to set at the top. filename contains the path to an mp3 file. tolerance is used to set song pace. The faster paced the song the higher the tolerance should be to get good results. For reference, I was using 10 for the 'Frost Waltz' video and 4 for the 'Ghost Procession' video.
Conclusion
Well the pictures look pretty, and alot more interesting than the original example. Not sure how usefull the 'Wolfram' definition for automata rules is though, since it seems needlessly restricted. I may extend this to 3D one of these years, just because it should be easy (add depth as a field and use point). The music input worked pretty well, but took alot of tweaking (Thus the delta definition).
Comments(0)
2009-11-23 01:46:56
Add your comment:
Hardware
Software
- TAIM (Alpha Version): GHCI integration with vim
- CheaTorrent -- An evil BitTorrent client
- Self Modifying 2D Turing Automata
- Competing Conway Life Automata
- X11 Timelapse Desktop Video
- Colored Wolfram Automata With Sound Input
- Pseudo Video Feedback in Processing
- Haskell Cipher Saber
- Illegal FIlenames -- Windows and *nix
- Simple Perl SDL Music Keyboard (Updated)
- Image to Spectrogram
- Pastebin Hell
- OMGWTFRNG (OWR)
- OTP Enhancement : Failure Report
- Java Network File Transfer Tool
- AES Encrypted Filesystem Speeds
- Dual Message Encryption
- PHP Website
- Mp3 Splitting Script
- Random Obfuscation Tool
- Filesystem Speed Comparisons
- Java Based Web Server GUI