From 9d0755627b38cade7fd44e378106b1f568bd52b1 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Mon, 15 Oct 2012 20:15:55 +0000 Subject: [PATCH] pre-emph and de-emp functions, used to test LPC modelling improvements git-svn-id: https://svn.code.sf.net/p/freetel/code@753 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/src/lpc.c | 61 ++++++++++++++++++++++++++++++++++++++++++-- codec2-dev/src/lpc.h | 4 ++- 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/codec2-dev/src/lpc.c b/codec2-dev/src/lpc.c index e38bbd54..a253289a 100644 --- a/codec2-dev/src/lpc.c +++ b/codec2-dev/src/lpc.c @@ -2,14 +2,14 @@ FILE........: lpc.c AUTHOR......: David Rowe - DATE CREATED: 30/9/90 + DATE CREATED: 30 Sep 1990 (!) Linear Prediction functions written in C. \*---------------------------------------------------------------------------*/ /* - Copyright (C) 2009 David Rowe + Copyright (C) 2009-2012 David Rowe All rights reserved. @@ -28,11 +28,68 @@ #define LPC_MAX_N 512 /* maximum no. of samples in frame */ #define PI 3.141592654 /* mathematical constant */ +#define ALPHA 1.0 +#define BETA 0.94 + #include #include #include "defines.h" #include "lpc.h" +/*---------------------------------------------------------------------------*\ + + pre_emp() + + Pre-emphasise (high pass filter with zero close to 0 Hz) a frame of + speech samples. Helps reduce dynamic range of LPC spectrum, giving + greater weight and hensea better match to low energy formants. + + Should be balanced by de-emphasis of the output speech. + +\*---------------------------------------------------------------------------*/ + +void pre_emp( + float Sn_pre[], /* output frame of speech samples */ + float Sn[], /* input frame of speech samples */ + float *mem, /* Sn[-1]single sample memory */ + int Nsam /* number of speech samples to use */ +) +{ + int i; + + for(i=0; i