I am assuming you are running under Windows since you reference "C:/My Documents" in your script.
To save the files in your script, you are going to need to encode them into a text encoding. MIME::Base64 seems to be a good choice; it is widely used and supported, and there are modules readily available to work with them. Just be aware that wav files tend to be fairly large, and will take up a lot of space (relatively speaking).
Use a script something like this to encode the .wav files:
###########################################################
use warnings;
use strict;
use MIME::Base64;
my $filename = shift;
open my $file, '<', $filename or die $!;
my $data;
while (sysread($file, $data, 57 * 17))
{
print encode_base64($data);
}
###########################################################
Feed it a wav filename and redirect the output to a file.
Once you have that, you can use it in something like this.
You may be better off storing the wavs in a separate module. Just call/load them as necessary. |