Problem in using SpeexPreprocess
Anil John M <[email protected]> Tue, 25 Dec 2012 11:43:44 +0530
| Newsgroups | gmane.comp.audio.compression.speex.devel |
|---|---|
| Message-ID | <CAAV6Kv2v+RtTWw30OtvNZiP0h6c9owGGF5A-D3qaRSdv0Ne43A@mail.gmail.com> |
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