Hi
I apologise if the following message is inappropriate for
this list. However, I feel this is the only place where I
can get some help with my problem.
BOOL CALLBACK RecordProc(HRECORD hRecord, void *buffer,
DWORD length, DWORD user)
{
try
{
long sent = 0;
long inputOffset = 0;
long outputOffset = 0;
long nbBytes = 0;
char *outputBuffer = NULL;
outputBuffer = (char*)malloc(65535);
memset(speexBuffer, 0, 65536);
while (inputOffset < length)
{
(float*)buffer = (float*)buffer + (frameSize);
speex_bits_reset(&bits);
speex_encode(enc_state, (float*)buffer, &bits);
nbBytes = speex_bits_write(&bits, outputBuffer +
outputOffset, 65535);
inputOffset += frameSize;
outputOffset += nbBytes;
}
MainForm->memoOutput->Lines->Append("A buffer size
of '" + (String)length +
"' was compressed to '" + (String)outputOffset +
"'");
return true;
}
catch (Exception err)
{
MainForm->memoOutput->Lines->Append("Exceotion
thrown. Message: " + err.Message);
}
RecordProc is a callback function called every 250
milliseconds with recorded data stored in 'buffer' with
length 'length'. Data is in float format. Framesize is 640
(uwb mode). With each call, length has a size of about
32000 (hz). After 5 calls (ie: the sixth call), the program
crashes with the following messages in message boxes:
log: OVERFLOW error
sqrt: DOMAIN error
log: OVERFLOW error
log10: SING error
log: OVERFLOW error
log: OVERFLOW error
log: OVERFLOW error
log: OVERFLOW error
log: OVERFLOW error
And then an exception is thrown:
Exception: Access violation
<p>Output on memoOuput:
A buffer size of '26880' was compressed to '3780'
A buffer size of '30720' was compressed to '4320'
A buffer size of '30720' was compressed to '4320'
A buffer size of '30720' was compressed to '4320'
A buffer size of '30720' was compressed to '4320'
<p>The compiler returns me to the following line:
speex_encode(enc_state, (float*)buffer, &bits);
<p>This is how speex was initialised:
speex_bits_init(&bits);
enc_state = speex_encoder_init(&speex_uwb_mode);
peex_encoder_ctl(enc_state,SPEEX_GET_FRAME_SIZE,&frameSize);
long x = 32000;
speex_encoder_ctl(enc_state,SPEEX_SET_SAMPLING_RATE,&x);
<p>What am I doing wrong?
Compiler: Borland C++ Builder 6 Professional.
OS: Windows XP
Speex version: 1.01
Sound library: BASS 2.0
Thanks in advance for any help.
Willie
___________________________________________
Look Good, Feel Good www.healthiest.co.za
--- >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.
> (float*)buffer = (float*)buffer + (frameSize); > > speex_bits_reset(&bits); > > speex_encode(enc_state, (float*)buffer, &bits);Please don't tell me that your "buffer" variable is a (short*) and you expect that to work by casting the pointer to (float*).... Jean-Marc -- Jean-Marc Valin, M.Sc.A., ing. jr. LABORIUS (http://www.gel.usherb.ca/laborius) Université de Sherbrooke, Québec, Canada -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 190 bytes Desc: Ceci est une partie de message numériquement signée Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20031107/28a1e485/signature-0001.pgp
> I have a few questions about which options are mutually exclusive; > It appears that if you set ABR to a specific value, it says in speexenc > you don't need to specifically turn on DTX, VBR or VAD, and from the > code and documentation it appears that you don't need to set VBR > quality or set Quality either- this should be done by the open loop algorithm.Basically ABR implies VBR and VBR implies VAD (but no longer DTX). Also, if you specify --vbr, you need to specify quality, but if you use --abr, only the quality is dynamically adjusted to match the bit-rate specified.> Also, is the VAD in the pre-processing code different from > the VAD that is used in the current code base?They are very different. The VAD integrated in the encoder is very rough and low complexity while the one in the preprocessor is done in the frequency domain and should be much better. They don't serve exactly the same role either. The VAD in the encoder is tuned to encode everything but stationary noise, while the preprocessor VAD is tuned to reject non-stationary noise too (ideally anything that's not speech). Jean-Marc -- Jean-Marc Valin, M.Sc.A., ing. jr. LABORIUS (http://www.gel.usherb.ca/laborius) Université de Sherbrooke, Québec, Canada -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 190 bytes Desc: Ceci est une partie de message numériquement signée Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20031126/d8edf83d/signature-0001.pgp
Hi All & Jean Marc, I have a few questions about which options are mutually exclusive; It appears that if you set ABR to a specific value, it says in speexenc you don't need to specifically turn on DTX, VBR or VAD, and from the code and documentation it appears that you don't need to set VBR quality or set Quality either- this should be done by the open loop algorithm. Is this true? Also, is the VAD in the pre-processing code different from the VAD that is used in the current code base? Thanks! Tom <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.