www.pudn.com > features.rar > print_file_feat.cpp
// *********************************************************************
// * This file is part of RES 6.0. *
// * RES 6.0 is an original software distributed within the book *
// * *
// * |-----------------------------------------------------| *
// * | "Speech Recognition: Theory and C++ Implementation" | *
// * | John Wiley & Sons, Ltd | *
// * | by Claudio Becchetti and Lucio Prina Ricotti | *
// * |-----------------------------------------------------| *
// * *
// * See copyright.txt file for further info. on copyright *
// *********************************************************************
// _________________________________________________________________________
// |-----------------------------------------------------------------------|
// | |
// | FILE: Print_feature.cpp |
// | FUNCTIONALITY: file for print file of features |
// | PROGRAM: |
// | COMMENTS: |
// | CONTRIBUTIONS: Fabrizio |
// | ACTUAL REVISION: 6.0 |
// | DATA ACTUAL REVISION: 19/11/98 |
// | FIRST VERSION: 4.0 |
// | DATA FIRST VERSION: 7/7/98 |
// | |
// |-----------------------------------------------------------------------|
// _________________________________________________________________________
// ******************* VERSION HISTORY *******************************
#include "../features/feature.h"
#include "../ioclass/soundlab.h"
void main(int argc, char* argv[])
{
FeatureExtraction feature;
DbaseVoc dbase;
VetDouble sample, feature_vet;
VetDoubleList pred_list, whole_fon_istance;
String buffer, aux_string;
char* string;
t_index separator=32;
Boolean not_end_of_dbase=TRUE, new_file=FALSE, new_line;
ofstream file_out;
ifstream f_lis;
String name_fts, name_phn;
t_index k, dim, aux, index=1, frames=0;
t_index start, end;
String config_file;
if ( argc!=2)
{
mstat<<"No configfile name specified, using: res.ini";
config_file="res.ini";
}
else
{
config_file=argv[1];
}
dbase.Configure(config_file,TRUE);
feature.Configure(config_file);
pred_list.Destroy_And_ReDim(feature.Max_Delta_Feature_Order());
not_end_of_dbase=(Boolean)TRUE;
while(not_end_of_dbase)
{
not_end_of_dbase=dbase.Get_Sequential_Vet(sample, new_file);
if( (frames!=0) AND (new_file==TRUE OR not_end_of_dbase==FALSE ) )
{
name_fts=aux_string;
name_fts<<".fts";
file_out.open(name_fts);
// write file header
file_out<<"FeaturesFile\n\n";
file_out<<"File="<')
{
k++;
new_line=TRUE;
}
if(new_line)
file_out<>start;
f_lis>>end;
f_lis>>aux_string;
}
f_lis.close();
dim=(end-dbase.Window_Lenght())/
(dbase.Window_Lenght()-dbase.Window_Overlap())+1;
file_out.open(name_fts,ios::out|ios::binary|ios::app);
string=(char*)&separator;
file_out.write(string,8);
aux=file_out.tellp();
for(k=0;k<1024-aux;k++)
file_out.write(string,1);
//dim=whole_fon_istance.Dim();
for(k=0;k