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.)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.