Slashdot Mirror


Cellular Automata and Music Using Java

Justin Powell writes "Take computers, mathematics, and the Java Sound API, add in some Java code, and you've got a recipe for creating some uniquely fascinating music. IBM Staff Software Engineer Paul Reiners demonstrates how to implement some basic concepts of algorithmic music composition in the Java language. He presents code examples and resulting MIDI files generated by the Automatous Monk program, which uses the open source jMusic framework to compose music based on mathematical structures called cellular automata."

47 of 115 comments (clear)

  1. DNA Music by A3thling · · Score: 5, Informative

    Lets hope it sounds better than DNA music. That was tried a while ago and was horrible.

    --
    Josh
    1. Re:DNA Music by fresh27 · · Score: 4, Funny

      at the very least, let's hope it's better than jessica simpson/christina/britney music. this is a little less formulaic, so i suppose it's on the right track.

      --
      http://ipod.fresh27.net/
    2. Re:DNA Music by wash23 · · Score: 5, Interesting

      DNA music sounded horrible but it was an interesting novelty. With the right kind of encoding scheme you could probably make something that sounded nice. A friend and I once experimented with fractal music (literally) by writing a script to generate the mandelbrot set in a format that was readable by an amiga-based tracker (OCTAMED). The number-of-iterations (color) value was mapped to pitch and instrument. It was neat because it not only sounded pretty interesting (he tweaked the way the numeric value was mapped to instrument and pitch), but you could also watch the mandelbrot pattern scrolling past in ASCII-form when you hit play. Fun diversion for an afternoon anyway.

    3. Re:DNA Music by nateb · · Score: 3, Funny

      It probably sounds better than Spam Radio, at least.

      --
      -- Nate
    4. Re:DNA Music by linzeal · · Score: 2, Interesting

      At least provide a link to DNA music, weird stuff for sure but I actually liked some, Fractal, stuff.

    5. Re:DNA Music by simcop2387 · · Score: 4, Funny

      hey due to the complexity of fractals its entirely possible to find a pair of breasts in the mandlebrot fractal, i'm writing a thesis on it and hope to find them some day.

    6. Re:DNA Music by Billly+Gates · · Score: 2, Interesting
      " Lets hope it sounds better than DNA music. That was tried a while ago and was horrible."

      no shit.

  2. Interesting, but what are the benefits of Java? by RobPiano · · Score: 4, Interesting

    I really love this stuff and I'm just finishing my master's in music technology (go figure..). This isn't the first time I've seen CA in music. I know for sure of a cell examples in Max/MSP, PD (Pure Data), and Common Music.

    I don't see any real benefits for doing this kind of task in java. It's very nice having another option, but are there any reasons to use this software over the other very good options? I am much more excited about the possibilities with ChucK.

  3. No Control by mphase · · Score: 3, Interesting

    It's nice and all but I don't see how there is any real control of the product. Like most other computer generated music it is must fiddled with until something pleasing accidently resulted, right? I probably just missed something.

  4. sounds like an arstechnica performance... by mrgreenfur · · Score: 5, Interesting

    a teacher/performer/artist/programmer at my school did a performance at arstechnica called 'cell phone symphony' where he used the audiences cell phones to make music! Each person sat in one chair, mapped to a grid on his computer. They got special phone connections with the phone company to dial a lot at once. They got a big projector to projet over the audience, and had a spotlight (of sorts, from the projector) pop up on someone when their phone rang. The whole audience watched via a big mirror.

    heres the wired article.

  5. Forget music! by AKAImBatman · · Score: 5, Interesting

    I've got old skool sound effects right here. The whole game fit in 4K, even won the 4K Java Game programming contest.

    It requires that you have Java installed in order to play. It doesn't work on Linux, tho. Sorry. Complain at Sun to get full screen mode working on Linux.

  6. In related news... by k4_pacific · · Score: 4, Funny

    The RIAA announced today that they will be using this technology to phase out recording artists altogether. CDs will still cost $16.99, though.

    --
    Unknown host pong.
  7. ugh by parcel · · Score: 3, Funny

    so, computer generated music sounds like... well... computer generated music.

    or maybe like a four year old banging on a keyboard.

    although, does that mean the program has intelligence equivalent with a four year old human? ;)

    1. Re:ugh by Vireo · · Score: 2, Funny
      As the author of the article says:
      As with much good music, you need to listen to it a few times before you can appreciate it fully.
  8. Orwell was right! by k4_pacific · · Score: 5, Interesting

    Could it be?

    "Here were produced ... sentimental songs which were composed entirely by mechanical means on a special kind of kaleidoscope known as a versificator." --Orwell's '1984'

    --
    Unknown host pong.
  9. Fractal music by VAXGeek · · Score: 5, Informative

    If you like that, try this: Fractmus 2000 (win32)

    --
    this sig limit is too small to put anything good h
    1. Re:Fractal music by Evil+Grinn · · Score: 2, Interesting

      Fractal, schmactal. Hacked-2-Basics lets you "play" a VT100 like a musical intrument, with sounds derived from things like the Linux kernel and DOOM.WAD interpreted as 8-bit mono PCM samples. Uses pure write(2) to /dev/dsp. Written to run on computers so low-end that a musician can set fire to them onstage.

      Yes, I'm blabbering about my own musical project but so is everyone else on this story.

  10. Visual Music by rexguo · · Score: 4, Interesting

    Interesting, though I used Java to visualize symmetrical structures in the music of J.S.Bach. I used stereoscopic 3D (with OpenGL) and 4-channel 3D sound (with DirectSound3D) to 'virtually' present the 4-parts: Soprano, Alto, Tenor and Bass, flying around in 3D, not just visually, but aurally too. It was exhibited 2 years ago.

    --
    www.rexguo.com - Technologist + Designer
    1. Re:Visual Music by rexguo · · Score: 4, Informative

      Also, the short write-up we handed out during the exhibition can be found here.

      --
      www.rexguo.com - Technologist + Designer
  11. Awesome... by grub · · Score: 3, Funny


    I can't wait to hear these new Java-written MIDIs on Geocities pages, complete with leet spinning skulls and black background...

    --
    Trolling is a art,
  12. For the same reason that lots of things are nice.. by bcore · · Score: 2, Insightful

    ..to code in Java: There are very nice libraries that take care of the plumbing for you and help you write clean code faster. In this case, the library in question is jMusic.

    I'm sure Chuck is awesome (it sure looks cool yet daunting), but as a java coder by day and a musician by night, I'm rather intrigued by jMusic myself.

  13. midi file indicates CA skil 1 year piano student by auburnate · · Score: 3, Funny

    All one has to do is click the midi link to realize that the tinkering of a first year piano student could easily be mistaken for a celluar automata.

  14. KeyKit by jbum · · Score: 4, Informative

    My personal preference for coding this kind of thing:

    KeyKit, an awk-like language designed specifically for manipulating MIDI data.

    http://nosuch.com/keykit/

  15. Dot matrix music by wash23 · · Score: 4, Interesting

    Okay, this risks being called a bit off topic, but it's so cool (and reasonably relevant) that it has to be mentioned. Dot matrix printer music by this group The User has been around for awhile. It's not algorithmic music, but by printing strings of characters simultaneously to different dot matrix printers they make some pretty interesting sounding stuff.

  16. Re:Mods vs MIDI by falzer · · Score: 2, Informative

    I don't know about the state of mods (and friends) these days, but at least earlier on midi had much better polyphony and finer time control compared to mods. And lots of music hardware speaks midi.

  17. Music using weighted random Markov strings... by Anonymous Coward · · Score: 5, Interesting

    ...might be interesting. Play a note at random, choose a note based on the weighted probability of the next note in a corpus of music, then use the first two notes to figure out the weighted probability of the third, and so on.

    Then if you go out four notes and only one note has any probability of being the fifth in that series, drop off notes from the beginning of the string until there is more than one possibility and continue. Something like:
    1
    12
    123
    1234
    (note 5 always follows notes 1234, so drop the 1)
    (1)2346
    (1)23467
    (note 8 always follows 23467, so drop 2, note 8 still follows 3467 so drop 3, then there is more than one possible note)
    ((1)23)4679 {etc}

    Then the music would probably sound really familiar, but just about the time you catch on it segues into another pseudo-familiar tune.

    1. Re:Music using weighted random Markov strings... by k4_pacific · · Score: 2, Funny

      No, its like this:

      You go out two notes and calculate the weight based on the cosine of the third note. Divide that by the last note of a harmonic frequency. If the note in question is sharp or flat, divide by six and take the remainder. Omit every third note. After the sixth note, if the notes are in fact, collinear and not symmetric, you can reverse the cofactor matrix and restore the eigenvalues, but not without first calculating the modulus of the largest cubic divisor.

      --
      Unknown host pong.
    2. Re:Music using weighted random Markov strings... by GoatJuggler · · Score: 2, Funny

      Wow. I have no idea what you just said, but it reminded me of the Hit Song Science program which is the music industry software that predicts whether a tune is going to be a "hit" or a "miss"

      Appropriately enough for this thread, this article has a quote from Polyphonic HMI's chief executive Mike McCready "There are a limited number of mathematical formulas for hit songs. We don't know why."

      Once they open-source those mathematical formulas that they've derived, then we can start using all the music development software to get rich.

  18. douglas adams by golgafrincham · · Score: 5, Interesting

    damn, this man was insightful. he wrote about an internet-like structure describing the network of the h2g2 book, but he did also describe (at a very detailed level) how to create and use this kind of sound "tools" in his "dirk gently" novels.

    i mean, just read what he wrote about computer interfaces in h2g2 (when ford is breaking into the hq). adams was damn smart and way more funny than clarke.

    but did you know that adams did not invent this style of writing sf? read "the star diaries" by stanislaw lem. funny. uh... just read anything written by lem. you think clark or heinlein novels are great? just as an example, do you wanna know where the matrix authors stole the idea of these human-driven fighting robots? "The Invincible".

    --
    beer as in "free beer"
  19. Who owns the copyright? by El+Mulo · · Score: 5, Interesting

    Who owns the copyright of the computer generated music? The programer? The user? The machine?

    1. Re:Who owns the copyright? by noelo · · Score: 2, Funny

      the RIAA...consider yourself busted....

  20. Re:For the same reason that lots of things are nic by paulbd · · Score: 3, Informative

    jmusic has nothing on the facilities offered by the programs mentioned in the parent. PD is an incredible environment for experimental music composition.

  21. Re:Fractal music (Java Applet) by Anonymous Coward · · Score: 2, Interesting

    I while ago I did my own experimenting with Java generated fractal audio. I took a different approach - using the fractal data to produce raw samples rather than MIDI notes.
    I wrote it up at this page: http://homepages.paradise.net.nz/~andrew-1/fractal /

    (you will need a recent JVM from SUN to use the applet)

  22. from the my-favourite-artist-is-3.14159265.. dept. by Samah · · Score: 3, Informative

    After following some links, here's some cool human-assisted mathematically-generated music:
    http://www.geocities.com/vienna/9349/

    The first prime number and pi midi files are awesome ;)

    Might hafta wait til tomorrow tho - looks like the guy's geocities account got /.'d already =)

    --
    Homonyms are fun!
    You're driving your car, but they're riding their bikes there.
  23. Computer Music by Sanat · · Score: 2, Interesting

    This reminds me of the CDC computer that played classical music utilizing the speaker in the console via program loops, also

    The card reader reading cards at the appropriate time

    The tape drives rocking tapes and loading/unloading the heads

    The disk drives clicking head carriage locking solenoids

    The card punch punching a few cards in rhythm

    The line printer printing the cadence

    Listening to Mozart, Bach etc. was quite an experience in this manner. Unfortunately we did not have the source code.

    Of course, back in those days we did however sit closer to the machine code than one typically does presently. So it was possible to list it and see how it did what it did.

    The cpu timing cycles (core read & write) was accomplished with a delay line and sending a "0" pulse down the coil with various taps located at the appropriate distance to perform each timing step in order.

    --
    And in the end, the love you take is equal to the love you make
  24. Re:Mods vs MIDI by Orne · · Score: 2, Informative

    Today it does... But think about when it first appeared... The .mod (.s3m, .xm, etc) format was a bridge between .mid and .wav formats... in MIDI, you have a pure music score, and you rely on the local hardware to decode the song and make it sound realistic. A Waveform is pure audio output, with no track structure to indicate which instrument is supposed to play when, it's just an amalgum of all the frequencies together. Back in 1987 only the Amiga had multivoice sound, and you didn't have all this fancy on-board sound banks. You were supposed to buy a dedicated card for MIDI, or external hardware. Later for IBM PCs, your joystick port was expected to serially connect to a MIDI device that could play the music... which is why it's also called a Roland MPU-401 port.

    The Module format allows you to create a song in pseudo-sheet music form, while it also stores the audio samples for the tracks in the file itself... The song sounds just as good on an 8-bit audio card without a MIDI decoder, as it does on today's 32-bit cards with practically a symphony of samples in ROM. Yes, you were limited to music beats in 1/64th of a measure, and Yes, early .mod formats were 4 voices (now 64), but Modules still fill a niche.

    Ah, information. We can see from this history that the SoundBlaster had their own form of synthesized music in 1989 (OPL2), and didn't support General MIDI until SoundBlaster 16 in 1992.

  25. jMusic by thanjee · · Score: 4, Interesting

    Wow - my best friend is one of the developers of jMusic! It is an open source music synthesis and composition package written in java. You can download the latest version from sourceforge.
    or you can get it from the jMusic web site:

    http://jmusic.ci.qut.edu.au

    jMusic has been used for many other very weird and wonderful things like elevator installations, and many electronic performances. It does heaps of stuff including Markov, gendyn, granular and particle synthesis, dance music and much more :)

    --
    Saying your OS is the best because more people use it is like saying MacDonalds make the best food
  26. Interesting and all by nate+nice · · Score: 3, Interesting

    This is cool, but I'm guessing the results won't be very...well, great. Theoretically you could construct every bit pattern for say, 1 MB - 5 MB, capturing the typical encoding of an MP3. Then, you select each byte pattern that sounds good. You would in fact "create" every song that has ever been encoded into MP3 format between 1 and 5 MB. The only problem with this is you are creating more byte patterns than there are protons in the universe, so this is of course practically impossible. It doesn't stop with music either. Anything that can be encoded digitally can be "created" this way. Obviously this cannot happen, not with what we know of anyways, so it's pointless. But it is interesting none the less to think that everything you see, hear, use etc in the realm of digitazion can be created with a simple NFA or graph set to take each "path" and then decode what's viable, etc. Perhaps I should create this algorithm and claim all information withen a certain byte range, sueing for copyright infringment anytime something is created on a computer, as my algorithm has created it already. It's interesting to think about how we get to "create" a finite path in a DFA or byte graph that really already exists, but we need to "find" it.

    --
    "If you are a dreamer, a wisher, a liar, A hope-er, a pray-er, a magic bean buyer ..."
  27. Staff software engineer? by Number44 · · Score: 4, Informative

    I'm puzzled why the poster referred to the title of the guy as "Staff Software Engineer" as if it's something special at IBM. Not to denigrate the work he's done, but 'staff engineer' is not worth mentioning. In context as seen from an IBM Engineers perspective (I'm also staff, fwiw) it's pretty funny that you would even include it. Here's the ranks for those that might care:

    Band 1-5: The non-technical types.

    Band 6: "nothing" Engineer (new hires)

    Band 7: Staff Engineer (basically, you get staff in your first few years at IBM unless you're a total moron, and if you DON'T make staff at some point they basically have to promote or fire you)

    Band 8: Advisory Engineer (most IBM engineers spend the bulk of their career as advisory)

    Band 9: Senior Engineer (the fastest I've seen senior made was 10 years, and it's typically 15+ before you get to senior)

    Band 10: Senior Technical Staff Member or STSM (most engineers at IBM never make it this far)

    Band 11: Distinguished Engineer (you have to walk on water and have saved entire villages from destruction to get to this, you basically do whatever you want with a huge budget and work on only the coolest stuff)

    Band 12: IBM Fellow (you are the uber shiznit, report to the execs, and the world is your oyster)

    Look at this as an insight into the workings of the hive mind at IBM. We are the borg, yada yada yada.

  28. Re:err excuse me... by MrBigInThePants · · Score: 2, Insightful

    Listened to 110 again and still I hold true to my statements.

    It is simply an audio "visualisation" of pattern data. (pattern data taken to include things like fractals the repeat in interesting ways)

    I don't want it to sound like man music, just some sort of sound that actually approximates something like music. Certain musicians specialise in creating random sounding music for various academic (one only hopes) purposes, but this is not what this is.

  29. Java vs. specialty languages by jtheory · · Score: 5, Interesting
    It's not the capabilities of jMusic or the Java Sound API that led them to Java. If you just balance a list of capabilities in the musical realm, there are plenty of specialty languages and environments -- i.e., MAX, PD, ChucK, and so on -- that have greater built-in capabilities, because they are languages or scripting engines focussed only on music. That's also the downside of those languages, though; they are specialty languages.

    In '97-'98 I wrote a bunch of music theory training programs for the Music department at my school (they eventually became this website), and I tried out MAX first before I went with Java. MAX was far better equipped to handle the music-related requirements (anyone remember Java 1.0.2?). But with Java I could put my applets online, run them on any OS, and (biggest bonus) get some serious experience in a language that would get me my first job when I got out of college. Learning a new language to a level where you can tackle an ambitious project is a big investment. There are a lot of musicians and composers with day jobs as developers (like me) who want to be able to leverage what they already have, if feasible. And nowadays, Java has pretty good support for audio, as general-purpose languages go, so many projects wouldn't be giving up much to use Java.

    Here are a few snippets from the jMusic website that suggest why they chose Java for their project:
    Programming in jMusic is programming in Java, not in a meta-language or scripting environment. This means that the full power and cross platform independence of Java is maintained, it also means that the more you know about Java programming the more useful jMusic will be to you. Learning jMusic can be a fun way to gain Java programming skills while focusing on making music.

    [...]Because jMusic has full access to the Java language and support structures, your jMusic work can be as extensive as Java allows (and that is VERY extensive).
    There are more hints at this in the intro of the article, as well.
    --
    There are only 10 types of people: those who understand decimal, those who don't, and, uh, 8 other types I forget.
  30. Meta Math Music by quantumpunk · · Score: 2, Informative
    Some other interesting music made with math can be found at metamath.org where they made midi tracks based on mathematical proofs. Some of them sound pretty cool. Here is the link: Metamath.org/mpegif/mmmusic

    From the site:

    Mathematical Proofs Set to Music I added this web page just for fun. While looking at some proofs, it occurred to me that their structure resembled musical scores, so as an experiment I decided to see what they sounded like. Essentially, the musical notes correspond to the depth of the proof tree as the proof is constructed by the proof verifier. A fast higher note is produced for each step in the construction of a formula. A sustained lower note is produced when the formula is matched to a previous theorem or earlier proof step, to result in a new proof step (which corresponds to a proof step displayed on the Metamath Proof Explorer page that shows the theorem's proof).

    --
    All science is either physics or stamp collecting. Ernest Rutherford (1871-1937)
  31. Koan: an alternative music engine approach by peteatslashdot · · Score: 2, Interesting

    I'd suggest that interested folks check-out http://www.sseyo.com to see a completely different approach to creating generative music, using SSEYO's Koan music engine, which is actually aimed at deploying mobile devices. The site lets Windows users download a plugin/Active X that allows you to listen to some of the interactive sounds/music, and play with the demos, including the awesome "Do The Space Shake" :)

  32. Grammidity by LarsWestergren · · Score: 4, Interesting

    Another program (written in Java incidentally) which among other things generate music: Grammidity

    It works on the "evolve" principle where you "mate" two objects, and then let either the user or some algorithm decide which of the children are most successful and can evolve further.

    --

    Being bitter is drinking poison and hoping someone else will die

  33. Re:Which Douglas Adams book ... by revscat · · Score: 2, Interesting

    I think it was Dirk Gently...

  34. AI music from the Amiga by maokh · · Score: 2, Interesting
    Back in the day, there was a weird program for the Amiga computer called "Algoplayer". This program used some crazy AI code to generate random MOD-like songs, based on a seed number. Of course, the genre is techno/house!

    A few years back, I brushed the dust off of my old Amiga, powered it on, and recorded a few good songs produced from this generator.

    I have posted several MP3's of sample output on this website, and some of it rivals some of the garbage coming out of the Dance Top 40 as of late.

    http://www.maokhian.com/music/

  35. This isn't new by Walter+Wart · · Score: 2, Informative

    Algorithmic music systems go back at least as far as Mozart. Composers made up algorithms to generate tunes with some sort of randomization (e.g. dice) to make key decisions.

    --
    The man who never alters his opinion is like the stagnant water and breeds Reptiles of the Mind -- William Blake