Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: On Music and Cellular Automata  (Read 1240 times)

nagual678

  • Bay Watcher
  • Noble Sam says: I want YOU for the Fortress Guard!
    • View Profile
On Music and Cellular Automata
« on: December 14, 2007, 08:46:00 am »

I've had this idea for music in DF floating around in my head for quite a while. In my opinion, it would very elegantly fit the DF world and engine.

Imagine music that is automatically composed and played, and its tone and mood depends on what is happening on the screen. Hang on, this is not nearly as crazy as it sounds.

The whole idea is based on generating data from cellular automata (Wikipedia article if you know your maths  ;)) and converting it into music, for it to be then played in-game (using MIDI).

If you don't know already, computers are already able to produce pretty convincing pieces of music. A very effective and convincing way to do this is to  translate data generated with cellular automata into notes.

How does that sound ? Check out this in-webpage automatic music composer : http://tones.wolfram.com/generate/advanced.html

The About and FAQ pages contain instructions and insight on how it all works. Be sure to mess with the settings a bit.

Fully random compositions (by clicking on a style) is pretty spectacularly hit and miss : sometimes you get surprisingly good stuff, sometimes more inharmonious and "weird" music.

Better yet, the diversity of styles of music you can get is really high. I have come across fugues that you would mistake for Bach's or caprices straight out of a Vivaldi sheet. I like the classical music generator, but pretty much all styles of music are successfully covered in the generator.

I think using too many instruments give mixed results because the whole thing becomes too random to be able to keep consistence and coherence. Limiting what's going on and choosing simple scales and modes often yields surprisingly good results.

Try going manual and choose the instruments, tempo and scales yourself. For instance have just a cello playing lead1, a piano playing lead2, select the minor scale, and a slow tempo. Play around with the rule type and seed : instant music with actual character and mood !

Starting from this, it is conceivable to have in-game events or conditions summon mode/scale/tempo/instruments changes. For example you could have just a single cello or guitar playing a downtempo melody in a minor(sad) scale in a cold and eventless winter, or have a violin play a short uptempo major(happy) melody (something like a caprice) when a caravan arrives with goods. When a goblin army arrives to siege your fortress, a full blown orchestra with the right settings could be used to indicate tension/action.

You could have several factors affecting the generation, such as the general mood of your dwarves, or the fact that you are losing or winning a battle.
This is a pretty much a you name it thing, sky is really the limit here.

I don't know just how hard implementing this would be. This page offers some insight, with some practical examples and applications. http://www.ibm.com/developerworks/java/library/j-camusic/

What do you think ? It definitely deserves some thought. I believe this is absolutely revolutionary, doable, and would fit Dwarf Fortress like a glove !

Logged

Vodalian

  • Bay Watcher
    • View Profile
Re: On Music and Cellular Automata
« Reply #1 on: December 14, 2007, 10:11:00 am »

I think this is a great idea.
Logged

Yourself

  • Bay Watcher
    • View Profile
Re: On Music and Cellular Automata
« Reply #2 on: December 14, 2007, 10:12:00 am »

I had a chance to go to the Wolfram conference a few years ago and met Stephen Wolfram and I'm not sure how practical this suggestion would be.  They do tell you the basics of how it works, but there's other things going on that they don't tell you about in that page.  Particularly how the algorithms they use process the CA data.  There's much more to it than picking out a CA segment and using it.
Logged

axus

  • Bay Watcher
  • Axe Murderer
    • View Profile
Re: On Music and Cellular Automata
« Reply #3 on: December 14, 2007, 11:37:00 am »

Might be possible to do it in a hacked kind of way, if you can get a process reading the DF memory space.  Then just write a separate program playing music based on what's going on.
Logged

Armok

  • Bay Watcher
  • God of Blood
    • View Profile
Re: On Music and Cellular Automata
« Reply #4 on: December 14, 2007, 11:57:00 am »

First of this is amazing, great thanks for giving me that Wolfram tunes link.

I am personally quite interested in computational/mathematical creativity, one of the main reasons I like DF is it's story generating.

This might fit very well in DF, it would really fit in any game whit music, and I really think Toady is one of the very few ingenious enough programmers to actually pull of making it sound good ALL of the time and adapt smoothly to the game.

Despite all this, I do not think this should be any great priority as it do not directly affect gameplay, and is most likely a large and time consuming thing to program. Personally I think this should be placed in the distant future together whit graphics and GUI, it's really graphics for the ears.

But awesome suggestion anyways!  :D

Logged
So says Armok, God of blood.
Sszsszssoo...
Sszsszssaaayysss...
III...

Capntastic

  • Bay Watcher
  • Greetings, mortals!
    • View Profile
    • A review and literature weblog I never update
Re: On Music and Cellular Automata
« Reply #5 on: December 14, 2007, 03:42:00 pm »

If anyone could get it to work, it would be Toady.   That being said...

I'd rather have him play guitar/other instruments for music he wrote himself.

Logged