From fbd337bf5d3a05122c722aa719b547177526de14 Mon Sep 17 00:00:00 2001 From: xenakios Date: Fri, 29 Dec 2017 05:12:03 +0200 Subject: [PATCH] Removed the redundant spectrum processing methods --- Source/PS_Source/ProcessedStretch.cpp | 233 -------------------------- Source/PS_Source/ProcessedStretch.h | 12 +- 2 files changed, 2 insertions(+), 243 deletions(-) diff --git a/Source/PS_Source/ProcessedStretch.cpp b/Source/PS_Source/ProcessedStretch.cpp index da7d79e..4a0956b 100644 --- a/Source/PS_Source/ProcessedStretch.cpp +++ b/Source/PS_Source/ProcessedStretch.cpp @@ -178,132 +178,7 @@ void ProcessedStretch::process_spectrum(REALTYPE *freq) //void ProcessedStretch::process_output(REALTYPE *smps,int nsmps){ //}; -void ProcessedStretch::do_harmonics(REALTYPE *freq1,REALTYPE *freq2){ - REALTYPE freq=pars.harmonics.freq; - REALTYPE bandwidth=pars.harmonics.bandwidth; - int nharmonics=pars.harmonics.nharmonics; - if (freq<10.0) freq=10.0; - - REALTYPE *amp=tmpfreq1.data(); - for (int i=0;i=samplerate/2) break; - - bw_Hz=(pow(2.0f,bandwidth/1200.0f)-1.0f)*f; - bwi=bw_Hz/(2.0f*samplerate); - fi=f/samplerate; - - REALTYPE sum=0.0f; - REALTYPE max=0.0f; - for (int i=1;imax) max=amp[i]; - }; - if (max<1e-8f) max=1e-8f; - - for (int i=1;i0)&&(i2=nfreq) break; - freq2[i2]+=freq1[i]; - }; - }; - if (_rap>=1.0){//up - _rap=1.0f/_rap; - for (int i=0;i1e-3){ - do_pitch_shift(freq1,tmpfreq1.data(),0.25); - add(sumfreq.data(),tmpfreq1.data(),pars.octave.om2); - }; - if (pars.octave.om1>1e-3){ - do_pitch_shift(freq1,tmpfreq1.data(),0.5); - add(sumfreq.data(),tmpfreq1.data(),pars.octave.om1); - }; - if (pars.octave.o0>1e-3){ - add(sumfreq.data(),freq1,pars.octave.o0); - }; - if (pars.octave.o1>1e-3){ - do_pitch_shift(freq1,tmpfreq1.data(),2.0); - add(sumfreq.data(),tmpfreq1.data(),pars.octave.o1); - }; - if (pars.octave.o15>1e-3){ - do_pitch_shift(freq1,tmpfreq1.data(),3.0); - add(sumfreq.data(),tmpfreq1.data(),pars.octave.o15); - }; - if (pars.octave.o2>1e-3){ - do_pitch_shift(freq1,tmpfreq1.data(),4.0); - add(sumfreq.data(),tmpfreq1.data(),pars.octave.o2); - }; - - REALTYPE sum=0.01f+pars.octave.om2+pars.octave.om1+pars.octave.o0+pars.octave.o1+pars.octave.o15+pars.octave.o2; - if (sum<0.5f) sum=0.5f; - for (int i=0;i=ilow)&&(i=nfreq) x0=nfreq-1; - int x1=x0+1; if (x1>=nfreq) x1=nfreq-1; - REALTYPE xp=x-x0; - if (x0;i--){ - tmpfreq1[i]=tmpfreq1[i+1]*a+tmpfreq1[i]*(1.0f-a); - }; - }; - - freq2[0]=0; - REALTYPE log_maxfreq_d_minfreq=log(maxfreq/minfreq); - for (int i=1;i0.0)&&(x=nfreq) x0=nfreq-1; - int x1=x0+1; if (x1>=nfreq) x1=nfreq-1; - REALTYPE xp=x-x0; - y=tmpfreq1[x0]*(1.0f-xp)+tmpfreq1[x1]*xp; - }; - freq2[i]=y; - }; - - -}; - - -void ProcessedStretch::do_compressor(REALTYPE *freq1,REALTYPE *freq2){ - REALTYPE rms=0.0; - for (int i=0;i=0.0){ - REALTYPE mul=(pow(10.0f,pars.tonal_vs_noise.preserve)-1.0f); - for (int i=0;i make_spectrum_processes() { std::vector m_spectrum_processes; diff --git a/Source/PS_Source/ProcessedStretch.h b/Source/PS_Source/ProcessedStretch.h index 6269bbd..d65c333 100644 --- a/Source/PS_Source/ProcessedStretch.h +++ b/Source/PS_Source/ProcessedStretch.h @@ -464,22 +464,14 @@ private: REALTYPE get_stretch_multiplier(REALTYPE pos_percents) override; // void process_output(REALTYPE *smps,int nsmps); void process_spectrum(REALTYPE *freq) override; - void do_harmonics(REALTYPE *freq1,REALTYPE *freq2); - void do_pitch_shift(REALTYPE *freq1,REALTYPE *freq2,REALTYPE rap); - void do_freq_shift(REALTYPE *freq1,REALTYPE *freq2); - void do_octave(REALTYPE *freq1,REALTYPE *freq2); - void do_filter(REALTYPE *freq1,REALTYPE *freq2); - void do_free_filter(REALTYPE *freq1,REALTYPE *freq2); - void do_compressor(REALTYPE *freq1,REALTYPE *freq2); - void do_spread(REALTYPE *freq1,REALTYPE *freq2); - void do_tonal_vs_noise(REALTYPE *freq1,REALTYPE *freq2); + //void copy(const realvector& freq1,realvector& freq2); void copy(REALTYPE* freq1, REALTYPE* freq2); void add(REALTYPE *freq2,REALTYPE *freq1,REALTYPE a=1.0); void mul(REALTYPE *freq1,REALTYPE a); void zero(REALTYPE *freq1); - void spread(REALTYPE *freq1,REALTYPE *freq2,REALTYPE spread_bandwidth); + void update_free_filter(); int nfreq=0;