From: dttsp Date: Mon, 2 May 2005 17:37:05 +0000 (+0000) Subject: added time-domain windowing to EQ functions to eliminate artifacts X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/frontends/quickstart.html?a=commitdiff_plain;h=26a8aceb641f6918d6792fe67799209466780379;p=dttsp.git added time-domain windowing to EQ functions to eliminate artifacts --- diff --git a/jDttSP/sdr.c b/jDttSP/sdr.c index b3b2818..ead39f0 100644 --- a/jDttSP/sdr.c +++ b/jDttSP/sdr.c @@ -209,7 +209,6 @@ setup_rx(int k) { REAL pos = 0.5, // 0 <= pos <= 1, left->right theta = (1.0 - pos) * M_PI / 2.0; rx[k].azim = Cmplx(cos(theta), sin(theta)); - fprintf(stderr, "azim %f %f\n", rx[k].azim.re, rx[k].azim.im); } rx[k].tick = 0; @@ -511,10 +510,6 @@ do_rx_post(int k) { } } - // - // mix in sidetone here? - // - // final scaling if (rx[k].scl.post.flag) @@ -528,12 +523,6 @@ do_rx_post(int k) { if (!rx[k].bin.flag) for (i = 0; i < n; i++) CXBdata(rx[k].buf.o, i) = Cscl(rx[k].azim, CXBreal(rx[k].buf.o, i)); - -#if 0 - if (!rx[k].bin.flag) - for (i = 0; i < n; i++) - CXBimag(rx[k].buf.o, i) = CXBreal(rx[k].buf.o, i); -#endif } /* demod processing */ @@ -602,10 +591,6 @@ do_tx_pre(void) { CXBdata(tx.buf.i, i) = Cmplx(CXBreal(tx.buf.i, i) * tx.scl.pre.val, 0.0); } - // - // mix in CW tone here? - // - correctIQ(tx.buf.i, tx.iqfix); if (tx.spr.flag) SpeechProcessor(tx.spr.gen); diff --git a/jDttSP/update.c b/jDttSP/update.c index 4552cd2..cb6ae7a 100644 --- a/jDttSP/update.c +++ b/jDttSP/update.c @@ -383,6 +383,33 @@ setTXSpeechCompressionGain(int n, char **p) { //============================================================ +PRIVATE void +re_window(COMPLEX *vec, int len) { + int i; + REAL *win = newvec_REAL(len, "re_window win vec"); + COMPLEX *ztmp = newvec_COMPLEX(len, "re_window z buf"); + + fftw_plan ptmp = fftw_create_plan(len, FFTW_BACKWARD, uni.wisdom.bits); + fftw_one(ptmp, (fftw_complex *) vec, (fftw_complex *) ztmp); + fftw_destroy_plan(ptmp); + + (void) makewindow(BLACKMANHARRIS_WINDOW, len, win); + + for (i = 0; i < len; i++) + ztmp[i] = Cscl(ztmp[i], win[i]); + + ptmp = fftw_create_plan(len, FFTW_FORWARD, uni.wisdom.bits); + fftw_one(ptmp, (fftw_complex *) ztmp, (fftw_complex *) vec); + fftw_destroy_plan(ptmp); + + delvec_COMPLEX(ztmp); + delvec_REAL(win); + + normalize_vec_COMPLEX(vec, len); +} + +//============================================================ + PRIVATE int f2x(REAL f) { REAL fix = tx.filt.ovsv->fftlen * f / uni.samplerate; @@ -432,6 +459,7 @@ setTXEQ(int n, char **p) { apply_txeq_band(lof, dB, hif); lof = hif; } + re_window(rx[RL].filt.ovsv->zfvec, rx[RL].filt.ovsv->fftlen); return 0; } } @@ -474,6 +502,7 @@ setRXEQ(int n, char **p) { apply_rxeq_band(lof, dB, hif); lof = hif; } + re_window(rx[RL].filt.ovsv->zfvec, rx[RL].filt.ovsv->fftlen); return 0; } }