Home Computer Audio Asylum

Music servers and other computer based digital audio technologies.

RE: A revolution in audio rendering

continue to optimise and get improvements in sound, one thing I have found is that as the loop is optimal the reliance on low latency is reduced, in fact sounds much worse at low values, so can now use a period of 0.5s

found that best vs2010 optimisation settings were for speed.

playing wav files from a ramdisk gave best sound

then moved on to memory play, initially SQ was worse.

found that a function called memcpy was the culprit, most memory players use memcpy and this is one of the reasons why memory play sounds worse ie digital sounding. Fortunately there is an optimised version of memcpy from http://www.agner.org/optimize/, using this version removes the hard edge produced by memcpy. the other thing I did was to close the file after reading into the buffer.

also most players use malloc to get memory while new is the c++ method and sounds better.

updated exe below, sounds fantastic I use it all the time now, doesn't have the processed sound of JPlay and is the best player I have heard on my system.


optimised loop below.

BYTE *sound_buffer = new BYTE [sizeof(BYTE) * nBytesInFile];

hr = mmioRead(hFile, (HPSTR)sound_buffer, nBytesInFile);
mmioClose(hFile, 0);
//UINT32 nByteCnt = nBytesInFile - nBytesThisPass*2;

//while (nBytesToSkip < nByteCnt)
//while (--nBuffersPlayed)
WaitForSingleObject(hNeedDataEvent, INFINITE);
hr = pAudioRenderClient->ReleaseBuffer(nFramesInBuffer, 0);
hr = pAudioRenderClient->GetBuffer(nFramesInBuffer, &pData);
A_memcpy (pData, sound_buffer + nBytesToSkip, nBytesThisPass);
nBytesToSkip += nBytesThisPass;
while (--nBuffersPlayed);
//while (nBytesToSkip < nByteCnt);
//while (nBuffersPlayed > 0);
// render loop

WaitForSingleObject(hNeedDataEvent, INFINITE);

//hr = mmioRead(hFile, (HPSTR)pData, nBytesThisPass);
hr = pAudioRenderClient->ReleaseBuffer(nFramesInBuffer, 0);

WaitForSingleObject(hNeedDataEvent, INFINITE);

hr = pAudioRenderClient->GetBuffer(nFramesInBuffer, &pData);
nFramesThisPass = nFramesInFile - nBuffersinFile*nFramesInBuffer;
nBytesThisPass = nFramesThisPass * pWfx->nBlockAlign;

A_memcpy (pData, sound_buffer + nBytesToSkip, nBytesThisPass);

if (nFramesThisPass < nFramesInBuffer) {
UINT32 nBytesToZero = (nFramesInBuffer * pWfx->nBlockAlign) - nBytesThisPass;
ZeroMemory(pData + nBytesThisPass, nBytesToZero);


This post is made possible by the generous support of people like you and our sponsors:
  Amplified Parts  

Follow Ups Full Thread
Follow Ups


Post a Message!

Forgot Password?
Moniker (Username):
Password (Optional):
  Remember my Moniker & Password  (What's this?)    Eat Me
E-Mail (Optional):
Message:   (Posts are subject to Content Rules)
Optional Link URL:
Optional Link Title:
Optional Image URL:
Upload Image:
E-mail Replies:  Automagically notify you when someone responds.