# DirectSound capture/playback corrupts sound

## Recommended Posts

ariehorst    122
Hello everyone, for my application i need to implement DirectSound capture and playback, so i looked in and compiled the FullDuplexFilter sample application from the DirectX 9.0 SDK. To my surprise i found out that there was at least a 1 second delay between generating sound on the mic and hearing it on the speakers. I shortened the notification size but that only resulted in a minimum delay of about 750msec. Does anyone know how to get around this or do i just have to live with this fact? I can't imagine this is normal behavior so there must be an explanation or solution. thanx in advance [Edited by - ariehorst on August 6, 2007 1:13:51 AM]

##### Share on other sites
Evil Steve    2017
It depends on the length of your playback buffer. A larger buffer means less CPU overhead (less constant filling), but a longer delay when playing back.
You probably want to make your buffer "tiny" (100ms or less).

##### Share on other sites
ariehorst    122
thanx for your reply steve. Indeed when i shorten the playback buffer the latency is shorter. this works all fine when i use 44100hz sampling rate. But when using any other rate, the sound gets corrupted periodically. then there comes a "tick" in the sound and the sound that should be there sounds incomplete.
i use this calculation to determine the notification size:
g_dwNotifySize = pwfxInput->nAvgBytesPerSec / ( 10 * NUM_PLAY_NOTIFICATIONS );g_dwNotifySize -= g_dwNotifySize % pwfxInput->nBlockAlign;

when i use larger buffer it only takes longer before the sound gets corrupted, but it always happens (also with just the clean example, with no adjustments), except for a rate with 44100hz.

any ideas?

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account