[Speex-dev] Problem in using SpeexPreprocess
Anil John M
aniljohn80 at gmail.com
Mon Dec 24 22:13:44 PST 2012
Hi,
I wrote to a program looking at the api reference to pre-process noisy
speech using SpeexPreprocess api. Code listing is the following:
---------------------------------------
#include <stdio.h>
#include <speex/speex_preprocess.h>
#define FRAME_SIZE 160
#define SAMPLING_RATE 8000
int main(int argc, char **argv)
{
SpeexPreprocessState *preprocess_state =
speex_preprocess_state_init(FRAME_SIZE, SAMPLING_RATE);
FILE *fin = fopen(argv[1], "r");
FILE *fout = fopen(argv[2], "wb");
short in[FRAME_SIZE]; //float input[FRAME_SIZE];
char cbits[200];
int nbBytes;
while (1)
{
fread(in, sizeof(short), FRAME_SIZE, fin);
if (feof(fin)) break;
speex_preprocess_estimate_update(preprocess_state, in);
speex_preprocess_run(preprocess_state, in);
fwrite(in, sizeof(short), FRAME_SIZE, fout);
}
speex_preprocess_state_destroy(preprocess_state);
fclose(fin); fclose(fout);
return 0;
}
------------------------------------------
The inputs to the program are input.wav and output.wav.
But the program doesnt filter any noise. Please correct if I made any
mistake in the program.
Thank you,
- Anil
More information about the Speex-dev
mailing list