1
0
Fork 0
forked from fte/fteqw
fteqw/engine/libs/speex/libspeex/testdenoise.c
Lance 5747d75042 Added Speex development files, updated headers as well.
Makefile changed to statically compile Speex into FTEQW where possible.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4146 fc73d0e0-1445-4013-8a0c-d673dee63da5
2012-10-25 04:52:55 +00:00

44 lines
1 KiB
C

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <speex/speex_preprocess.h>
#include <stdio.h>
#define NN 160
int main()
{
short in[NN];
int i;
SpeexPreprocessState *st;
int count=0;
float f;
st = speex_preprocess_state_init(NN, 8000);
i=1;
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DENOISE, &i);
i=0;
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC, &i);
i=8000;
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC_LEVEL, &i);
i=0;
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB, &i);
f=.0;
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB_DECAY, &f);
f=.0;
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB_LEVEL, &f);
while (1)
{
int vad;
fread(in, sizeof(short), NN, stdin);
if (feof(stdin))
break;
vad = speex_preprocess_run(st, in);
/*fprintf (stderr, "%d\n", vad);*/
fwrite(in, sizeof(short), NN, stdout);
count++;
}
speex_preprocess_state_destroy(st);
return 0;
}