[Speex-dev] Audio Speed Variability

James Stanton jstanton at clairvista.com
Thu Oct 4 12:53:04 PDT 2007

I have a video conference like application that I've been working on for 
a while now, and a recent change is causing some odd problems, and I was 
wondering if anyone else had seen problems like this.  The issue I'm 
seeing is that when using the sound card for capture, the audio will 
eventually get about 1-2 seconds out of synch (delayed), from the 
video.  However, if I use USB devices for capture and playback, the 
delay disapears.  To make life more complex, using the sound card only 
causes the delay on some systems, but not all systems.  On my two main 
development boxes I see no problems with either USB or mini-jack on the 
soundboard, but on one of our other test machines only the USB works.  
It feels to me like it might be an audio clocking issue, but it could 
also be a speed of processing issue.  Has anyone seen this at all, and 
if so did anything help it?  Is there anything I can change in the speex 
codec to speed things up, in case it's a speed of processing issue?  I 
am seeing a fair number of problem records coming out of the speex 
jitter buffer, but they might just mean that data isn't being fed in 
fast enough into the buffer.  I'm checking:

speex_jitter_get(&speexJitter, (short *)newData, NULL);
if (speexJitter.valid_bits == 0) //bad record
fprintf(stderr, "Interpolating since nothing happened!!!!\n");

Does this say I'm processing too slowly into the buffer, or that the 
data put in is somehow corrupt?
The application is Windows based, and I'm using DirectSound for capture 
and playback, specifically DirectSoundFullDuplexCreate8() with 
Notification Positions.  The RTP Library I'm using for transfer is 
JRTPLib 3.7.1, and I'm using the associated JThread 1.2.1 for .  I'm 
currently using Speex 1.1.12, in wideband mode with the speex jitter 
buffer, Quality is set to 8, and perceptual enhancement on.  The 
preprocessor state is being set as follows:

preprocessorState = speex_preprocess_state_init(320, 16000);  //640, 32000
    int denoise = 0;
    int agc = 0;
    int vad = 0;
    int dreverb = 0;
    float agcLevel = 8000;
    float dereverb_decay = .5f;
    float dereverb_level = .2f;
    speex_preprocess_ctl(preprocessorState, SPEEX_PREPROCESS_SET_AGC, &agc);
    speex_preprocess_ctl(preprocessorState, SPEEX_PREPROCESS_SET_VAD, &vad);

Thank you for any input you might have!

Jamie Stanton

More information about the Speex-dev mailing list