Hi all. I wanted to add HTK Header to a mcep file produced by SPTK. So I read the addhtkheader.pl in HTS-demo and I modifay it tochane file pathes and it produce output file and I think a header of (12bytes) has been added and saved in ISO-l format but the HInit rejects this file and the error is (can't read HTK Header). is this due to the format and UniCode because I use Linux-Suse. or what? I tryed also adding the header by another way as mkdata.pl of the older version of hts-demo. but also a header is added but didn't work. the modified code is attached. please help. thank you. ____________________________________________________________________________________ Don't pick lemons. See all the new 2007 cars at Yahoo! Autos. http://autos.yahoo.com/new_cars.html
#!/usr/bin/perl $|=1; use File::Basename; # Endian switch $byteswap = 0; $SPTKdir="/usr/local/SPTK/bin"; $mcepdir="/home/samir/work/MyModules/mceps"; # speech analysis setting =============== $sampfreq = 16000; # 16kHz sampling frequency $framelength = 0.025; # 25ms window length $frameshift = 0.005; # 5ms frame shift $windowtype = 0; # window type -> 0: Blackman 1: Hamming 2: Hanning $normtype = 1; $FFTLength = 512; # FFT length for Mel-cepstral analysis $freqwarp = 0.42; # frequency warping for mel $mceporder = 20; # order of Mel-cepstral analysis @RAW=glob("/home/samir/work/MyModules/floatfiles/*.short"); $frame_length = $sampfreq * $framelength; $frame_shift = $sampfreq * $frameshift; $mcepdim = $mceporder + 1; $byte =4 * ( $mcepdim); $period = 1000 * $frameshift; foreach $Item (@RAW){ $base= basename($Item,".short"); print "\ninput file:$base\n"; if ($byteswap) { $line = "$SPTKdir/swab +s $Item | x2x +sf | "; # big endian } else { $line = "$SPTKdir/x2x +sf $Item | "; # little endian } $line="$SPTKdir/frame +f -l $frame_length -p $frame_shift | $SPTKdir/window -l $frame_length -L $FFTLength | $SPTKdir/mcep -l $FFTLength -m $mceporder -a $freqwarp > $mcepdir/$base.mcep"; system($line); # make HTK header @STAT = stat "$mcepdir/$base.mcep"; $size = $STAT[7]/$byte; system "echo $size ".($frameshift * 10000000)." | $SPTKdir/x2x +al >$mcepdir/tmp.head"; system "echo $byte 9 | $SPTKdir/x2x +as >>$mcepdir/tmp.head"; # number 9 corresponds to user specified parameter in HTK # combine HTK header and sequence of feature vector system "cat $mcepdir/tmp.head $mcepdir/$base.mcep > $mcepdir/$base.hmcep"; print "\noutput file:$base.mceps"; }
Attachment:
header2.pl
Description: 2301269214-header2.pl