Marsyas
0.6.0-alpha
|
00001 /* 00002 ** Copyright (C) 1998-2005 George Tzanetakis <gtzan@cs.uvic.ca> 00003 ** 00004 ** This program is free software; you can redistribute it and/or modify 00005 ** it under the terms of the GNU General Public License as published by 00006 ** the Free Software Foundation; either version 2 of the License, or 00007 ** (at your option) any later version. 00008 ** 00009 ** This program is distributed in the hope that it will be useful, 00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 ** GNU General Public License for more details. 00013 ** 00014 ** You should have received a copy of the GNU General Public License 00015 ** along with this program; if not, write to the Free Software 00016 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef MARSYAS_PECONVERT2_H 00020 #define MARSYAS_PECONVERT2_H 00021 00022 #include <marsyas/system/MarSystem.h> 00023 00024 namespace Marsyas 00025 { 00032 class Peaker; 00033 class MaxArgMax; 00034 class SimulMaskingFft; 00035 00036 class PeakConvert2: public MarSystem 00037 { 00038 private: 00039 realvec lastphase_; 00040 realvec phase_; 00041 realvec mag_; 00042 realvec peaks_; 00043 realvec tmp_; 00044 realvec magCorr_; 00045 realvec frequency_; 00046 realvec lastmag_; 00047 realvec lastfrequency_; 00048 realvec deltamag_; 00049 realvec deltafrequency_; 00050 realvec masked_, 00051 lpPeakerRes_, 00052 tmpBuff_, 00053 peakProb_, 00054 peakProbWeight_; 00055 00056 mrs_real lpCoeff_; 00057 mrs_natural N_; 00058 mrs_real fundamental_; 00059 mrs_real factor_; 00060 mrs_natural hopSize_, 00061 instFreqHopSize_; 00062 mrs_natural downFrequency_; 00063 mrs_natural upFrequency_; 00064 mrs_natural nbParameters_; 00065 mrs_natural nbPeaks_; 00066 mrs_natural frameMaxNumPeaks_; 00067 mrs_natural size_; 00068 mrs_natural psize_; 00069 mrs_natural skip_; 00070 bool pick_; 00071 bool prec_; 00072 00073 mrs_natural frame_; 00074 00075 bool useStereoSpectrum_; 00076 00077 Peaker* peaker_; 00078 MaxArgMax* max_; 00079 SimulMaskingFft *masking_; 00080 00081 MarControlPtr ctrl_totalNumPeaks_; 00082 MarControlPtr ctrl_frameMaxNumPeaks_; 00083 00084 void addControls(); 00085 void myUpdate(MarControlPtr sender); 00086 00087 mrs_real lobe_value_compute(mrs_real f, mrs_natural type, mrs_natural size); 00088 //void getBinInterval(realvec& interval, realvec& index, realvec& mag); 00089 void getShortBinInterval(realvec& interval, realvec& index, realvec& mag); 00090 void getLargeBinInterval(realvec& interval, realvec& index, realvec& mag); 00091 00092 void ComputeMasking (realvec& in); 00093 void ComputeMagnitudeAndPhase (realvec in); 00094 void ComputePeaker (realvec in, realvec& out); 00095 00096 00097 static mrs_real GaussianPdf (mrs_real x, mrs_real std = 1); 00098 00099 public: 00100 PeakConvert2(std::string name); 00101 PeakConvert2(const PeakConvert2& a); 00102 ~PeakConvert2(); 00103 MarSystem* clone() const; 00104 00105 void myProcess(realvec& in, realvec& out); 00106 }; 00107 00108 }//namespace Marsyas 00109 00110 #endif 00111 00112 00113 00114 00115 00116