From: drowe67 Date: Thu, 19 Aug 2010 00:15:12 +0000 (+0000) Subject: testing MBE voicing estimator, sounds about the 1st order phase model, better for... X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=4816552845ceeb179f69908845cd7d83944caead;p=freetel-svn-tracking.git testing MBE voicing estimator, sounds about the 1st order phase model, better for b0067, but still make a few errors, but much faster. git-svn-id: https://svn.code.sf.net/p/freetel/code@174 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2/TODO.txt b/codec2/TODO.txt index dac0925d..fd5e2223 100644 --- a/codec2/TODO.txt +++ b/codec2/TODO.txt @@ -1,6 +1,16 @@ TODO for codec2 --------------- +Mysteries +--------- + +[ ] buzzy sound in bg noise ofr b0067 +[ ] LSP quantiser has problems for b0067 +[ ] synthetic sound for hts2a and to bg nouse on _uq models + + breakdown in sinusoidal model for noise + + MELP does better + + perhaps synth UV using white noise might work better + 29 July 2010, current status: - g729a is a bit better, but c2 is not put to shame - c2 betters GSM in some cases @@ -233,4 +243,4 @@ So todo: - \ No newline at end of file + diff --git a/codec2/octave/plphase.m b/codec2/octave/plphase.m index 82cf0f26..9e611856 100644 --- a/codec2/octave/plphase.m +++ b/codec2/octave/plphase.m @@ -15,6 +15,11 @@ function plphase(samname, f) model_name = strcat(samname,"_model.txt"); model = load(model_name); + sw__name = strcat(samname,"_sw_.txt"); + if (file_in_path(".",sw__name)) + Sw_ = load(sw__name); + endif + pw_name = strcat(samname,"_pw.txt"); if (file_in_path(".",pw_name)) Pw = load(pw_name); @@ -49,7 +54,7 @@ function plphase(samname, f) k = ' '; do figure(1); - clg; + clf; s = [ Sn(2*f-1,:) Sn(2*f,:) ]; plot(s); grid; @@ -63,12 +68,16 @@ function plphase(samname, f) Wo = model(f,1); L = model(f,2); Am = model(f,3:(L+2)); - plot((1:L)*Wo*4000/pi, 20*log10(Am),";Am;"); + plot((1:L)*Wo*4000/pi, 20*log10(Am),"r;Am;"); axis([1 4000 -10 80]); hold on; plot((0:255)*4000/256, Sw(f,:),";Sw;"); grid; + if (file_in_path(".",sw__name)) + plot((0:255)*4000/256, Sw_(f,:),"g;Sw_;"); + endif + if (file_in_path(".",pw_name)) plot((0:255)*4000/256, 10*log10(Pw(f,:)),";Pw;"); endif @@ -87,7 +96,7 @@ function plphase(samname, f) noise = (orig-synth) * (orig-synth)'; snr_phase = 10*log10(signal/noise); - phase_err_label = sprintf(";phase_err SNR %4.2f dB;",snr_phase); + phase_err_label = sprintf("g;phase_err SNR %4.2f dB;",snr_phase); plot((1:L)*Wo*4000/pi, 20*log10(orig-synth), phase_err_label); endif @@ -103,7 +112,7 @@ function plphase(samname, f) axis; if (file_in_path(".", phase_name_)) hold on; - plot((1:L)*Wo*4000/pi, phase_(f,1:L)*180/pi, ";phase_;"); + plot((1:L)*Wo*4000/pi, phase_(f,1:L)*180/pi, "g;phase_;"); grid hold off; endif diff --git a/codec2/raw/b0067.raw b/codec2/raw/b0067.raw new file mode 100644 index 00000000..3aea9cda Binary files /dev/null and b/codec2/raw/b0067.raw differ diff --git a/codec2/src/Makefile b/codec2/src/Makefile index 21643058..5b888cef 100644 --- a/codec2/src/Makefile +++ b/codec2/src/Makefile @@ -4,7 +4,7 @@ CFLAGS=-g -Wall -I. -I../src -Wall -g -DFLOATING_POINT -DVAR_ARRAYS SINENC_OBJ = sinenc.o globals.o initenc.o four1.o refine.o spec.o dump.o SINEDEC_OBJ = sinedec.o globals.o initenc.o initdec.o four1.o synth.o \ quantise.o lpc.o dump.o refine.o lsp.o phase.o postfilter.o \ - interp.o + interp.o nlp.o all: sinenc sinedec diff --git a/codec2/src/nlp.c b/codec2/src/nlp.c index d1077894..c7a3ed21 100644 --- a/codec2/src/nlp.c +++ b/codec2/src/nlp.c @@ -106,7 +106,6 @@ float nlp_fir[] = { -1.0818124e-03 }; -float test_candidate_mbe(COMP Sw[], float f0); float post_process_mbe(COMP Fw[], int pmin, int pmax, float gmax); float post_process_sub_multiples(COMP Fw[], int pmin, int pmax, float gmax, int gmax_bin, @@ -330,6 +329,7 @@ float post_process_mbe(COMP Fw[], int pmin, int pmax, float gmax) int bin; float f0_min, f0_max; float f0_start, f0_end; + COMP Sw_[FFT_ENC]; f0_min = (float)SAMPLE_RATE/pmax; f0_max = (float)SAMPLE_RATE/pmin; @@ -357,7 +357,7 @@ float post_process_mbe(COMP Fw[], int pmin, int pmax, float gmax) if (f0_end > f0_max) f0_end = f0_max; for(f0=f0_start; f0<=f0_end; f0+= 2.5) { - e = test_candidate_mbe(Sw, f0); + e = test_candidate_mbe(Sw, f0, Sw_); bin = floor(f0); assert((bin > 0) && (bin < F0_MAX)); e_hz[bin] = e; if (e < e_min) { @@ -387,11 +387,12 @@ float post_process_mbe(COMP Fw[], int pmin, int pmax, float gmax) float test_candidate_mbe( COMP Sw[], - float f0 + float f0, + COMP Sw_[] /* DFT of all voiced synthesised signal for f0 */ + /* useful for debugging/dump file */ ) { - COMP Sw_[FFT_ENC]; /* DFT of all voiced synthesised signal */ - int l,al,bl,m; /* loop variables */ + int i,l,al,bl,m; /* loop variables */ COMP Am; /* amplitude sample for this band */ int offset; /* centers Hw[] about current harmonic */ float den; /* denominator of Am expression */ @@ -399,6 +400,11 @@ float test_candidate_mbe( float Wo; /* current "test" fundamental freq. */ int L; + for(i=0; i f0_max) f0_end = f0_max; + e_min = 1E32; + + for(f0=f0_start; f0<=f0_end; f0+= 1) { + e = test_candidate_mbe(Sw, f0, Sw_); + if (e < e_min) { + e_min = e; + best_f0 = f0; + } + } + noise = test_candidate_mbe(Sw,best_f0, Sw_); + snr = sig/noise; + dump_Sw_(Sw_); + } + + phase_model_first_order(ak_phase, H, &n_min, &min_Am, &voiced); + if (snr > 4.0) + voiced = 1; + else + voiced = 0; + dump_snr(snr); if (phase_model == 0) { @@ -278,7 +321,7 @@ int main(int argc, char *argv[]) //dump_phase_(&model.phi[0]); } - /* optional LPC model amplitudes */ + /* optional LPC model amplitudes */ if (lpc_model) { snr = lpc_model_amplitudes(Sn, &model, order, lsp, ak); diff --git a/codec2/unittest/tcontphase.c b/codec2/unittest/tcontphase.c index 4c6c4aa2..8fefab93 100644 --- a/codec2/unittest/tcontphase.c +++ b/codec2/unittest/tcontphase.c @@ -170,7 +170,7 @@ char *argv[]; synthesise_continuous_phase(Pn, &model, Sn_, 1, &Wo_prev, phi_prev); #else phase_synth_zero_order(5.0, H, &Wo_prev, &ex_phase); - synthesise_mixed(Pn,&model,Sn_); + synthesise_mixed(Pn,&model,Sn_,1); #endif for(i=0; i