[Subject Prev][Subject Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hts-users:00597] HTK Header


Hi Hiega.
I've read the file addhtkheader.pl that you wrote in
the demo and I made a small modification to it because
I want to use it alone give it an input file(mcep) and
it produce outputfile.
I think that a header of (12 bytes) has been added and
saved in ISO-l format but the HInit rejects the
produced file and tell that it(Error can't read HTK
header).
is this due to the standard format because I use Linux
Suse. or another.
I tryed to add the header by 2 ways addhtkheader of
hts2 and mkdata of the old hts.

please help


 
____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121
#!/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