Let’s first talk about the delays. There’s a number of settings you can do in order to reduce them:
As you already found, reducing the mixer buffer size helps to reduce the delay.
[HKLM\Drivers\Builtin\NvWaveDev]
“maxbuffersize” = dword:0x1000
This buffer is working on 16bit, stereo, 44.1kHz data, so a buffer of 0x1000 byte lasts for about 4096 / (44100 x 2 x 2) = 23 ms.
There are two timing settings which are meant to configure the timing for an external amplifier, but I found it also affects the regular delay (you may have noticed that playback starts faster if the silence period after the last sound was less than 1 sec). To avoid this delay, please set:
The click sounds are related to buffer sizes on different layers. In your test application…
the System.Media.SoundPlayer() function can play your test sound without clicking noises, while
calling Playsound() shows the problem.
Just to mention for completeness, there would be two additional methods to play sounds, which could again behave differently because of different buffer handling:
DirectShow
Accessing the wave driver on a lower layer using waveOutOpen()
To avoid the click sounds in your test application I have found two solutions:
Convert your 22kHz, 8bit sample to 44.1kHz, 16bit
(However, I don’t have an explanation why this helped)
Increase the buffer size for the Playsound() function:
[HKLM\Audio\PlaySound]
msPerBuffer = dword:0x3e8 ; buffer for 1000ms
buffers = dword:4 ; optional, the default is already 4.
; Settings of 1…8 did not make any difference for me
Please let me know if these settings fix all your issues.