voxforge.org
VoxForge Dev

Changeset 2580

Show
Ignore:
Timestamp:
05/12/08 22:30:31 (4 months ago)
Author:
kmaclean
Message:

Change audio processing scripts (Audio.pm) to convert audio to mono when migrating to Main directory

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Trunk/Scripts/Audio_scripts/UserSubmission/AUDIO.pm

    r2534 r2580  
    8383                        if ($suffix eq "wav") { 
    8484                                print "downsampling:$directory\/$filename\n" if $debug; 
    85                             $command = ("sox $directory/$filename -r $targetrate -w $directory/temp-$filename"); system($command) == 0 or confess "system $command failed: $?";  
     85                            $command = ("sox $directory/$filename -c 1 -r $targetrate -w $directory/temp-$filename"); system($command) == 0 or confess "system $command failed: $?";  
    8686                                $command = ("mv $directory/temp-$filename $directory/$filename"); system($command) == 0 or confess "system $command failed: $?";    
    8787                        } elsif ($suffix eq "raw") { # convert raw files to wav (i.e. add a wav header) 
    8888                                print "downsampling:$directory\/$filename\n" if $debug; 
    89                                 $command = ("sox -r $original_sampling_rate -s -w $directory/$filename -t wav -r $targetrate -w $directory/temp-$filename"); system($command) == 0 or confess "$command failed: $?";  
     89                                $command = ("sox -r $original_sampling_rate -s -w $directory/$filename -c 1 -t wav -r $targetrate -w $directory/temp-$filename"); system($command) == 0 or confess "$command failed: $?";  
    9090                                # need to leave 'raw' filename unchanged (i.e. don't rename it to wav)  
    9191                                # only change filenames using svn, otherwise lose you svn history on the file. 
     
    9898                                # downsample 
    9999                                # flac can encode and downsample at the same time, but there are different types of downsampling algorithms ... not sure what flac uses - stick with sox. 
    100                             $command = ("sox $directory/$filename_nosuffix\.wav -r $targetrate -w $directory/temp-$filename_nosuffix\.wav"); print "$command\n" if $debug;  system($command) == 0 or confess "system $command failed: $?";  
     100                            $command = ("sox $directory/$filename_nosuffix\.wav -c 1 -r $targetrate -w $directory/temp-$filename_nosuffix\.wav"); print "$command\n" if $debug;  system($command) == 0 or confess "system $command failed: $?";  
    101101                            # convert back to flac; overwrite original file 
    102102                                $command = ("flac -eVf $directory/temp-$filename_nosuffix\.wav -o $directory/$filename"); print "$command\n" if $debug; system($command) == 0 or confess "system $command failed: $?";