in reply to Generating a wave file

To supplement HyperZonk's suggestion: in case you need to write some particular audio file format other than ".au" (which is what Audio::Data handles), you'll also want to look at Audio::Wav, Audio::SoundFile, maybe some others (just enter "audio" for the cpan module search).

But don't feel bad if these things aren't exactly what you need. There are also some nice tools written in C... (sox has probably been around the longest and can do the most, and the portions of its code that I've seen are reasonably well documented, so you can work out what's going on).

Frankly, I tend to prefer C for audio-related stuff: declare a buffer for short ints, fill it using a loop that implements some function, or by reading from a A/D converter, and write it to a disk file -- no muss, no fuss, and nothing very obscure. (Though I did recently use perl to validate/repair some mangled ms-wav file headers -- I'm getting better with the "pack" and "unpack" functions, and I was able to code it quicker than I could have in C; it's just that you need "pack" and "unpack" to do audio properly in Perl, and these calls tend to be hard to grok -- their descriptions in perlfunc are not an easy read.)