forked from rampa069/PhnRec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtraps.h
78 lines (68 loc) · 2.54 KB
/
traps.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**************************************************************************
* copyright : (C) 2004-2006 by Petr Schwarz & Pavel Matejka *
* UPGM,FIT,VUT,Brno *
* email : {schwarzp,matejkap}@fit.vutbr.cz *
**************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
**************************************************************************/
#ifndef TRAPS_H
#define TRAPS_H
#include "nn.h"
typedef enum {st3bt, st1bt, st1bt_dct, stlcrc} system_type;
class Traps
{
protected:
bool initialized;
float *be_mat;
float *be_mat_hamm;
float *be_win;
float *hamming;
float **band_input;
float **band_output;
float *merger_input;
float *lc_mat;
float *lc_mat_win;
float *rc_mat;
float *rc_mat_win;
int nbanks;
int trap_len;
int merger_input_shift;
bool useHamming;
bool add_c0;
int trap_bands;
int delay;
int bunchSize;
system_type system;
NeuralNet *band_classifier;
NeuralNet merger;
void LoadWindow(char *file, int len, float *win);
void AddVectorToBEMatrix(float *band_energies);
void CalcInputFeaturesForBandNets(int bunchPos);
void ForwardPassBandNets(int actBunchSize);
void CalcInputFeaturesForMerger(int actBunchSize);
void ForwardPassMerger(int actBunchSize, float *retFeatures);
public:
Traps();
~Traps();
void Init(char *dir);
void CalcFeatures(float *band_energies, float *features, int n = 1, bool neededFea = true);
void CalcFeaturesBunched(float *band_energies, float *features, int n = 1, bool neededFea = true);
void Reset();
void DumpTr();
int GetNumOuts() {return merger.GetOutputSize();};
int GetTrapShift() {return (trap_len - 1) / 2;};
int GetDelay() {return delay;};
// these functions should be called before Init
bool SetSystem(char *sys);
void SetTrapLen(int v) {trap_len = v;};
void SetHamming(bool ham) {useHamming = ham;};
void SetNBanks(int v) {nbanks = v;};
void SetAddC0(bool v) {add_c0 = v;};
void SetBunchSize(int v) {bunchSize = v;};
};
#endif