quick start:g++ [flags ...] file ...-l /isip/tools/lib/$ISIP_BINARY/lib_algo.a #include <FilterBank.h> FilterBank(); FilterBank(const FilterBank& arg); boolean eq(const FilterBank& arg); boolean setAlgorithm(ALGORITHM algorithm); boolean setImplementation(IMPLEMENTATION implementation); boolean set(long order, float sample_freq, ALGORITHM algo, IMPLEMENTATION impl, SCALE scale); boolean set(float width, float sample_freq, ALGORITHM algo, IMPLEMENTATION impl, SCALE scale);
description:VectorFloat input; VectorFloat output; FilterBank fb; fb.set(24, 8000, FilterBank::FREQUENCY_SAMPLED, FilterBank::TRIANGULAR, Warp::MEL); fb.compute(output, input);
static const String CLASS_NAME = L"FilterBank";
enum ALGORITHM { FREQUENCY = 0, TIME, DEF_ALGORITHM = FREQUENCY };
enum IMPLEMENTATION { UNIFORM = 0, TRIANGULAR, RAISED_COSINE, CCDE, DEF_IMPLEMENTATION = UNIFORM };
enum SCALE { LINEAR = 0, MEL, BARK, DEF_SCALE = LINEAR };
enum FREQUENCY_SAMPLING { ORDER = 0, BANDWIDTH, DEF_FREQUENCY_SAMPLING = ORDER };
enum INPUT_MODE { FULL = 0, SYMMETRIC, DEF_INPUT_MODE = FULL };
static const NameMap ALGO_MAP(L"TIME, FREQUENCY");
static const NameMap IMPL_MAP(L"UNIFORM, TRIANGULAR, RAISED_COSINE, CCDE");
static const NameMap SCALE_MAP(L"LINEAR, MEL, BARK");
const NameMap FilterBank::FREQUENCY_SAMPLING_MAP(L"ORDER, BANDWIDTH");
const NameMap FilterBank::INPUT_MODE_MAP(L"FULL, SYMMETRIC");
static const String DEF_PARAM = L"";
static const String PARAM_ALGORITHM = L"algorithm";
static const String PARAM_IMPLEMENTATION = L"implementation";
static const String PARAM_FILTERS_PFILE = L"filters_pfile";
static const String PARAM_SCALE = L"scale";
static const String PARAM_FREQUENCY_SAMPLING = L"frequency_sampling";
static const String PARAM_INPUT_MODE = L"input_mode";
static const String PARAM_ORDER = L"order";
static const String PARAM_BANDWIDTH = L"bandwidth";
static const String PARAM_CMODE = L"compute_mode_d";
static const String PARAM_DMODE = L"data_mode_d";
static const String DEF_FILTERS_PFILE = L"filters.sof";
static const long DEF_ORDER = (long)24;
static const float DEF_BANDWIDTH = (float)85.8426;
static const float DEF_NUM_FILTERS = (long)1;
static const AlgorithmData::COEF_TYPE DEF_COEF_TYPE = AlgorithmData::GENERIC;
static const long DEF_CHANNEL_INDEX = 0;
static const long ERR = 70700;
ALGORITHM algorithm_d;
IMPLEMENTATION implementation_d;
static MemoryManager mgr_d;
Vector<Filter> filters_d;
String filters_pfile_d;
SCALE scale_d;
FREQUENCY_SAMPLING fsmp_d;
INPUT_MODE input_mode_d;
Long order_d;
Float bandwidth_d;
VectorFloat warp_freq_d;
VectorFloat lin_freq_d;
VectorFloat cen_freq_d;
static const String& name();
static boolean diagnose(Integral::DEBUG debug_level);
boolean debug(const unichar* message) const;
~FilterBank();
FilterBank();
FilterBank(const FilterBank& arg);
boolean assign(const FilterBank& arg);
FilterBank& operator= (const FilterBank& arg);
long sofSize() const;
boolean read(Sof& sof, long tag, const String& name = CLASS_NAME);
boolean write(Sof& sof, long tag, const String& name = CLASS_NAME) const;
boolean readData(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);
boolean writeData(Sof& sof, const String& pname = DEF_PARAM) const;
boolean eq(const FilterBank& arg) const;
static void* operator new(size_t size);
static void* operator new[](size_t size);
static void operator delete(void* ptr);
static void operator delete[](void* ptr);
static boolean setGrowSize(long grow_size);
boolean clear(Integral::CMODE ctype = Integral::DEF_CMODE);
boolean setAlgorithm(ALGORITHM algorithm);
boolean setImplementation(IMPLEMENTATION implementation);
boolean setScale(SCALE scale);
boolean setFrequencySampling(FREQUENCY_SAMPLING fsmp);
boolean setInputMode(INPUT_MODE input_mode);
boolean setOrder(long order);
boolean setBandwidth(long order);
boolean set(ALGORITHM algo, IMPLEMENTATION impl, INPUT_MODE input_mode, SCALE scale, long order, float sample_freq);
boolean set(ALGORITHM algo, IMPLEMENTATION impl, INPUT_MODE input_mode, SCALE scale, float bandwidth, float sample_freq);
boolean setFiltersParamFile(String filters_pfile);
ALGORITHM getAlgorithm() const;
IMPLEMENTATION getImplementation() const;
SCALE getScale() const;
FREQUENCY_SAMPLING getFrequencySampling();
INPUT_MODE getInputMode() const;
long getOrder() const;
long getBandwidth() const;
boolean get(ALGORITHM& algo, IMPLEMENTATION& impl, INPUT_MODE& input_mode, SCALE& scale, long& order, float& sample_freq) const;
boolean get(ALGORITHM& algo, IMPLEMENTATION& impl, INPUT_MODE& input_mode, SCALE& scale, float& bandwidth, float& sample_freq) const;
long getFiltersParamFile(String& filters_param_file) const;
boolean compute(Vector<VectorFloat>& output, const Vector<VectorFloat>& input, AlgorithmData::COEF_TYPE input_coef_type = DEF_COEF_TYPE, long index = DEF_CHANNEL_INDEX);
boolean compute(VectorFloat& output, const VectorFloat& input, AlgorithmData::COEF_TYPE input_coef_type = DEF_COEF_TYPE, long index = DEF_CHANNEL_INDEX);
boolean assign(const AlgorithmBase& arg);
boolean eq(const AlgorithmBase& arg) const;
const String& className() const;
boolean init();
boolean apply(Vector<AlgorithmData>& output, const Vector<AlgorithmData>& input);
boolean setParser(SofParser* parser);
boolean getLeadingPad() const;
boolean getTrailingPad() const;
boolean readDataTime(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);
boolean writeDataTime(Sof& sof, const String& pname = DEF_PARAM) const;
boolean readDataFrequency(Sof& sof, const String& pname = DEF_PARAM, long size = SofParser::FULL_OBJECT, boolean param = true, boolean nested = false);
boolean writeDataFrequency(Sof& sof, const String& pname = DEF_PARAM) const;
boolean computeTimeCommon(Vector<VectorFloat>& output, const CircularBuffer<AlgorithmData>& input, long index = DEF_CHANNEL_INDEX);
boolean computeTimeCcde(Vector<VectorFloat>& output, const VectorFloat& input, long index = DEF_CHANNEL_INDEX);
boolean computeFrequencyCommon(VectorFloat& output, const VectorFloat& input);
boolean computeFrequencyUniform(VectorFloat& output, const VectorFloat& input);
boolean computeFrequencyTriangular(VectorFloat& output, const VectorFloat& input);
boolean computeFrequencyRaisedcosine(VectorFloat& output, const VectorFloat& input);
// declare a FilterBank object // FilterBank fb; // set the parameters // long order = 4; float sf = 8000; FilterBank::ALGORITHM algo = FilterBank::FREQUENCY; FilterBank::IMPLEMENTATION impl = FilterBank::TRIANGULAR; FilterBank::INPUT_MODE input_mode = FilterBank::FULL; SCALE scale = MEL; if (!fb.set(order, sf, algo, impl, input_mode, scale)) { Error::handle(fb.name(), L"set", Error::TEST, __FILE__, __LINE__); Integral::exit(); } // generate a signal of VectorFloat // VectorFloat input; input.assign(L"58.682139, 27.352428, 40.681365, 119.681669, 392.449627, 432.773435, 345.984134, 175.399777, 97.606844"); // compute filter bank to the signal // VectorFloat output; fb.compute(output, input);