voxforge.org
VoxForge Dev

Changeset 2263

Show
Ignore:
Timestamp:
08/23/07 15:16:30 (1 year ago)
Author:
kmaclean
Message:

draft updates for flac audio processing; and upgrade licenses to GPLv3

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Trunk/Scripts/Audio_scripts/AudioBooks/AudioBook.pl

    r2229 r2263  
    238238                $line =~ s/\(//g; # remove parenthesis   
    239239                $line =~ s/\)//g; # remove parenthesis   
     240                $line =~ s/\[//g; # remove bracket       
     241                $line =~ s/\]//g; # remove bracket       
    240242                $line =~ s/_//g; # remove underscore     
     243                $line =~ s/\*//g; # remove asterisk 
    241244                # Other cleanup  
    242245                $line =~ s/&/AND/g;  
  • Trunk/Scripts/Audio_scripts/AudioBooks/htksegment.pl

    r2224 r2263  
    143143        my @aligned_line = split(/ /,$aligned_words[$sentence_end + $increment]); 
    144144        my ($word,$startTime,$endTime,$pause) = @aligned_line; 
    145         if ($pause > $min_pause_for_sentence_break) { 
     145        if ($pause >= $min_pause_for_sentence_break) { 
    146146                my $count; 
    147147                my $padded_fileid = sprintf("%04d",$fileid); 
  • Trunk/Scripts/Audio_scripts/Repository.pm

    r2189 r2263  
    66### email: contact@voxforge.org 
    77### Date: 2006.09.26 
    8 ### Version: 0.3 
     8### Version: 0.4 
    99###              
    1010### Copyright (C) 2006 Ken MacLean 
     
    2222### Change History: 
    2323### rel0.3 - 2007.01.9 - modularize code and updates as part of user submission automation 
    24 ### 
     24### r0.4 (Aug 22, 2007) - added Flac processing       
    2525#################################################################### 
    2626package Repository; 
    2727use strict; 
    2828use File::Spec; 
     29use diagnostics; 
     30use Carp; 
    2931 
    3032# modules 
    3133use UserSubmission::README(); 
    3234use Repository::Main(); 
    33 use Repository::MFCC(); 
     35use Repository::Mfcc(); 
    3436use Repository::Original(); 
    3537use UserSubmission::PROMPTS(); 
     
    6466                ($$parms{"TargetAudioRateDir"}, $$parms{"DownsampleRate"}, $$parms{"DownsampleBitsPerSample"}) = ("8kHz_16bit", 8000, 16); 
    6567                $$parms{"path_main"} = "$AudioDirectory/Main/" . $$parms{"TargetAudioRateDir"}; 
    66                 $$parms{"path_mfcc"} = "$AudioDirectory/MFCC/" . $$parms{"TargetAudioRateDir"} . "/" . $$parms{"HTK_ParameterKind"}; 
     68                $$parms{"path_mfcc"} = "$AudioDirectory/Mfcc/" . $$parms{"TargetAudioRateDir"} . "/" . $$parms{"HTK_ParameterKind"}; 
    6769                Repository::Main::Process($parms, \%AudioDirParms) || die "Repository error: $?";                
    68                 Repository::MFCC::Create($parms, \%AudioDirParms) || die "Repository error: $?";  
     70                Repository::Mfcc::Create($parms, \%AudioDirParms) || die "Repository error: $?";  
    6971                UserSubmission::PROMPTS::UpdateMasterPrompts($parms, \%AudioDirParms,$$parms{"PromptsFile_8kHz-16bit"}  ) || die "Repository error: $?";                 
    7072 
     
    7577                        ($$parms{"TargetAudioRateDir"}, $$parms{"DownsampleRate"}, $$parms{"DownsampleBitsPerSample"}) = ("16kHz_16bit", 16000, 16); 
    7678                        $$parms{"path_main"} = "$AudioDirectory/Main/" . $$parms{"TargetAudioRateDir"}; 
    77                         $$parms{"path_mfcc"} = "$AudioDirectory/MFCC/" . $$parms{"TargetAudioRateDir"} . "/" . $$parms{"HTK_ParameterKind"}; 
     79                        $$parms{"path_mfcc"} = "$AudioDirectory/Mfcc/" . $$parms{"TargetAudioRateDir"} . "/" . $$parms{"HTK_ParameterKind"}; 
    7880                        Repository::Main::Process($parms, \%AudioDirParms) || die "Repository error: $?";                
    79                         Repository::MFCC::Create($parms, \%AudioDirParms) || die "Repository error: $?"; 
     81                        Repository::Mfcc::Create($parms, \%AudioDirParms) || die "Repository error: $?"; 
    8082                        UserSubmission::PROMPTS::UpdateMasterPrompts($parms, \%AudioDirParms,$$parms{"PromptsFile_16kHz-16bit"} ) || die "Repository error: $?"; 
    8183                } else { 
  • Trunk/Scripts/Audio_scripts/Repository/Main.pm

    r2196 r2263  
    33### 
    44### script name : Main.pm 
    5 ### version: 0.1 
     5### version: 0.2 
    66### created by: Ken MacLean 
    77### mail: contact@voxforge.org 
     
    1212### This program is free software; you can redistribute it and/or 
    1313### modify it under the terms of the GNU General Public License 
    14 ### as published by the Free Software Foundation; either version 2 
     14### as published by the Free Software Foundation; either version 3 
    1515### of the License, or (at your option) any later version. 
    1616### 
     
    1919### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    2020### GNU General Public License for more details. 
    21 ###                                                              
     21###      
     22###   r0.2 (Aug 22, 2007) - added Flac processing                                                               
    2223#################################################################### 
    2324package Repository::Main; 
    2425use strict; 
     26use diagnostics; 
     27use Carp; 
     28# modules 
     29use lib '../../Audio_scripts'; 
     30use UserSubmission::AUDIO(); 
     31#################################################################### 
    2532my $command; 
    2633 
     
    3946 
    4047        # copy audio files from Original directory to Main directory 
    41         $command = ("svn copy $path_original/$audio_dir_name $path_main/$audio_dir_name"); print "$command\n" if $debug; system($command) == 0 or die "system $command failed: $?";    
     48        $command = ("svn copy $path_original/$audio_dir_name $path_main/$audio_dir_name"); print "$command\n" if $debug; system($command) == 0 or confess "system $command failed: $?";    
     49# !!!!!! 
    4250        # run downsample script    #./downsample.pl will downsample files and keep original file suffix - will not rename 'raw' to 'wav' file suffix 
    43         $command = ("cd $AudioScripts_dir/Repository && ./Main/downsample.pl $path_main/$audio_dir_name/$audio_subdirectory $OriginalSamplingRate $downsample_rate $debug");print "$command\n" if $debug;  system($command) == 0 or die "system $command failed: $?";       
     51        #$command = ("cd $AudioScripts_dir/Repository && ./Main/downsample.pl $path_main/$audio_dir_name/$audio_subdirectory $OriginalSamplingRate $downsample_rate $debug");print "$command\n" if $debug;  system($command) == 0 or confess "system $command failed: $?";       
     52        UserSubmission::AUDIO::Downsample($parms, $AudioDirParms) || confess "Repository error: $?"; 
     53# !!!!!!         
    4454        # update properties 
    45         $command = ("svn propset -R sampling_rate_Hz $downsample_rate $path_main/$audio_dir_name"); print "$command\n" if $debug;  system($command) == 0 or die "system $command failed: $?";   
    46         $command = ("svn propset -R bits_per_sample $downsample_bits_per_sample $path_main/$audio_dir_name" ); print "$command\n" if $debug;  system($command) == 0 or die "system $command failed: $?";   
    47         $command = ("svn update -r HEAD $path_main/$audio_dir_name");print "$command\n" if $debug;  system($command) == 0 or die "system $command failed: $?";     
    48         $command = ("svn commit -m \"downsampled $audio_dir_name audio files & updated properties\" $path_main/$audio_dir_name"); print "$command\n" if $debug;  system($command) == 0 or die "system $command failed: $?";       
     55        $command = ("svn propset -R sampling_rate_Hz $downsample_rate $path_main/$audio_dir_name"); print "$command\n" if $debug;  system($command) == 0 or confess "system $command failed: $?";   
     56        $command = ("svn propset -R bits_per_sample $downsample_bits_per_sample $path_main/$audio_dir_name" ); print "$command\n" if $debug;  system($command) == 0 or confess "system $command failed: $?";   
     57        $command = ("svn update -r HEAD $path_main/$audio_dir_name");print "$command\n" if $debug;  system($command) == 0 or confess "system $command failed: $?";     
     58        $command = ("svn commit -m \"downsampled $audio_dir_name audio files & updated properties\" $path_main/$audio_dir_name"); print "$command\n" if $debug;  system($command) == 0 or confess "system $command failed: $?";       
    4959        print "Main completed for $path_original/$audio_dir_name\n"; 
    5060        return 1;        
  • Trunk/Scripts/Audio_scripts/Repository/Mfcc.pm

    r2196 r2263  
    22#################################################################### 
    33### 
    4 ### script name : MFCC.pm 
    5 ### version: 0.1 
     4### script name : Mfcc.pm 
     5### version: 0.2 
    66### created by: Ken MacLean 
    77### mail: contact@voxforge.org 
     
    1212### This program is free software; you can redistribute it and/or 
    1313### modify it under the terms of the GNU General Public License 
    14 ### as published by the Free Software Foundation; either version 2 
     14### as published by the Free Software Foundation; either version 3 
    1515### of the License, or (at your option) any later version. 
    1616### 
     
    2121###   
    2222### Change log: 
    23 ### Release 0.1.1 jan 22, 2006 - integrated  ConvertWav2mfc.pl script                                                           
     23### Release 0.1.1 jan 22, 2006 - integrated  ConvertWav2mfc.pl script   
     24### r0.2 (Aug 22, 2007) - added Flac processing                                                               
    2425### 
    2526#################################################################### 
    26 package Repository::MFCC
     27package Repository::Mfcc
    2728use strict; 
     29use diagnostics; 
     30use Carp; 
    2831my $command; 
    2932 
     
    4043         
    4144        #cleanup required before copy (cleanup .svn files???) 
    42         $command = ("svn cleanup $path_main/$audio_dir_name" ); print "$command\n" if $debug; system($command) == 0 or die "system $command failed: $?";    
     45        $command = ("svn cleanup $path_main/$audio_dir_name" ); print "$command\n" if $debug; system($command) == 0 or confess "system $command failed: $?";    
    4346        # make sure target directory exists (i.e. 'MFCC/16kHz:16-bit')      
    4447        # copy audio files from Original directory to Main directory 
    45         $command = ("svn copy $path_main/$audio_dir_name $path_mfcc/$audio_dir_name" ); print "$command\n" if $debug; system($command) == 0 or die "system $command failed: $?";    
    46         $command = ("svn update -r HEAD $path_mfcc/$audio_dir_name");print "$command\n" if $debug; system($command) == 0 or die "system $command failed: $?";   
    47         $command = ("svn commit -m \"copied $audio_dir_name wav files to MFCC directory\" $path_mfcc/$audio_dir_name");print "$command\n" if $debug; system($command) == 0 or die "system $command failed: $?";          
     48        $command = ("svn copy $path_main/$audio_dir_name $path_mfcc/$audio_dir_name" ); print "$command\n" if $debug; system($command) == 0 or confess "system $command failed: $?";    
     49        $command = ("svn update -r HEAD $path_mfcc/$audio_dir_name");print "$command\n" if $debug; system($command) == 0 or confess "system $command failed: $?";   
     50        $command = ("svn commit -m \"copied $audio_dir_name wav files to MFCC directory\" $path_mfcc/$audio_dir_name");print "$command\n" if $debug; system($command) == 0 or confess "system $command failed: $?";          
    4851        # rename wav directory to mfc 
    49         $command = ("svn move $path_mfcc/$audio_dir_name/$audio_subdirectory $path_mfcc/$audio_dir_name/mfc"); print "$command\n" if $debug; system($command) == 0 or die "system $command failed: $?"; 
    50         $command = ("svn update -r HEAD $path_mfcc/$audio_dir_name"); print "$command\n" if $debug; system($command) == 0 or die "system $command failed: $?";   
    51         $command = ("svn commit -m \"renamed $audio_dir_name wav directory to mfc\" $path_mfcc/$audio_dir_name"); print "$command\n" if $debug;  system($command) == 0 or die "system $command failed: $?"; 
     52        $command = ("svn move $path_mfcc/$audio_dir_name/$audio_subdirectory $path_mfcc/$audio_dir_name/mfc"); print "$command\n" if $debug; system($command) == 0 or confess "system $command failed: $?"; 
     53        $command = ("svn update -r HEAD $path_mfcc/$audio_dir_name"); print "$command\n" if $debug; system($command) == 0 or confess "system $command failed: $?";   
     54        $command = ("svn commit -m \"renamed $audio_dir_name wav directory to mfc\" $path_mfcc/$audio_dir_name"); print "$command\n" if $debug;  system($command) == 0 or confess "system $command failed: $?"; 
    5255        #Convert wav audio to HTK mfcc script   
    5356        # do not refresh in Eclipse (i.e. Subclipse client to Subversion) to view progress of this script  
    5457        # refreshing svn workspace causes strange errors with this script!!!     
    5558# !!!!!! 
    56 #       $command = ("cd $AudioScripts_dir/Repository && ./ConvertWav2mfc.pl $path_mfcc/$audio_dir_name/mfc $debug"); print "$command\n" if $debug;  system($command) == 0 or die "system $command failed: $?";       
    57         ConvertWav2mfc($parms, $AudioDirParms)|| die "MFCC\.pm error: $?"; 
     59#       $command = ("cd $AudioScripts_dir/Repository && ./ConvertWav2mfc.pl $path_mfcc/$audio_dir_name/mfc $debug"); print "$command\n" if $debug;  system($command) == 0 or confess "system $command failed: $?";       
     60        ConvertWav2mfc($parms, $AudioDirParms)|| confess "MFCC\.pm error: $?"; 
    5861# !!!!!!         
    5962        #update properties 
    60         $command = ("svn propset -R HTK_ParameterKindWithQualifiers $HTK_ParameterKindWithQualifiers $path_mfcc/$audio_dir_name"); print "$command\n" if $debug;  system($command) == 0 or die "system $command failed: $?"; 
    61         $command = ("svn update -r HEAD $path_mfcc"); print "$command\n" if $debug;  system($command) == 0 or die "system $command failed: $?";   
    62         $command = ("svn commit -m \"$audio_dir_name wav files converted to HTK mfc & updated properties\" $path_mfcc/$audio_dir_name"); print "$command\n" if $debug;  system($command) == 0 or die "system $command failed: $?";   
     63        $command = ("svn propset -R HTK_ParameterKindWithQualifiers $HTK_ParameterKindWithQualifiers $path_mfcc/$audio_dir_name"); print "$command\n" if $debug;  system($command) == 0 or confess "system $command failed: $?"; 
     64        $command = ("svn update -r HEAD $path_mfcc"); print "$command\n" if $debug;  system($command) == 0 or confess "system $command failed: $?";   
     65        $command = ("svn commit -m \"$audio_dir_name wav files converted to HTK mfc & updated properties\" $path_mfcc/$audio_dir_name"); print "$command\n" if $debug;  system($command) == 0 or confess "system $command failed: $?";   
    6366        return 1;      
    6467} 
     
    7679         
    7780        # open directory 
    78         opendir(DIR, "$directory") || die ("Unable to open directory: $directory"); 
     81        opendir(DIR, "$directory") || confess ("Unable to open directory: $directory"); 
    7982         
    8083        # process each file name in directory one at a time 
    8184        while (my $filename = readdir(DIR)) { 
    8285                chomp ($filename); 
    83                 if ($filename ne "." and $filename ne ".." ) { 
    84                         my($temp, $suffix1) =split(/\./, $filename); # this tells you that there is a file name that has at least one period in its name         
    85                         if (defined($suffix1)) { # this is to address the cases where a file has no suffix       
    86                                 my @filename = split(/\./,$filename); 
    87                                 my $suffix = pop(@filename); # to address the case where there is more than one period in the file name 
    88                                 my $filename_nosuffix = $filename ; 
    89                                 $filename_nosuffix =~ s/\.$suffix//; 
     86                if ($filename ne "." and $filename ne ".." and $filename ne ".svn") { 
     87# !!!!!!                 
     88                        my @suffixlist = ("wav", "raw", "flac"); 
     89                        my ($filename_nosuffix, $path, $suffix) = fileparse($filename, @suffixlist);             
     90                        #my($temp, $suffix1) =split(/\./, $filename); # this tells you that there is a file name that has at least one period in its name        
     91                        #if (defined($suffix1)) { # this is to address the cases where a file has no suffix      
     92                                #my @filename = split(/\./,$filename); 
     93                                #my $suffix = pop(@filename); # to address the case where there is more than one period in the file name 
     94                                #my $filename_nosuffix = $filename ; 
     95                                #$filename_nosuffix =~ s/\.$suffix//; 
    9096                                print "filename:$filename;filename_nosuffix:$filename_nosuffix;suffix:$suffix\n";        
     97# !!!!!! 
    9198                                if ($suffix eq "wav") { 
     99                                        print "converting:$directory/$filename\n" if $debug;                      
     100                                        # subversion - rename file in Working Copy (need to commit these changes to repository once you are completed) 
     101                                        $command = ("svn rename $directory/$filename $directory/$filename_nosuffix\.mfc" ); system($command) == 0 or  confess "system $command failed: $?";     
     102                                        sleep(3);  # wait svn working copy to complete processing ??? 
     103                                        # HTK - convert wav file to HTK mfc format      
     104                                        $command = ("$HTKbin/HCopy -A -D -T 1 -C $Repository_dir/MFCC/wav_config $directory/$filename_nosuffix\.mfc $directory/$filename_nosuffix\.mfc" ); system($command) == 0 or  confess "system $command failed: $?";       
     105                                } elsif ($suffix eq "flac") { 
    92106                                        print "converting:$directory\/$filename\n" if $debug;                     
    93107                                        # subversion - rename file in Working Copy (need to commit these changes to repository once you are completed) 
    94                                         $command = ("svn rename $directory/$filename $directory/$filename_nosuffix\.mfc" ); system($command) == 0 or die "system $command failed: $?";     
     108                                        # flac to wav 
     109                                        $command = ("flac -d $directory/$filename"); print "$command\n" if $debug; system($command) == 0 or confess confess "system $command failed: $?";  
     110                                        # remove flac files 
     111                                        $command = ("rm -f $directory/$filename"); print "$command\n" if $debug; system($command) == 0 or confess confess "system $command failed: $?";  
     112                                        $command = ("svn rename $directory/$filename_nosuffix.wav $directory/$filename_nosuffix\.mfc" ); system($command) == 0 or  confess "system $command failed: $?";     
    95113                                        sleep(3);  # wait svn working copy to complete processing ??? 
    96114                                        # HTK - convert wav file to HTK mfc format      
    97                                         $command = ("$HTKbin/HCopy -A -D -T 1 -C $Repository_dir/MFCC/wav_config $directory/$filename_nosuffix\.mfc $directory/$filename_nosuffix\.mfc" ); system($command) == 0 or die "system $command failed: $?";       
     115                                        $command = ("$HTKbin/HCopy -A -D -T 1 -C $Repository_dir/MFCC/wav_config $directory/$filename_nosuffix\.mfc $directory/$filename_nosuffix\.mfc" ); system($command) == 0 or confess "system $command failed: $?";       
    98116                                } 
    99                         } 
    100117                } 
    101118        } 
  • Trunk/Scripts/Audio_scripts/Repository/Original.pm

    r2158 r2263  
    1212### This program is free software; you can redistribute it and/or 
    1313### modify it under the terms of the GNU General Public License 
    14 ### as published by the Free Software Foundation; either version 2 
     14### as published by the Free Software Foundation; either version 3 
    1515### of the License, or (at your option) any later version. 
    1616### 
     
    2323package Repository::Original; 
    2424use strict; 
     25use diagnostics; 
     26use Carp; 
     27 
    2528my $command; 
    2629 
     
    3841        # copy ToBeProcessed directory to Working Copy 
    3942        $command = ("mkdir $path_original/$audio_dir_name");  print "$command\n" if $debug;  system($command)  ;  
    40         $command = ("cp -r $ToBeProcessedDir/$audio_dir_name $path_original");  print "$command\n" if $debug;  system($command) == 0 or die "system $command failed: $?";   
     43        $command = ("cp -r $ToBeProcessedDir/$audio_dir_name $path_original");  print "$command\n" if $debug;  system($command) == 0 or confess "system $command failed: $?";   
    4144        # add to Working Copy and then add to Repository 
    42         $command = ("svn add $path_original/$audio_dir_name"); print "$command\n" if $debug; system($command) == 0 or die "system $command failed: $?";     
    43         $command = ("svn update -r HEAD $path_original/$audio_dir_name"); print "$command\n" if $debug; system($command) == 0 or die "system $command failed: $?";         
    44         $command = ("svn commit -m \"commit $audio_dir_name audio files\" $path_original/$audio_dir_name");print "$command\n" if $debug; system($command) == 0  or die "system $command failed: $?";     
     45        $command = ("svn add $path_original/$audio_dir_name"); print "$command\n" if $debug; system($command) == 0 or confess "system $command failed: $?";     
     46        $command = ("svn update -r HEAD $path_original/$audio_dir_name"); print "$command\n" if $debug; system($command) == 0 or confess "system $command failed: $?";         
     47        $command = ("svn commit -m \"commit $audio_dir_name audio files\" $path_original/$audio_dir_name");print "$command\n" if $debug; system($command) == 0  or confess "system $command failed: $?";     
    4548        # update properties   
    46         $command = ("svn propset -R LICENSE -F $path_original/$audio_dir_name/LICENSE $path_original/$audio_dir_name" ); print "$command\n" if $debug; system($command) == 0 or die "system $command failed: $?";   
    47         $command = ("svn propset -R README -F $path_original/$audio_dir_name/etc/README $path_original/$audio_dir_name" ); print "$command\n" if $debug; system($command) == 0 or die "system $command failed: $?";   
    48         $command = ("svn propset -R sampling_rate_Hz $OriginalSamplingRate $path_original/$audio_dir_name" ); print "$command\n" if $debug; system($command) == 0 or die "system $command failed: $?";   
    49         $command = ("svn propset -R bits_per_sample $OriginalBitsPerSample $path_original/$audio_dir_name" ); print "$command\n" if $debug; system($command) == 0 or die "system $command failed: $?";   
    50         $command = ("svn propset -R dialect \"$dialect\" $path_original/$audio_dir_name" ); print "$command\n" if $debug; system($command) == 0 or die "system $command failed: $?";   
    51         $command = ("svn update -r HEAD $path_original/$audio_dir_name"); print "$command\n" if $debug; system($command) == 0 or die "system $command failed: $?";   
    52         $command = ("svn commit -m \"add properties for $audio_dir_name audio files\" $path_original/$audio_dir_name");print "$command\n" if $debug; system($command) == 0 or die "system $command failed: $?";     
     49        $command = ("svn propset -R LICENSE -F $path_original/$audio_dir_name/LICENSE $path_original/$audio_dir_name" ); print "$command\n" if $debug; system($command) == 0 or confess "system $command failed: $?";   
     50        $command = ("svn propset -R README -F $path_original/$audio_dir_name/etc/README $path_original/$audio_dir_name" ); print "$command\n" if $debug; system($command) == 0 or confess "system $command failed: $?";   
     51        $command = ("svn propset -R sampling_rate_Hz $OriginalSamplingRate $path_original/$audio_dir_name" ); print "$command\n" if $debug; system($command) == 0 or confess "system $command failed: $?";   
     52        $command = ("svn propset -R bits_per_sample $OriginalBitsPerSample $path_original/$audio_dir_name" ); print "$command\n" if $debug; system($command) == 0 or confess "system $command failed: $?";   
     53        $command = ("svn propset -R dialect \"$dialect\" $path_original/$audio_dir_name" ); print "$command\n" if $debug; system($command) == 0 or confess "system $command failed: $?";   
     54        $command = ("svn update -r HEAD $path_original/$audio_dir_name"); print "$command\n" if $debug; system($command) == 0 or confess "system $command failed: $?";   
     55        $command = ("svn commit -m \"add properties for $audio_dir_name audio files\" $path_original/$audio_dir_name");print "$command\n" if $debug; system($command) == 0 or confess "system $command failed: $?";     
    5356        print "Original completed for $path_original/$audio_dir_name\n"; 
    5457        return 1;        
  • Trunk/Scripts/Audio_scripts/Repository/archive/downsample.pl

    r2198 r2263  
    2323#################################################################### 
    2424use strict; 
    25 use File::Spec; 
     25 
    2626 
    2727my ($targetrate, @command); 
  • Trunk/Scripts/Audio_scripts/UserSubmission.pm

    r2220 r2263  
    33### 
    44### script name : UserSubmission.pl 
    5 ### version: 0.1 
     5### version: 0.2 
    66### created by: Ken MacLean 
    77### mail: contact@voxforge.org 
     
    1313### This program is free software; you can redistribute it and/or 
    1414### modify it under the terms of the GNU General Public License 
    15 ### as published by the Free Software Foundation; either version 2 
     15### as published by the Free Software Foundation; either version 3 
    1616### of the License, or (at your option) any later version. 
    1717### 
     
    2020### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    2121### GNU General Public License for more details. 
    22 ###                                                              
     22###         
     23###   r0.2 (Aug 22, 2007) - added Flac processing                                                      
    2324#################################################################### 
    2425package UserSubmission; 
    2526use strict; 
    2627use File::Basename; 
    27 use Audio::Wav; 
     28use diagnostics; 
     29use Carp; 
    2830# internal modules perlmod  
    2931#use UserSubmission::README;                    # Import @EXPORT symbols 
     
    5961        foreach my $tarfile (@$tarlist) { 
    6062                my %AudioDirParms; 
    61                 # !!!!!! 
    62                 #my($audio_dir_name, $suffix) =split(/\./, $tarfile); 
    63                 #($AudioDirParms {"audio_dir_name"}, $AudioDirParms {"suffix1"} , $AudioDirParms {"suffix2"}) = split(/\./, $tarfile); 
    6463                my @suffixlist = ("tgz", "tar\.gz", "zip"); 
    6564                my ($audio_dir_name,$path); 
     
    6867                $AudioDirParms {"audio_dir_name"} = $audio_dir_name;  
    6968                 
    70                 #my @tarfile = split(/\./, $tarfile); 
    71                 #$AudioDirParms {"suffix2"} = pop(@tarfile); 
    72                 #$AudioDirParms {"suffix1"} = pop(@tarfile);             
    73                 #$AudioDirParms {"audio_dir_name"} = "@tarfile"; # assumes there are no other periods in the file name! 
    74                 #if (!defined($AudioDirParms {"suffix1"})) {$AudioDirParms {"suffix1"}=""}; 
    75                 #if (!defined($AudioDirParms {"suffix2"})) {$AudioDirParms {"suffix2"}=""};      
    76                 #if (($AudioDirParms {"suffix2"} eq "tgz") and ($AudioDirParms {"suffix1"})) { # assumes a VoxForgeIVR submissions 
    77                 #       $AudioDirParms {"audio_dir_name"} = $AudioDirParms {"audio_dir_name"} . "\." . $AudioDirParms {"suffix1"}; 
    78                 #       $AudioDirParms {"suffix1"} = ""; 
    79                 #       }  
    80                 #my $audio_dir_name = $AudioDirParms {"audio_dir_name"}; 
    81                 # !!!!!! 
    8269                $command = ("rm -rf $QuarantineDir/$audio_dir_name");  print "$command\n" if $debug; system($command); # remove ToBeProcessed directory - if it exists 
    83                 runClamAV($parms, \%AudioDirParms, $tarfile) || die "UserSubmission error: $?" ; # runs ClamAV and extracts gzipped tar or Zip file 
     70                runClamAV($parms, \%AudioDirParms, $tarfile) || confess "UserSubmission error: $?" ; # runs ClamAV and extracts gzipped tar or Zip file 
    8471                Convert2Unix($parms, \%AudioDirParms);  
    85                 ValidateFilenames($parms, \%AudioDirParms) || die "UserSubmission error: $?" ;  
    86                 ($AudioDirParms{"samplingrate"}, $AudioDirParms{"samplingrateformat"},  $AudioDirParms{"filetype"}, $AudioDirParms{"dialect"}) = UserSubmission::README::Process($parms, \%AudioDirParms); # can't put "|| die "UserSubmission error: $?"" becuase changes this to scalar context, and only last item in list is transferred! 
    87                 print "UserSubmission-README says:".$AudioDirParms{"samplingrate"}."-".$AudioDirParms{"samplingrateformat"}."-".$AudioDirParms{"filetype"}.";dialect:".$AudioDirParms{"dialect"}."\n\n" if $debug; 
    88                 UserSubmission::AUDIO::WavValidation($parms, \%AudioDirParms) || die "UserSubmission error: $?" ;       #checks that audio rates in README match actual files    
    89                 UserSubmission::PROMPTS::Clean($parms, \%AudioDirParms)   || die "UserSubmission error: $?"; # creates reformatted prompts file for processing with HVite and later merging into Master_Prompts 
    90                 UserSubmission::PROMPTS::Validation($parms, \%AudioDirParms)  || die "UserSubmission error: $?"; # use HDMan to run prompts against VoxForge Dictionnary 
    91                 UserSubmission::AUDIO::Audio2PromptsValidation($parms, \%AudioDirParms)  || die "UserSubmission error: $?" ; # partial AM training session using audio data to see if HVite has any problems trying to re-align the data - if it does, then audio does not match transcription 
    92                 $directorynames{$audio_dir_name} = [$AudioDirParms{"samplingrate"}, $AudioDirParms{"samplingrateformat"}, $AudioDirParms{"filetype"}]; 
    93         } 
     72                ValidateFilenames($parms, \%AudioDirParms) || confess "UserSubmission error: $?" ;  
     73                ($AudioDirParms{"samplingrate"}, $AudioDirParms{"samplingrateformat"},  $AudioDirParms{"filetype"}, $AudioDirParms{"dialect"})  
     74                        = UserSubmission::README::Process($parms, \%AudioDirParms); # can't put "|| confess "UserSubmission error: $?"" becuase changes this to scalar context, and only last item in list is transferred! 
     75                print "!!!!$audio_dir_name:UserSubmission-README says:".$AudioDirParms{"samplingrate"}."-".$AudioDirParms{"samplingrateformat"}."-".$AudioDirParms{"filetype"}.";dialect:".$AudioDirParms{"dialect"}."\n\n" if $debug; 
     76                UserSubmission::AUDIO::AudioValidation($parms, \%AudioDirParms) || confess "UserSubmission error: $?" ; #checks that audio rates in README match actual files    
     77                if (lc $AudioDirParms{"filetype"} eq "flac") { 
     78                        UserSubmission::AUDIO::Flac2Wav($parms, $audio_dir_name); 
     79                } 
     80                UserSubmission::PROMPTS::Clean($parms, \%AudioDirParms)   || confess "UserSubmission error: $?"; # creates reformatted prompts file for processing with HVite and later merging into Master_Prompts 
     81                UserSubmission::PROMPTS::Validation($parms, \%AudioDirParms)  || confess "UserSubmission error: $?"; # use HDMan to run prompts against VoxForge Dictionnary 
     82                UserSubmission::AUDIO::Audio2PromptsValidation($parms, \%AudioDirParms)  || confess "UserSubmission error: $?" ; # partial AM training session using audio data to see if HVite has any problems trying to re-align the data - if it does, then audio does not match transcription 
     83                $directorynames{$audio_dir_name} = [$AudioDirParms{"samplingrate"}, $AudioDirParms{"samplingrateformat"}, $AudioDirParms{"filetype"} ]; 
     84        } 
     85 
    9486        # Move Audio Directories to ToBeProcessed directory 
    9587        foreach my $audio_dir_name (sort keys(%directorynames)) { 
    9688                my $pointer = $directorynames{$audio_dir_name}; 
    9789                my($samplingrate, $samplingrateformat, $filetype) = @$pointer; 
    98                 Copy2ToBeProcessed($parms, $audio_dir_name)  || die "UserSubmission error: $?" ; #commit audio to Trunk/Original 
     90                print "!!!!!!!!!!!!!!!!!!audio_dir_name:$audio_dir_name,filetype:$filetype;\n";          
     91                Copy2ToBeProcessed($parms, $audio_dir_name, $filetype)  || confess "UserSubmission error: $?" ; #commit audio to Trunk/Original 
    9992        } 
    10093        # Print Summary 
     
    114107                my $audio_dir_name =  $$AudioDirParms{"audio_dir_name"};         
    115108                 
    116         opendir(DIR, "$QuarantineDir/$audio_dir_name") || die ("Unable to open directory: $QuarantineDir/$audio_dir_name\n"); 
     109        opendir(DIR, "$QuarantineDir/$audio_dir_name") || confess ("Unable to open directory: $QuarantineDir/$audio_dir_name\n"); 
    117110        while (my $filename = readdir(DIR)) { 
    118111                chomp ($filename);       
     
    121114                        my $suffix = pop(@filename); 
    122115                        if (defined($suffix)) {} else {$suffix = "";} 
    123                         if ($suffix ne "wav") { 
     116                        if (($suffix ne "wav") and ($suffix ne "flac") and ($suffix ne "raw")) { 
    124117                                if ($debug) { 
    125                                         $command = ("dos2unix -c Mac $QuarantineDir/$audio_dir_name/$filename"); print "$command\n"; system($command) == 0 or die "UserSubmission $command failed: $?";  
    126                                         $command = ("dos2unix $QuarantineDir/$audio_dir_name/$filename"); print "$command\n"; system($command) == 0 or die "UserSubmission $command failed: $?";  
     118                                        $command = ("dos2unix -c Mac $QuarantineDir/$audio_dir_name/$filename"); print "$command\n"; system($command) == 0 or confess "UserSubmission $command failed: $?";  
     119                                        $command = ("dos2unix $QuarantineDir/$audio_dir_name/$filename"); print "$command\n"; system($command) == 0 or confess "UserSubmission $command failed: $?";  
    127120                                } else { 
    128                                         $command = ("dos2unix -c Mac $QuarantineDir/$audio_dir_name/$filename 1>/dev/null 2>/dev/null");  system($command) == 0 or die "UserSubmission $command failed: $?";  
    129                                         $command = ("dos2unix $QuarantineDir/$audio_dir_name/$filename 1>/dev/null 2>/dev/null");  system($command) == 0 or die "UserSubmission $command failed: $?";  
     121                                        $command = ("dos2unix -c Mac $QuarantineDir/$audio_dir_name/$filename 1>/dev/null 2>/dev/null");  system($command) == 0 or confess "UserSubmission $command failed: $?";  
     122                                        $command = ("dos2unix $QuarantineDir/$audio_dir_name/$filename 1>/dev/null 2>/dev/null");  system($command) == 0 or confess "UserSubmission $command failed: $?";  
    130123                                } 
    131124                        } 
     
    138131        my($Dir) = @_; 
    139132        my @tarlist; 
    140         opendir(DIR, $Dir) || die ("Unable to open file: $Dir"); 
     133        opendir(DIR, $Dir) || confess ("Unable to open file: $Dir"); 
    141134        while (my $line = readdir(DIR)) { 
    142135                chomp ($line); 
    143136                if ($line ne "." and $line ne ".." ) { 
    144                         # !!!!!! 
    145137                        my @suffixlist = ("tgz", "tar\.gz", "zip"); 
    146138                        my ($filename,$path,$suffix) = fileparse($line,@suffixlist); 
    147  
    148                         #my($filename, $suffix1, $suffix2) =split(/\./, $line); 
    149                         #if (defined($suffix1)) {} else {$suffix1=""}; 
    150                         #if (defined($suffix2)) {} else {$suffix2=""}; 
    151                         # !!!!!! 
    152                          
    153139                        if (($suffix eq "zip") or ($suffix  eq "tgz") or ($suffix  eq "tar\.gz") ) { 
    154140                                push @tarlist,$line; 
     
    172158                my $filename = $$AudioDirParms {"audio_dir_name"}; 
    173159                my $suffix =  $$AudioDirParms {"suffix"}; 
    174  
    175160                 
    176161        my (@clamscan_output, $clamscan_results); 
    177         #$command = ("freshclam"); print "$command\n"; system($command) == 0 or die "system $command failed: $?";  
     162        #$command = ("freshclam"); print "$command\n"; system($command) == 0 or confess "system $command failed: $?";  
    178163        print "\nRunning ClamAV and Unzipping/Untarring $tarfile\n";     
    179164        # !!!!!! 
    180165        print "\nfilename:$filename; suffix:$suffix\n" if $debug; 
    181166        if ($suffix eq "zip" ) { 
    182                 $command = ("clamscan --unzip $QuarantineDir/$tarfile"); print "$command\n"; @clamscan_output = `$command`; if ($?) {die "system $command failed: $?"; }; 
     167                $command = ("clamscan --unzip $QuarantineDir/$tarfile"); print "$command\n"; @clamscan_output = `$command`; if ($?) {confess "system $command failed: $?"; }; 
    183168                        my @temp = split (" ", $clamscan_output[0]); 
    184169                        $clamscan_results = pop (@temp); 
     
    187172                                print "file $QuarantineDir/$tarfile is clean!\n";} 
    188173                        else { 
    189                                  die "ClamScan found a virus in file: $QuarantineDir\/$tarfile. $?" 
     174                                 confess "ClamScan found a virus in file: $QuarantineDir\/$tarfile. $?" 
    190175                        } 
    191176                if ($debug) {    
    192                         $command = ("cd $QuarantineDir && unzip -o -j $tarfile -d $filename"); print "$command\n"; system($command) == 0 or die "system $command failed: $?";  
     177                        $command = ("cd $QuarantineDir && unzip -o -j $tarfile -d $filename"); print "$command\n"; system($command) == 0 or confess "system $command failed: $?";  
    193178                } else { 
    194                         $command = ("cd $QuarantineDir && unzip -o -j $tarfile -d $filename  1>/dev/null 2>/dev/null");; system($command) == 0 or die "system $command failed: $?";  
     179                        $command = ("cd $QuarantineDir && unzip -o -j $tarfile -d $filename  1>/dev/null 2>/dev/null");; system($command) == 0 or confess "system $command failed: $?";  
    195180                } 
    196181                 
    197182        } elsif         (($suffix eq "tgz") or ($suffix eq "tar\.gz")) { 
    198                 #$command = ("clamscan --tgz $QuarantineDir/$tarfile"); print "$command\n"; system($command) == 0 or die "system $command failed: $?";  
    199                 $command = ("clamscan --tgz $QuarantineDir/$tarfile"); print "$command\n" if $debug; @clamscan_output = `$command`; if ($?) {die "system $command failed: $?"; }; 
     183                #$command = ("clamscan --tgz $QuarantineDir/$tarfile"); print "$command\n"; system($command) == 0 or confess "system $command failed: $?";  
     184                $command = ("clamscan --tgz $QuarantineDir/$tarfile"); print "$command\n" if $debug; @clamscan_output = `$command`; if ($?) {confess "system $command failed: $?"; }; 
    200185                        $clamscan_results = "error"; 
    201186                        foreach my $line (@clamscan_output) { 
     
    207192                                print "file $QuarantineDir\/$tarfile is clean!\n";} 
    208193                        else { 
    209                                  die "ClamScan found a virus in file: $QuarantineDir\/$tarfile. $?" 
     194                                 confess "ClamScan found a virus in file: $QuarantineDir\/$tarfile. $?" 
    210195                        } 
    211196 
     
    214199                if ($debug) { 
    215200                        $command = ("mkdir $QuarantineDir/temp"); print "$command\n"; print "$command\n";system($command);  
    216                         $command = ("cd $QuarantineDir/temp && tar -xvzf \.\./$tarfile "); print "$command\n"; system($command) == 0 or die "system $command failed: $?";  
    217                         $command = ("cd $QuarantineDir/ && zip -r temp.zip temp"); print "$command\n"; print "$command\n";system($command) == 0 or die "system $command failed: $?";  
    218                         $command = ("cd $QuarantineDir/ && rm -rf temp"); print "$command\n"; print "$command\n";system($command) == 0 or die "system $command failed: $?";  
    219                         $command = ("cd $QuarantineDir && unzip -o -j temp.zip -d $filename" ); print "$command\n";system($command) == 0 or die "system $command failed: $?";  
    220                         $command = ("cd $QuarantineDir/ && rm -f temp.zip"); print "$command\n"; print "$command\n";system($command) == 0 or die "system $command failed: $?";  
     201                        $command = ("cd $QuarantineDir/temp && tar -xvzf \.\./$tarfile "); print "$command\n"; system($command) == 0 or confess "system $command failed: $?";  
     202                        $command = ("cd $QuarantineDir/ && zip -r temp.zip temp"); print "$command\n"; print "$command\n";system($command) == 0 or confess "system $command failed: $?";  
     203                        $command = ("cd $QuarantineDir/ && rm -rf temp"); print "$command\n"; print "$command\n";system($command) == 0 or confess "system $command failed: $?";  
     204                        $command = ("cd $QuarantineDir && unzip -o -j temp.zip -d $filename" ); print "$command\n";system($command) == 0 or confess "system $command failed: $?";  
     205                        $command = ("cd $QuarantineDir/ && rm -f temp.zip"); print "$command\n"; print "$command\n";system($command) == 0 or confess "system $command failed: $?";  
    221206                } else { 
    222207                        $command = ("mkdir $QuarantineDir/temp"); system($command);  
    223                         $command = ("cd $QuarantineDir/temp && tar -xvzf \.\./$tarfile  1>/dev/null 2>/dev/null");  system($command) == 0 or die "system $command failed: $?";  
    224                         $command = ("cd $QuarantineDir/ && zip -r temp.zip temp  1>/dev/null 2>/dev/null");  system($command) == 0 or die "system $command failed: $?";  
    225                         $command = ("cd $QuarantineDir/ && rm -rf temp"); system($command) == 0 or die "system $command failed: $?";  
    226                         $command = ("cd $QuarantineDir && unzip -o -j temp.zip -d $filename  1>/dev/null 2>/dev/null" ); system($command) == 0 or die "system $command failed: $?";  
    227                         $command = ("cd $QuarantineDir/ && rm -f temp.zip"); system($command) == 0 or die "system $command failed: $?";  
     208                        $command = ("cd $QuarantineDir/temp && tar -xvzf \.\./$tarfile  1>/dev/null 2>/dev/null");  system($command) == 0 or confess "system $command failed: $?";  
     209                        $command = ("cd $QuarantineDir/ && zip -r temp.zip temp  1>/dev/null 2>/dev/null");  system($command) == 0 or confess "system $command failed: $?";  
     210                        $command = ("cd $QuarantineDir/ && rm -rf temp"); system($command) == 0 or confess "system $command failed: $?";  
     211                        $command = ("cd $QuarantineDir && unzip -o -j temp.zip -d $filename  1>/dev/null 2>/dev/null" ); system($command) == 0 or confess "system $command failed: $?";  
     212                        $command = ("cd $QuarantineDir/ && rm -f temp.zip"); system($command) == 0 or confess "system $command failed: $?";  
    228213                } 
    229214        } else {                 
    230                 die "runClamAV ERROR: $filename wrong suffix type - only \.zip and \.tgz supported!\n"; 
     215                confess "runClamAV ERROR: $filename wrong suffix type - only \.zip and \.tgz supported!\n"; 
    231216        } 
    232217        return 1; 
     
    239224        # windows defaults to prompts.txt 
    240225        # look into converting to XML and run through XML schema validation ... 
    241         UserSubmission::README::ValidateFileName($parms, $AudioDirectoryParms) || die "UserSubmission error: $?" ; 
    242         UserSubmission::LICENSE::ValidateFileName($parms, $AudioDirectoryParms) || die "UserSubmission error: $?" ;    
    243         UserSubmission::PROMPTS::ValidateFileName($parms, $AudioDirectoryParms) || die "UserSubmission error: $?" ;    
     226        UserSubmission::README::ValidateFileName($parms, $AudioDirectoryParms) || confess "UserSubmission error: $?" ; 
     227        UserSubmission::LICENSE::ValidateFileName($parms, $AudioDirectoryParms) || confess "UserSubmission error: $?" ;        
     228        UserSubmission::PROMPTS::ValidateFileName($parms, $AudioDirectoryParms) || confess "UserSubmission error: $?" ;        
    244229} 
    245230 
    246231sub Copy2ToBeProcessed { 
    247         my ($parms, $audio_dir_name) = @_; 
     232        my ($parms, $audio_dir_name, $filetype) = @_; 
    248233                my $debug = $$parms{"debug"}; 
    249234                my $QuarantineDir = $$parms{"QuarantineDir"};    
    250235                my $ToBeProcessedDir = $$parms{"ToBeProcessedDir"};              
    251         $command = ("mkdir $QuarantineDir/$audio_dir_name/wav");  print "$command\n" if $debug; system($command);   
    252         $command = ("mv -f $QuarantineDir/$audio_dir_name/*.wav $QuarantineDir/$audio_dir_name/wav"); print "$command\n" if $debug;   system($command) == 0 or die "system $command failed: $?"; 
    253         $command = ("rm -f $QuarantineDir/$audio_dir_name/*~ $QuarantineDir/$audio_dir_name/*.*~"); print "$command\n" if $debug;   system($command) == 0 or die "system $command failed: $?"; # remove hidden backup files 
    254         # copy to ToBeProcessed directory 
     236        UserSubmission::AUDIO::Finalize($parms, $audio_dir_name, $filetype)  || confess "UserSubmission error: $?" ; 
    255237        $command = ("rm -rf $ToBeProcessedDir/$audio_dir_name");  print "$command\n" if $debug;  system($command)  ;  
    256        $command = ("mkdir $ToBeProcessedDir/$audio_dir_name $ToBeProcessedDir/$audio_dir_name/wav $ToBeProcessedDir/$audio_dir_name/etc");  print "$command\n" if $debug;  system($command)  ;  
    257         $command = ("cp -f $QuarantineDir/$audio_dir_name/wav/*.wav $ToBeProcessedDir/$audio_dir_name/wav");  print "$command\n" if $debug;  system($command) == 0 or die "system $command failed: $?";   
     238       $command = ("mkdir $ToBeProcessedDir/$audio_dir_name $ToBeProcessedDir/$audio_dir_name/etc");  print "$command\n" if $debug;  system($command)  ;  
     239        UserSubmission::AUDIO::Copy2ToBeProcessed($parms, $audio_dir_name, $filetype)  || confess "UserSubmission error: $?" ; 
    258240        if ($debug) {    
    259241                $command = ("cp -f $QuarantineDir/$audio_dir_name/* $ToBeProcessedDir/$audio_dir_name/etc");  print "$command\n"; system($command) ; # return value usually says "cp: omitting directory `/data/quarantine/granthulbert-ar-01032007/wav'" 
     
    261243                $command = ("cp -f $QuarantineDir/$audio_dir_name/* $ToBeProcessedDir/$audio_dir_name/etc 1>/dev/null 2>/dev/null");  system($command) ; # return value usually says "cp: omitting directory `/data/quarantine/granthulbert-ar-01032007/wav'" 
    262244        } 
    263         UserSubmission::LICENSE::AddGPLLicense($parms, $audio_dir_name) || die "UserSubmission error: $?" ; 
     245        UserSubmission::LICENSE::AddGPLLicense($parms, $audio_dir_name) || confess "UserSubmission error: $?" ; 
    264246        if ($debug) {    
    265247                $command = ("mv -f $ToBeProcessedDir/$audio_dir_name/etc/LICENSE $ToBeProcessedDir/$audio_dir_name");   print "$command\n" ;system($command) ;   
     
    268250        } 
    269251                 
    270         $command = ("chown -R kmaclean $ToBeProcessedDir/$audio_dir_name");  print "$command\n" if $debug;  system($command) == 0 or die "system $command failed: $?";    
     252        $command = ("chown -R kmaclean $ToBeProcessedDir/$audio_dir_name");  print "$command\n" if $debug;  system($command) == 0 or confess "system $command failed: $?";    
    271253        return 1; 
    272254} 
     
    280262                my $audio_dir_name =  $$AudioDirParms{"audio_dir_name"};                 
    281263                 
    282         $command = ("rm -rf $QuarantineDir/$audio_dir_name"); print "$command\n" if $debug;   system($command) == 0 or die "system $command failed: $?"; # remove hidden backup files 
    283         $command = ("rm -f $QuarantineDir/$audio_dir_name\.zip $QuarantineDir/$audio_dir_name\.tgz $QuarantineDir/$audio_dir_name\.tar.gz "); print "$command\n" if $debug;   system($command) == 0 or die "system $command failed: $?"; # remove hidden backup files 
    284         $command = ("rm -rf $ToBeProcessedDir/$audio_dir_name"); print "$command\n" if $debug;   system($command) == 0 or die "system $command failed: $?"; # remove hidden backup files 
     264        $command = ("rm -rf $QuarantineDir/$audio_dir_name"); print "$command\n" if $debug;   system($command) == 0 or confess "system $command failed: $?"; # remove hidden backup files 
     265        $command = ("rm -f $QuarantineDir/$audio_dir_name\.zip $QuarantineDir/$audio_dir_name\.tgz $QuarantineDir/$audio_dir_name\.tar.gz "); print "$command\n" if $debug;   system($command) == 0 or confess "system $command failed: $?"; # remove hidden backup files 
     266        $command = ("rm -rf $ToBeProcessedDir/$audio_dir_name"); print "$command\n" if $debug;   system($command) == 0 or confess "system $command failed: $?"; # remove hidden backup files