From: drowe67 Date: Tue, 16 Nov 2010 09:32:48 +0000 (+0000) Subject: added HPF function enables synthesis of 3500-4000hZ as some samples have unvoiced... X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=32662c3770db010c7dc3c5a7325f96f7c6614207;p=freetel-svn-tracking.git added HPF function enables synthesis of 3500-4000hZ as some samples have unvoiced energy in this region git-svn-id: https://svn.code.sf.net/p/freetel/code@234 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/codec2/src/sine.c b/codec2/src/sine.c index c79ded88..974f315e 100644 --- a/codec2/src/sine.c +++ b/codec2/src/sine.c @@ -39,6 +39,8 @@ #include "sine.h" #include "four1.h" +#define HPF_BETA 0.125 + /*---------------------------------------------------------------------------*\ HEADERS @@ -166,6 +168,26 @@ void make_analysis_window(float w[],COMP W[]) } +/*---------------------------------------------------------------------------*\ + + FUNCTION....: hpf + AUTHOR......: David Rowe + DATE CREATED: 16 Nov 2010 + + High pass filter with a -3dB point of about 160Hz. + + y(n) = -HPF_BETA*y(n-1) + x(n) - x(n-1) + +\*---------------------------------------------------------------------------*/ + +float hpf(float x, float states[]) +{ + states[0] += -HPF_BETA*states[0] + x - states[1]; + states[1] = x; + + return states[0]; +} + /*---------------------------------------------------------------------------*\ FUNCTION....: dft_speech @@ -577,15 +599,6 @@ void synthesise( Sw_[FFT_DEC-b].imag = -Sw_[b].imag; } - /* zero out anything above 3500 Hz */ - - for(i=(3500.0/4000.0)*FFT_DEC/2; i