Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Making Music with Perl

by bladx (Chaplain)
on Sep 18, 2001 at 05:28 UTC ( #113025=perlquestion: print w/replies, xml ) Need Help??
bladx has asked for the wisdom of the Perl Monks concerning the following question:

hey everyone-

For my next project, I decided that since I like to compose music for other instruments, etc. why not try to make some cool music using Perl?

Is there some way I can use a Perl and some modules perhaps to work with creating some sound, even if it means using Perl to really use another mixer program for instance, that comes with a typical linux distro (red hat.)

If this is not possible, perhaps it will be a module idea I could try to come up with some day :-)


Andy Summers

Replies are listed 'Best First'.
Re: Making Music with Perl
by Zaxo (Archbishop) on Sep 18, 2001 at 06:19 UTC

    CPAN search 'Audio' turns up 49 modules found in 20 distributions matching 'Audio'.

    Update: Midi gets 9 modules found in 4 distributions.

    Searches on Sound, and other likely words turn up a few more. There's a lot of info to find by searching.

    Tip o' the hat to Albannach.

    After Compline,

Re: Making Music with Perl
by jake (Monk) on Sep 18, 2001 at 07:53 UTC

    I'm using Perl to generate Csound files. I haven't released much code for this, but I plan on releasing several Perl objects in the near future. Here is a script that I wrote way back in March. It's sloppy code, but it's one of my earliest attempts at Perl music. Csound is a music synthesis language. It doesn't come with Red Hat, but it is free and works with linux.

    I suggest reading this node for more information.

    "This space intentionally left blank" -Zork
Re: Making Music with Perl
by charnos (Friar) on Sep 18, 2001 at 07:18 UTC
    Looking at CPAN, MIDI::Perl seems to the most comprehensive package, at least as far as MIDI is concerned. As for other media, Audio::DSP, Audio::Tools, and Audio::CoolEdit may prove interesting. I'm not sure what other help to offer besides STFW (search the 'friendly' web). Experimentation is the best way to learn new things.

    Good luck composing!
(jeffa) Re: Making Music with Perl
by jeffa (Bishop) on Sep 19, 2001 at 00:10 UTC
    Having come from a serious music background, you better believe that using Perl to create sounds has crossed my mind more than once.

    I recommend using Audio::Wav to create interesting sound effects (via Audio::Wav::Write). But that is about all. :(

    The CPAN MIDI modules are really not very useful, but that's to be expected - who really wants to spend 5 hours composing MIDI in Perl when you can get the job done in 1 hour with a shareware MIDI composer?

    As for Audio::CoolEdit (playing with CoolEdit is one of my favorite past times!), well, all it seams to do is arrange wav files for a multitrack - seems to be a waste of Perl's time if you ask me . . . . hmmmm, but maybe not for a CGI app?

    Anyhoo - good luck to you, like i said - i think the best thing to do is to use Perl to create 'SOUNDS' and use another application to mix/merge those sounds together.


Re: Making Music with Perl
by aijin (Monk) on Sep 19, 2001 at 00:50 UTC
    If you're looking to do some experimentation, you might like to take a look at KeyKit. I used Perl to parse through various text files, setting rules for what letter/word did what, and produced KeyKit readable files.

    Okay, that's not terrible clear. Let me try to elaborate.

    One of the experiments I did was to take various Shakespeare sonnets and run them through a few rules. Each word was a chord, and each vowel was a letter. Multiple instances of the same vowel produced different octaves. The Perl script produced a file that KeyKit could import and then I could fool around with it in there. And it actually sounded pretty good!

    So yeah, KeyKit isn't Perl, but you can use it with Perl to do some neat experimental music stuff and it's really quite a neat little app to play with.

    - aijin

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://113025]
Approved by root
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2018-01-18 12:49 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (211 votes). Check out past polls.