[Speex-dev] Problem with speex
Paul Shtoller
admin at galeax.com
Wed Apr 11 22:13:32 PDT 2007
Hello!
I am downloaded last version of speex library and did compile DLL.
But I am have not good sound : Please see my code (Delphi) and say me
please WHat I am do not right.
Or please send me correct compiled DLL and example of correct using
SPEEX_MODEID_WB and SPEEX_MODEID_UWB , denoise, and other effects.
How I can set MONO mode in decode?
My Code:
smpRt:=32000;
n:=10;
encbits: TSpeexBits;
encstate: Pointer;
encframe: integer;
decbits: TSpeexBits;
decstate: Pointer;
decframe: integer;
buffEnc: array of single;
buffDec: array of single;
encstate := speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_WB));
speex_encoder_ctl(encstate,SPEEX_SET_SAMPLING_RATE, at smpRt);
speex_encoder_ctl(encstate,SPEEX_SET_QUALITY, at n);
speex_encoder_ctl(encstate,SPEEX_GET_FRAME_SIZE, at encframe);
speex_bits_init(@encbits);
SetLength(buffEnc,encframe);
enh:=0;
speex_bits_init(@decbits);
decstate := speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_WB));
speex_decoder_ctl(decstate,SPEEX_GET_FRAME_SIZE, at decframe);
speex_decoder_ctl(decstate,SPEEX_SET_ENH, at enh);
SetLength(buffDec,decframe);
Encode:
s3:string;
for j:=0 to encframe-1 do
buffenc[j]:=RecordBuff[j];
speex_bits_reset(@encbits);
speex_encode(encstate, at buffenc[0], at encbits);
sz := speex_bits_nbytes(@encbits);
SetLength(buffBytes,sz);
speex_bits_write(@encbits, at buffBytes[0],sz);
setlength(s3,length(buffbytes));
CopyMemory(@s3[1], at buffbytes[0],length(buffbytes));
Decode:
d:array of smallint;
speex_bits_read_from(@decbits, at s3[1],length(s3));
speex_decode(decstate, at decbits, at buffdec[0]);
setlength(d,length(buffdec));
for j:=0 to length(buffdec)-1 do
d[j]:=Round(buffdec[j]);
I hope you will help me.
Regards,
Paul
P.S. May be you have links to sites with examples of use speex - please
send me.
More information about the Speex-dev
mailing list