- Timestamp:
- 05/30/08 14:49:08 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Trunk/Scripts/Audio_scripts/AudioSegmentation/AudioBook/Audio.pm
r2597 r2599 58 58 sub forceAlign { # public 59 59 my ($class,$super,$fileID, $promptLine, $dict)= @_; 60 $fileID =~ s/\s//g; 60 61 my $wavfilename = $fileID . "\.wav"; 61 62 my $htk_files = $super->{'htk_files'}; 62 63 63 my $segmentMlf = "AudioBook/interim_files/ $fileID.mlf";64 my $segmentMlf = "AudioBook/interim_files/missingWordsFolder/$fileID.mlf"; 64 65 createMLF($class,$fileID, $promptLine,$segmentMlf); 65 66 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"; 68 69 69 70 $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: $?"; 72 80 73 81 return ($aligned_out, $log); … … 76 84 =head2 _createMLFFile 77 85 78 Internalcreates an MLF (HTK required "Multi-Label File") file for a prompt.86 creates an MLF (HTK required "Multi-Label File") file for a prompt. 79 87 80 88 =cut 81 89 82 90 sub createMLF { # public 83 my ($class,$fileID, $promptLine,$segmentMlf)= @_;91 my ($class,$fileID,$promptLine,$segmentMlf)= @_; 84 92 open(MLF, ">$segmentMlf") or confess ("cannot open $segmentMlf for output"); 85 93 print MLF "#!MLF!#\n"; # 86 print MLF "\"AudioBook/interim_files/ $fileID.lab\"\n";94 print MLF "\"AudioBook/interim_files/missingWordsFolder/$fileID.lab\"\n"; 87 95 foreach my $word (@$promptLine) { 88 96 print MLF "$word\n";