| 1 |
#ifdef HAVE_CONFIG_H |
| 2 |
#include "config.h" |
| 3 |
#endif |
| 4 |
|
| 5 |
#include <speex/speex_preprocess.h> |
| 6 |
#include <stdio.h> |
| 7 |
|
| 8 |
#define NN 160 |
| 9 |
|
| 10 |
int main() |
| 11 |
{ |
| 12 |
short in[NN]; |
| 13 |
int i; |
| 14 |
SpeexPreprocessState *st; |
| 15 |
int count=0; |
| 16 |
float f; |
| 17 |
|
| 18 |
st = speex_preprocess_state_init(NN, 8000); |
| 19 |
i=1; |
| 20 |
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DENOISE, &i); |
| 21 |
i=0; |
| 22 |
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC, &i); |
| 23 |
f=8000; |
| 24 |
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC_LEVEL, &f); |
| 25 |
i=0; |
| 26 |
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB, &i); |
| 27 |
f=.4; |
| 28 |
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB_DECAY, &f); |
| 29 |
f=.3; |
| 30 |
speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB_LEVEL, &f); |
| 31 |
while (1) |
| 32 |
{ |
| 33 |
int vad; |
| 34 |
fread(in, sizeof(short), NN, stdin); |
| 35 |
if (feof(stdin)) |
| 36 |
break; |
| 37 |
vad = speex_preprocess(st, in, NULL); |
| 38 |
|
| 39 |
fwrite(in, sizeof(short), NN, stdout); |
| 40 |
count++; |
| 41 |
} |
| 42 |
speex_preprocess_state_destroy(st); |
| 43 |
return 0; |
| 44 |
} |