review/commit Peter Creath's bugfix patch 1
[xiph/unicode.git] / MTG / convert.pl
blobadb769c9df3f6f917c2de0d3180a937eff02debc
1 #!/usr/bin/perl -w
3 my $from=$ARGV[0];
4 my $to=$ARGV[1];
6 print "convert.pl 20020130 from $from to $to\n";
8 my $output=`file $from`;
9 my $channels=0;
11 if($output=~m/WAVE/){
12 print "input file is WAV...\n";
13 if($output=~m/stereo/){
14 $channels=2;
16 if($output=~m/mono/){
17 $channels=1;
20 $output=`sox $from -t RAW -w -s -c $channels -r 44100 $to`;
21 tack_header();
22 exit(0);
25 print "input is an unsupported file type (for now)\n";
29 sub tack_header{
30 my$footer=pack("ii",55,$channels);
31 die $! unless open(TEMP,">>$to");
32 syswrite TEMP,$footer;
33 close(TEMP);