Displaying 3 results from an estimated 3 matches for "decodedsampl".
Did you mean:
decodedsamples
2004 Aug 06
2
C++ wrapper for speex
...int nRet = enc.encode(buf, buflen);
unsigned char *compressed = enc.getOutput();
int clen = enc.getOutputLength();
int speechDetected = enc.getSpeechDetected();
// delete temporary float buffer
delete []buf;
// Decode it
int decodedSamples = dec.decode(compressed, clen);
// Prepare decoded data for WAV
BYTE pSound = new BYTE[decodedSamples *
sizeof(short)];
memcpy(pSound, (BYTE*)dec.getOutput(), decodedSamples
* sizeof(short));
// Create and initialise the WAVEHDR structure
WAVEH...
2004 Aug 06
1
C++ wrapper for speex
Ronald,
I suggest we take this discussion off the list after
this post.
I don't see any problems with your code. However, I
can make a few suggestions:
1) If you replace the lines:
pSpeexHdr->lpData = (char*)pSound;
pSpeexHdr->dwBufferLength = decodedSamples * sizeof(short);
with:
pSpeexHdr->lpData = lpHdr->lpData;
pSpeexHdr->dwBufferLength = lpHdr->dwBufferLength;
does it sound right? If not, your problem is not with
the encoding or decoding.
2) Try checking the error state of the classes after
each method call, and before you try t...
2004 Aug 06
0
C++ wrapper for speex
...h classes)
// Encode some audio
tgAudioEncoder enc(16000); // you could do 8000 instead
enc.enableVAD(1);
enc.encode(buf, buflen);
unsigned char *compressed = enc.getOutput();
int clen = enc.getOutputLen();
int speechDetected = enc.getSpeechDetected();
// Decode it
tgAudioDecoder dec(16000);
int decodedSamples = dec.decode(compressed, clen);
memcpy(buf, dec.getOutput(), decodedSamples * sizeof(short int));
Anyway, that's the basic idea. I don't think it could get much
easier. :) Now, this is only raw encoding and decoding of the audio
and doesn't have any kind of container support (lik...