voxforge.org
VoxForge Dev
Show
Ignore:
Timestamp:
05/30/08 14:49:08 (6 months ago)
Author:
kmaclean
Message:

AudioSegmentation scripts - snapshot

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Trunk/Scripts/Audio_scripts/AudioSegmentation/AudioBook/Audio.pm

    r2597 r2599  
    5858sub forceAlign {  # public 
    5959        my ($class,$super,$fileID, $promptLine, $dict)= @_; 
     60        $fileID =~ s/\s//g; 
    6061        my $wavfilename = $fileID . "\.wav"; 
    6162        my $htk_files = $super->{'htk_files'}; 
    6263         
    63         my $segmentMlf = "AudioBook/interim_files/$fileID.mlf"; 
     64        my $segmentMlf = "AudioBook/interim_files/missingWordsFolder/$fileID.mlf"; 
    6465        createMLF($class,$fileID, $promptLine,$segmentMlf); 
    6566         
    66         my $aligned_out = "AudioBook/interim_files/$fileID.aligned.out"; 
    67         my $log = "AudioBook/interim_files/$fileID.forceAlign.log"; 
     67        my $aligned_out = "AudioBook/interim_files/missingWordsFolder/$fileID.aligned.out"; 
     68        my $log = "AudioBook/interim_files/logs/$fileID.forceAlign.log"; 
    6869                 
    6970        $command = ("sox AudioBook/interim_files/wav/$wavfilename -c 1 -r 16000 -w AudioBook/interim_files/downsampled.wav 2>&1 > AudioBook/interim_files/logs/Segment_Soxlog"); system($command) == 0 or confess "$command failed: $?"; 
    70         $command = ("HVite -A -D -T 1 -a -b SENT-END -m -C $htk_files/wav_config -H $htk_files/models/macros -H $htk_files/models/hmmdefs -m -t 250.0 150.0 1000.0 -I $segmentMlf  
    71          -i $aligned_out $dict $htk_files/models/tiedlist $wavfilename > $log"); system($command) == 0 or confess "error: $command failed: $?"; 
     71        # process audio file with HVite without using a script file (i.e. -S $htk_files/train.scp); need to remove -l '*' 
     72        #HVite -A -D -T 1  -a -b SENT-END -m -C AudioBook/input_files/htk/wav_config  
     73        #   -H AudioBook/input_files/htk/models/macros  
     74        #   -H AudioBook/input_files/htk/models/hmmdefs  
     75        #   -m -t 250.0 150.0 1000.0 -I AudioBook/interim_files/words.mlf  
     76        #   -i AudioBook/interim_files/aligned.out  
     77        #   AudioBook/interim_files/dict AudioBook/input_files/htk/models/tiedlist   
     78        #   AudioBook/interim_files/downsampled.wav 
     79        $command = ("HVite -A -D -T 1 -a -b SENT-END -m -C $htk_files/wav_config -H $htk_files/models/macros -H $htk_files/models/hmmdefs -m -t 250.0 150.0 1000.0 -I $segmentMlf -i $aligned_out $dict $htk_files/models/tiedlist AudioBook/interim_files/missingWordsFolder/$wavfilename > $log"); system($command) == 0 or confess "error: $command failed: $?"; 
    7280           
    7381        return ($aligned_out, $log); 
     
    7684=head2 _createMLFFile  
    7785 
    78 Internal creates an MLF (HTK required "Multi-Label File") file for a prompt. 
     86creates an MLF (HTK required "Multi-Label File") file for a prompt. 
    7987  
    8088=cut 
    8189 
    8290sub createMLF { # public 
    83         my ($class,$fileID, $promptLine,$segmentMlf)= @_; 
     91        my ($class,$fileID,$promptLine,$segmentMlf)= @_; 
    8492        open(MLF, ">$segmentMlf") or confess ("cannot open $segmentMlf for output");     
    8593        print MLF "#!MLF!#\n"; #  
    86         print MLF "\"AudioBook/interim_files/$fileID.lab\"\n"; 
     94        print MLF "\"AudioBook/interim_files/missingWordsFolder/$fileID.lab\"\n"; 
    8795        foreach my $word (@$promptLine) { 
    8896                print MLF "$word\n";