voxforge.org
VoxForge Dev
Show
Ignore:
Timestamp:
06/10/08 13:28:34 (7 months ago)
Author:
kmaclean
Message:

AudioSegmentation scripts - snapshot

Files:

Legend:

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

    r2608 r2609  
    8080        $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: $?"; 
    8181        return ($aligned_out, $log); 
     82} 
     83 
     84=head3 processMissingWordAudio  
     85 
     86Create a segmented audio file from the original audio file using startTime and endTime generated from segmentation routines. 
     87 
     88=cut 
     89 
     90sub processMissingWordAudio { # private 
     91        my ($self,$fromFileName,$startTime,$stopTime,$toFileName) = @_; 
     92        my $audioBook = $self->{'audioBookObject'};              
     93        my $debug = $audioBook->getDebug;        
     94        my $htk_files = $audioBook->getHtk_files(); 
     95        my $samplerate = $self->{"samplerate"}; 
     96 
     97        # HCopy can only process 16 bit files!  
     98        # HCopy does not create proper WAV/RIFF Headers! 
     99        # use TARGETKIND=NOHEAD in HCopy command to remove 'click' noise that HCopy puts at the very beginning of each file it creates 
     100        # make sure you use NATURALWRITEORDER = T and NATURALREADORDER = T      in the HTK config file   
     101        $command = ("HCopy -C $htk_files/copy_config -s $startTime -e $stopTime $fromFileName AudioBook/interim_files/temp.wav"); print "cmd:$command\n" if $debug; system($command);  
     102        # sox command to create a proper wav file with a RIFF header;  
     103        $command = ("sox  -t .raw -r $samplerate -sw AudioBook/interim_files/temp.wav $toFileName"); print "cmd:$command\n" if $debug; system($command);         
    82104} 
    83105