hi Tom,
i downloaded your speex wrappers and they're really
what i'm looking for! i really cannot worry about
container support at the moment because i'm working
with real-time audio, and hopefully toward VoIP when
everything else is in order.
im using waveform to capture data from the microphone.
the raw PCM sample is stored in the WAVEHDR
structure's member lpData, and this variable is of
LPSTR type.
if you have the time, can you please check on my test
code below and see where i could be having problems
with. (this is the handler that processes captured
audio)
LRESULT CRecordSound::OnSoundData(WPARAM wParam,
LPARAM lParam)
{
LPWAVEHDR lpHdr = (LPWAVEHDR) lParam;
int buflen = lpHdr->dwBufferLength; //160
float * buf = toFloat(lpHdr->lpData, buflen);
// Encode some audio
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
WAVEHDR* pSpeexHdr = new WAVEHDR;
pSpeexHdr->lpData = (char*)pSound;
pSpeexHdr->dwBufferLength = decodedSamples *
sizeof(short);
pSpeexHdr->dwFlags = 0L;
pSpeexHdr->dwLoops = 0L;
// output audio to speaker
m_Player->PostThreadMessage(WM_PLAYSOUND_PLAYBLOCK,
GetCurrentThreadId(),(LPARAM) pSpeexHdr);
// clean up
// delete pSeexHdr;
// delete [] pSound;
return 1;
}
this produces unintelligible audio. may be you can
give me an opinion on how i can properly reconstruct
my PCM sample ( into WAVHDR) after the decode. this
would really mean a lot to me.
many of thanks!!!
best regards,
ronald
<p>
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to
'speex-dev-request@xiph.org'
containing only the word 'unsubscribe' in the body. No subject is
needed.
Unsubscribe messages sent to the list will be ignored/filtered.
----- Original Message ----- From: "Ronald Madrid" <mfcguru@yahoo.com> To: <speex-dev@xiph.org> Cc: <tgrand@canvaslink.com> Sent: Wednesday, May 26, 2004 6:39 PM Subject: Re: [speex-dev] C++ wrapper for speex <p>>> hi Tom, > > i downloaded your speex wrappers and they're really > what i'm looking for! i really cannot worry about > container support at the moment because i'm working > with real-time audio, and hopefully toward VoIP when > everything else is in order. >If you or Tom are looking for C++ container support for ogg, you can find my mux and demux library as part of my directshow project. They are still a bit rough around the edges because in my project they are wrapped by directshow filters and not directly exposed but there are a few example tools with them as well. The demux is pretty well tested but the mux particularly multi-stream mux is only recently added and not fully tested. Root of directshow project http://svn.xiph.org/trunk/oggdsf The mux/demux library http://svn.xiph.org/trunk/oggdsf/src/lib/core/ogg/libOOOgg/ And the very simple example tools are here. (They depend on the demux/mux library above) http://svn.xiph.org/trunk/oggdsf/src/tools/ Or equivalanet svn paths to check them out with subversion. Cheers, Zen. <p>--- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'speex-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Hi, Think I might have found a problem. AFAIK, lpHdr->dwBufferLength stores the length of the buffer in octets (bytes). It should be 320 if you are expecting 160 PCM 16-bit samples. //JT <p>> -----Ursprungligt meddelande-----> Från: owner-speex-dev@xiph.org [mailto:owner-speex-dev@xiph.org] För > Ronald Madrid > Skickat: den 26 maj 2004 12:39 > Till: speex-dev@xiph.org > Kopia: tgrand@canvaslink.com > Ämne: Re: [speex-dev] C++ wrapper for speex > > > hi Tom, > > i downloaded your speex wrappers and they're really > what i'm looking for! i really cannot worry about > container support at the moment because i'm working > with real-time audio, and hopefully toward VoIP when > everything else is in order. > > im using waveform to capture data from the microphone. > the raw PCM sample is stored in the WAVEHDR > structure's member lpData, and this variable is of > LPSTR type. > > if you have the time, can you please check on my test > code below and see where i could be having problems > with. (this is the handler that processes captured > audio) > > LRESULT CRecordSound::OnSoundData(WPARAM wParam, > LPARAM lParam) > { > LPWAVEHDR lpHdr = (LPWAVEHDR) lParam; > > int buflen = lpHdr->dwBufferLength; //160 > float * buf = toFloat(lpHdr->lpData, buflen); > > // Encode some audio > 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 > WAVEHDR* pSpeexHdr = new WAVEHDR; > > pSpeexHdr->lpData = (char*)pSound; > pSpeexHdr->dwBufferLength = decodedSamples * > sizeof(short); > pSpeexHdr->dwFlags = 0L; > pSpeexHdr->dwLoops = 0L; > > // output audio to speaker > m_Player->PostThreadMessage(WM_PLAYSOUND_PLAYBLOCK, > GetCurrentThreadId(),(LPARAM) pSpeexHdr); > > // clean up > // delete pSeexHdr; > // delete [] pSound; > > return 1; > } > > this produces unintelligible audio. may be you can > give me an opinion on how i can properly reconstruct > my PCM sample ( into WAVHDR) after the decode. this > would really mean a lot to me. > > many of thanks!!! > > best regards, > ronald > > > > > __________________________________ > Do you Yahoo!? > Friends. Fun. Try the all-new Yahoo! Messenger. > http://messenger.yahoo.com/ > --- >8 ---- > List archives: http://www.xiph.org/archives/ > Ogg project homepage: http://www.xiph.org/ogg/ > To unsubscribe from this list, send a message to 'speex-dev- > request@xiph.org' > containing only the word 'unsubscribe' in the body. No subject isneeded.> Unsubscribe messages sent to the list will be ignored/filtered.<p><p><p>--- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'speex-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.