# Cellular Automidi – Audio App

Presenting my latest Flash Music Toy App Thing –

## Cellular AutoMidi!

Cellular AutoMidi is a generative music app, making “music” based on a modified Cellular Automata algorithm.

It’s an AIR app –

Check it out in action in the video below, first using Flash dynamic sounds, then using Flash Midi Server to control a synth –

According to Wikipedia –

A cellular automaton is a discrete model studied in computability theory, mathematics, physics, complexity science, theoretical biology and microstructure modeling. It consists of a regular grid of cells, each in one of a finite number of states, such as “On” and “Off” . For each cell, a set of cells called its neighborhood is defined relative to the specified cell. An initial state (time t=0) is selected by assigning a state for each cell. A new generation is created (advancing t by 1), according to some fixed rule (generally, a mathematical function) that determines the new state of each cell in terms of the current state of the cell and the states of the cells in its neighborhood. For example, the rule might be that the cell is “On” in the next generation if exactly two of the cells in the neighborhood are “On” in the current generation, otherwise the cell is “Off” in the next generation. Typically, the rule for updating the state of cells is the same for each cell and does not change over time, and is applied to the whole grid simultaneously, though exceptions are known.

…..yep! Basically – each cell can be alive or dead. Once in a generation, each cell looks at it’s surrounding cells, and dies if it is lonely or overcrowded. If a dead cell has an optimum amount of neighbors, it will come to life! Each generation, all the cells which have come to life will sound a note. The notes are assigned based on the cell’s y position, and are all in the pentatonic scale.

There’s a few controls at the bottom which change how things work too.

• Start/Stop – Starts/Stops the automation.
• Export – Exports the current pattern to the clipboard. You can send it to friends, or save it for later, then load in with the load button.
• Clear down – Stop and clear the current pattern.
• Law Mode – An error when coding the cell rules gave this other odd mode.
• Skip Audio – Just show the cell animations.
• Sing Dead – Instead of singing the recently revived notes, sing for the recently deceased.
• Note duration – Alter the system speed.

Also, along the top there are banks of preset systems. Click play to start a saved pattern, and click assign to assign the pattern currently displayed to that button. You can also trigger each pattern with the keyboard keys 1-8.

When you press Export, your pattern is automatically copied to the clipboard, so you can save it, or share it with people. Here’s a pattern I made – you can load it by pasting it into the load box, and pressing Load!

1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,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it’s not, then it uses fancy Flash Player 10 dynamic audio! I’m hoping to roll this out to the Flash Midi Server class soon – so any app which tried to access the midi server and fails, will use the dynamic audio as a backup. I’ll keep you posted!

In case you missed it, you can download the app here – it weighs in at just 79kb including icons! The screenshot images above are 79k! If you don’t have Adobe Air installed, the link will prompt you to download that too.

I’d love to hear what you think of it – and see any patterns you come up with, so please post them in the comments.
Have fun!
Law.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

## 35 thoughts on “Cellular Automidi – Audio App”

1. I just downloaded your app, really well done! I’m working on a similar step sequencer: http://labs.makemachine.net/2010/06/mort-sequencer-001/
Perhaps we could compare notes or swap code. I’d like to find out more about the Flash Midi Server implementation too, sounds interesting.

Thanks,
~Jeremy

2. Thanks Jeremy!
Wow, I’ve not seen MORT before – really impressive. Is all the audio dynamically generated? I’ll have to have a proper play when I get some free time. Very cool.

3. Thanks Lawrie!

Yep, all the audio is code generated. I haven’t made the source available yet. I am working on an AS3 sound library. Once it gets to a good point, I’ll re-build the MORT using it and open it up.

4. Awesome – I can’t wait to see how it develops.
Currently this App and Flash Midi Server aren’t open source, but mainly just due to the lack of time to clean up and comment the source. Hopefully I’ll get round to it one day.
Have you seen the siON sound library? I don’t know much about it, but this demo is pretty impressive – http://wonderfl.net/c/9Xx7

5. Veronica says:

Very, very cool. I was trying to make something like this work back in the late 80s with a Mac+ running LiSP.

6. Paul says:

Really like the program. Very clever.

I have a question regarding getting Automidi to trigger synths in Ableton.
Basically …how can I do this?? …I had both programs open and was tryingto route the midi into Ableton but wasnt very successful.

Its sounding by itself just a simple sine wave, which is nice for a while but can you point me in the right direction via getting it to trigger another device or DAW.

Thanks again.

7. Thanks Paul, glad you like it.
To make sure the Midi Out is working, there’s a few things to check.
First, the Midi Server App should be open before the Air app – and the Air app should say “Flash Midi Server connected” at the bottom, as in the screenshots above.

Now the air app should be sending the midi data to the midi server. If it’s all working correctly, the white square in the top left of the midi server should flash orange whenever a note is recieved.

You can then choose which midi device to send the notes out on, from the drop down menu in the server app. The default on Windows is “Microsoft Midi Mapper” – which will use the standard Windows keyboard midi device. There’s a similar default keyboard midi device on OSX too.

To control a physical device – your USB Midi interface should show up in the server drop down, and if you select it, the signal will be sent through that device.

To control a DAW – you need a virtual midi channel to send the signal over. There’s free software to do this – for example –
MidiYoke for Win XP, LoopBe for Win 7, or you can set IAC settings on Mac – http://forum.ableton.com/viewtopic.php?f=1&t=88514&start=0

Whichever option you choose, it should appear in the server app dropdown, which will send the signals through it when selected.

The last thing to check is that in your DAW midi settings, you’ve allowed midi input on the selected channel.

Hope that helps Paul.
Cheers.
Lawrie.

8. Thanks Lawrie, both this and ‘Sonar’ app’s are fun and cool BUT having some compatibility issues? I initially tried both on my PPC laptop under OSX 10.4 and the MIDI server worked as expected and I set it to my IAC bus fine. So now I wanted to break out the big guns synth-wise so I tried running both on my Nehalem (Intel) 8 Core under OSX 10.5.8 and the Midi server’s routing window never appears so I can chose and MIDI out (IAC in this case) there…all other aspects of your AIR app’s seem correct (internal sounds work, server shows connected, etc) I just have no way to get MIDI out to any usable bus without that routing window?

9. Thanks for letting me know Loopy. I had a few simlar sounding issues when I was packaging the server app, but I thought I’d fixed them. If you’re familiar with Processing, I can send you the source code, which should be able to run without any problems.
I’ll have a look to see what else it could be causing it too.

10. Cool Lawrie, thanks for reply ;-) I have Processing but sadly am not in any way ‘familiar’ with it. Is it just a matter of pasting the code into a Processing document or more involved?

Other wise, I am bouncing the MIDI-only to Logic on my laptop and THEN exporting/importing that to other computer (into newer Logic) to play…not realtime but still get to check out some of the groovy possibilities with beasts like ‘Omnisphere’ :D

I will check back in case you come up with anything…oh and I wanted to mention just in case…the Nehalem is a dual display system (two 24″ LED), sometimes app’s act funny but very few at this point, but thought I should mention it just in case ;-)

11. Hi again Loopy. To get the Processing code to compile, you’ll need to download two extra libraries –

ControlP5 –
http://www.sojamo.de/libraries/controlP5/

This post should explain where to put them on your system if you’re unsure –

http://processing.org/discourse/yabb2/YaBB.pl?num=1269728211/9#9

Hope that works for you.

12. Thanks Lawrie for your time, code, and links, I will give it a shot ;-)

13. Karin says:

Hi,
Nice app. Thanks for sharing. I played with it and with the flash server I was also able to use it together with Logic. Record as instrument or audio and give it an specific instrument or sample. You used a pentatonic scale. Is there a way to use another modality?

14. Hi Karin.
Glad to hear you liked the app – and got it all set up with Logic.
At the minute, the pentatonic scale is hard coded into the app. What I’d want ideally, is a drop down, where you could select from a selection of different scales. My problem is that I can’t find a list of scales online, converted to Midi Number values. My music theory isn’t too great.

If there’s a specific modality you’re hoping to use, let me know and I can publish you a version which uses that.

And if anyone can help me find a set of scales formatted as Midi values, that would be awesome.

15. Karin says:

I do not know anything about MIDi numbers, but I know about music theory. So a diatonic scale would be C-D-E-F-G-A-B. What I found online are the midi numbers that correspond with this scale: You hear C4 or ‘Middle C’ and the numbering starts with 60. So with the scale C major it would be: C (60) D(62) E(64) F(65) G(67) A(69) B(71) where you can see that between the E and F there is a half tone and the MIDI numbers follow in line. Where there is a whole tone between the C-D-E + F-G-A-B the number skips one Subsequently the distance between B and C at the end of the scale is a halve tone again and will become C(72).

For the Note designation in accordance with octave name see this:
http://en.wikipedia.org/wiki/Note#Note_designation_in_accordance_with_octave_name

Maybe it is possible to ask Amit Pitaru, who is musician and created Sonic Wire Sculptor where he also gives the opportunity to select different modes.
Hope this gives a bit of an insight.

16. Karin says:

Here scales in Major:
It depends on which octave you start for the midi numbers but C subcontrabass starts with 0
I just gave an sample, but do not know if this are the numbers you need.

Diatonic scales
Major scales:
C major
G major
D major
A major
E major
B major
Cis major

Midi numbers starting with small= c-b

C(48) D(50) E(52) F(53) G(55) A(57) B(59) C(60)

G A B C D E Fis G

D E Fis G A B Cis G

A B Cis D E Fis Gis A

E Fis Gis A B Cis Dis E

B Cis Dis E Fis Gis Ais B

Fis Gis Ais B Cis Dis Eis Fis

Cis Dis Eis Fis Gis Ais Bis Cis

The dynamic audio code in this app doesn’t use any libraries yet, it’s just knocked together from the ASDocs and a few helpful blog posts – although Tonfall is something I’m looking into – anything by Andre is bound to be stunning.

I also like the stuff Jeremy (makemachine) is doing here-
http://labs.makemachine.net/2010/09/wavetable-synthesis-round-1/

18. Dinaz Kardooni says:

Hi, I am having trouble with the Flash Midi Server. I downloaded it and it says it is connected, but I only hear piano notes, and it doesn’t have the nifty control panel as shown in the video. Is any other software used in the video? If so, where can I download it and how can I hook it up to the Cellular Automidi? In addition, I am not able to export anything. I am not sure where the clipboard is. What if there is a sequence I would like to send to someone to use in a track? Can any1 please help? Please bear with me; I am not tech savvy…. :((((

19. Hi Dinaz,
I’m not sure what’s happening on your system I’m afraid. When you run the FlashMidiServer app, that panel should pop up, letting you control the various options. It’s written in Processing, which i based on Java, so you could see if your Java is up to date at this link –

When you click export, the app copies the current pattern to your system clipboard, so you should be able to paste it into an email or whatever you want just by pressing Control+V / edit + paste.

Hope you get it working.

20. Alex says:

Hi Lawrie,

I installed the server and application but I’m having difficulties connecting it to FL Studio. Can you give me some guidelines on how to do this? Great app!

21. Mathias MU says:

Hi,
i was really exited to try it out, then i saw you using it with fl studios to change the sounds (cause it simply sends midi signals, right?).
Well, i was wondering how i could plug it in, into ableton live.
Can u lend me a hand with that?

keep up the good work!

22. Hi Mathias,
Yep, the app just sends out midi signals, which can be picked up by whatever audio application you use. As Flash doesn’t have native midi functionality, I had to write a small Processing app to act as a bridge between the Actiionscript and the midi events.
Hopefully this post will get you up and running –
http://www.lawriecape.co.uk/theblog/index.php/flash-midi-server

23. Mathias MU says:

thanks allot, i will give it a shot!
(i’ll let you know if it worked out for me)

24. Mathias MU says:

Hi Lawrie,
well i tried to figure it out, but my knowledge about these things is really small. i downloaded those midi ports but nothing seems to communicate with ableton live. i’m trying this on a mac btw. any tips perhaps?

25. Mathias MU says:

when i try to select the port in the flashfile, i can’t really select it, or maybe it’s just how it works? you can’t really see, through which port u are sending the signals. thanks for the help anyway, very nice tool you made there btw and sorry for spamming your blog xD.

26. Sergej says:

DL link brings me to a 404 page

27. Hi Sergej. Thanks for letting me know. I’ve recently moved to a new host and it hadn’t copied across properly. The links should work now. Cheers.