www.pudn.com > features.rar > endpoint.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 endpoint detector |
// | PROGRAM: |
// | COMMENTS: |
// | CONTRIBUTIONS: Fabrizio & Domenico |
// | ACTUAL REVISION: 6.0 |
// | DATA ACTUAL REVISION:19/11/98 |
// | FIRST VERSION: 4.0 |
// | DATA FIRST VERSION: 20/7/98 |
// | |
// |-----------------------------------------------------------------------|
// _________________________________________________________________________
// ******************* VERSION HISTORY *******************************
#include "../features/feature.h"
#include "../ioclass/soundlab.h"
void Print_Feature(t_index start,t_index end, const VetDoubleList &vet_feat, ofstream &f_out)
{
char* string;
t_index k, kk;
Assert(start<=end);
Assert(end<=vet_feat.Dim());
for(k=start;k mark;
t_index i;
t_real min_energy=100.0;
t_real max_energy=0.0;
const t_index SEPARATOR=32;
const t_index MIN_LEN_SPEECH=30;
const t_index MIN_LEN_SIL=35;
const t_index SIL_MARGIN=1;
const t_index ENERGY_INDEX=12;
const t_real PERCENTAGE=0.12;
ofstream file_out;
ifstream f_lis;
String name_fts, name_phn;
t_index k, dim, aux, index=1, frames=0;
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<max_energy)
max_energy=vet_energy[k];
if (vet_energy[k]MIN_LEN_SIL)
{
vet_bound.Append(start);
vet_bound.Append(k-SIL_MARGIN);
}
}
if (vet_bound.Dim()>1)
{
if (vet_bound[0]