| | 82 | } |
|---|
| | 83 | |
|---|
| | 84 | =head3 processMissingWordAudio |
|---|
| | 85 | |
|---|
| | 86 | Create a segmented audio file from the original audio file using startTime and endTime generated from segmentation routines. |
|---|
| | 87 | |
|---|
| | 88 | =cut |
|---|
| | 89 | |
|---|
| | 90 | sub 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); |
|---|