Some of you may already be familiar with Csound. For those who aren't, Csound is a music synthesizer programming language. I've been using Csound to make music since 1997. Last summer, I started using perl to generate Csound code.

Earlier today, I released a perl generated composition entitled "isolation". This piece is simple compared to the others I have in the works, but it is my first perl composition.

Please take a listen and tell me what you think. Hopefully, you too, will think this is a cool use for perl.

--jake
"This space intentionally left blank" -Zork

Update: November 26, 2001 at 1:25
For those of you who are having problems downloading "isolation" from mp3.com, try here.

Replies are listed 'Best First'.
Re: Composing Music with Csound and Perl
by ginseng (Pilgrim) on Aug 02, 2001 at 06:59 UTC
    Can you describe CSound some more? How does it work? What OS's has it been ported to? Is it open source? Is it well documented?

    I like the track you posted, and my first inclination was to ask for the source that created it. But not knowing what CSound is, I figured the source may not do me any good ;) So I figured I'd ask for you to fill me in more instead!

    (I know I could google this stuff...I'm hoping you'll share your opinions as well as your music.)

      Csound is a computer music language. It's an ancestor of the original computer music languages developed at Bell Labs by Max Mathews back in the late 50's.

      A person creates sounds and music by writing two text files. The orchestra (foo.orc) and the score (foo.sco). Csound acts as a compiler and generates a sound file based on the two files.

      The orchestra file is where a person defines his instruments. This part is like designing sounds on a commercial synthesizer. But because Csound has no fixed signal flows, the designer has totalitarian control over his instruments. Each instrument defined in the orchestra is like a musician in the orchestra pit.

      The score file is the counterpart to the orchestra file. The score tells the instruments when and what to play.

      example foo.orc
      instr 1 aosc oscil p4, p5, 1 out aosc endin
      example foo.sco
      f1 0 8192 10 1 i1 0 4 440 i1 6 10 262
      These two files will generate a sound file that will play a sine wave at time 0 for 4 seconds at 440HZ, then another sine wave at time 6 for 10 seconds at 262Hz. The "f1" in the score defines a table of all the discrete points in a sine wave. I know I'm not explaining everything... I can't possibly in one post. :)

      It's been ported to many OS's, including windows, mac and linux. It is open source. People in the Csound community actively improve and add functionality. It does have some what of a restrictive license, an MIT Educational purposes only type license (although that only applies to the Csound source code, not the generated sounds files).

      Today, it is very well documented. There are two sites, the Csound FrontPage and csounds.com. There is also the Csound book. When I started using it, information about it was hard to come by. I started by taking apart simple instruments and changing one parameter at a time.

      I have an online tutorial I wrote for from undergraduate student project. It is a bit immature, but I wrote it a long time ago. But all the information in it is still 100% useful.

      And finally... You can look at the Csound files to "isolation" here.

      --jake
      "This space intentionally left blank" -Zork
        Awesome, and thank you. I will look in the ports tree as soon as I'm done writing this reply. I am still interested in seeing your source code for the perl program that generated isolation, or at least hear more about how it worked - primarily because I think it's a neat idea. (I'm already thinking about what data would be represented in the most interesting manners, when presented musically...julia sets? monk locations? hmm...)

        Thanks again for the excellent description.

Re: Composing Music with Csound and Perl
by Everlasting God (Beadle) on Aug 03, 2001 at 06:46 UTC
    Perhaps an octave of two high for my taste and comfort (anyone who has been driven screaming from an apple 2c lab by a monitor left on after the cpu was turned off knows what I mean) but nonetheless pretty darn good. I'm feeling a lot of SAW2 influence there, intentional or not. If you're not familiar with Aphex Twin, which seems almost impossible ;-), I hightly recomend any of his work. I am also gonna have to take a look at csound, you may be responsible for 'monkdoting' their poor server. From the little I've read, it kinda strikes me as POV-RAY for music, with attendant steep learning curve but rich rewards. I would love to see the perl that made the csound that made the mp3, if you feel like posting it. (whew)

    'The fickle fascination of and Everlasting God' - Billy Corgan, The Smashing Pumpkins
      I added the perl script here. The file is isolation.pl. The code is ugly. But since we're all friends here, I don't mind you looking at my less than efficient code. I've since moved into the realm of OOP Perl to create Csound files. Much cleaner, but I'm not putting that up until my next composition is finished.

      I am familiar with Aphex Twin. He uses Csound himself, or so I've heard through certain channels.

      I've heard the POV-RAY comparison before, and I agree 100%.

      --jake
      "This space intentionally left blank" -Zork
        Certain channels, eh? You aren't Richard James in disguise by any chance? But seriously, he is aparently known for being pro open souce and pro linux when it comes to his software. Guess it springs from is days building his own hardsynths. (if that's a word)

        I also have an idea for a project, although unless I can hack perlqt enough to run with the windows version of qt and the cygwin version of everything else it will have to be something other than Perl. I've seen plenty of programs that will emulate a midi keyboard, but i've never seen anything that will emulate a midi knob controller, like the phatboy. I am itching to play with the realtime stuff in Csound, but I don't have the $$$ for a phatboy, so I thought I'd write my own. Unless anybody has seen such a program, in which case I'll still write my own, just to learn more qt and midi.

        Anyway, keep the music coming, for those of us not gifted with musical talent. Oh yeah, it would be neat to see some OO music code too, I can't even imagine what that'd be like.

        'The fickle fascination of and Everlasting God' - Billy Corgan, The Smashing Pumpkins