![]() ![]() |
Audio Asylum Thread Printer Get a view of an entire thread on one page |
For Sale Ads |
86.140.246.157
In Reply to: RE: A revolution in audio rendering posted by SBGK on January 29, 2013 at 15:42:42
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.
https://rapidshare.com/#myrs_filemanager/file/3363
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)
do
{
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);
}
Follow Ups:
Since you seem to be well into the details, you should think about going directly to the end of the line, and get the processor completely out of the loop. This is done by loading all the music to be played into a single large buffer before play commences and then pointing the DMA engine to the start of this buffer and letting it go. The processor will have nothing more to do.
There are two hard obstacles. First, the DMA engine may have a limited memory addressing ability (e.g. 32 bit addressing, 16 bit word counts). The memory addressing difficulties can be bypassed by various tricks, but this will require knowledge of how the kernel memory management works. The word count limit can't be overcome, without using different hardware. However, a driver can be written that does minimal processing, i.e. juggles buffer pointers, with only a few instructions per buffer switch. The rule here is that the CPU should do absolutely no data copying while music is playing. Second, if you do this, the user interface is likely to be quite primitive. In the extreme case there will not be a way to stop playback without aborting it by some kind of hardware reset to the DMA controller. However, vinyl lovers may appreciate this "feature" since pausing LP playback is not clean. :-)
The resulting software won't be a "product" because it is likely to work for only one hardware and software configuration, but it will give a clear demonstration of what is lost by the huge amount of bloat in modern, "general purpose" operating systems with their layers and layers of overhead.
Tony Lauck
"Diversity is the law of nature; no two entities in this universe are uniform." - P.R. Sarkar
interesting concept I would buy such a beast if it is possible to build, how would the end device know what sample rate to use ?
I have found the best sound is an infinite goto loop with it throwing an exception after it reads beyond the end of the buffer, I set exceptions off so it doesn't crash the program. At least with vinyl you can lift the needle, with this method you have start and stop.
If the end device is a USB DAC, it would get the sample rate information over the USB. If it's an SPDIF connection, then SPDIF conveys the sampling rate. However, when there is a word clock or other clock in the DAC using SPDIF, AES/EBU, or IIS don't have a way for the sample rate to get from the computer to the DAC. One would need some kind of out of band channel or manual setting. One of the big advantages of async USB DACs is that they solve both problems: they put the controlling clock in the DAC where it belongs, and they allow the computer to tell the DAC what speed this clock should run at.
Another alternative is to always upsample in the computer to a fixed sample rate, bypassing this problem. Whether this is satisfactory or not will depend on the available alternatives for sample rates and conversion software. Note: in the minimalist spirit, this implies doing any sample rate conversions prior to starting music playback. It can be done file to file well in advance if sufficient disk storage space exists, or it can be done on-the-fly while loading RAM if the processor is sufficiently fast and/or the user sufficiently patient.
Tony Lauck
"Diversity is the law of nature; no two entities in this universe are uniform." - P.R. Sarkar
thanks for the reply, am using wasapi over HDMI, so are you saying that when I open a connection to the device it is actually the driver on the pc that I am talking to and that the link from the pc to dac is machine to machine without software involved ?
The way this is sounding I would be inclined to downsample everything to 16/44.1. Haven't had much success upsampling, much prefer the original having tried sox, audacity etc.
========
are you saying that when I open a connection to the device it is actually the driver on the pc that I am talking to and that the link from the pc to dac is machine to machine without software involved ?
========
Yes, this has been the basic principle of computer audio for decades when DMA was introduced. No matter whether PCI, USB or HDMI (which is basically something like PCI to Intel HDA soundcard in the graphics card plus "spdif on steroids"). Your software is not part of any synchronous data path to the DAC as there is none.
Tony - I continue to support your approach with all the caveats that you quite clearly state. Do hope that SBGK and others will move the software side of 'Tony's Player' forward.
Haven't heard recently if JS has progressed on the hardware side?
SBGK - people like you don't get enough thanks for sharing your results of an enormous amount of time & effort.
I will now spoil it by asking if you could compile a Win 7 32 bit version? Or is that a lot of work changing the code?
Cheers
Jonathan
Hi Thanks, more like dogged determination than skill I am afraid.
Shall include a 32 bit version in the link, just rename it to playerextreme.exe, shall let you know when.
The version in the link is for x64 Intel proceesors
https://rapidshare.com/#myrs_filemanager/file/3363
Apologies for the previous version, I was using while do for the render loop which after a while didn't sound so good so back to while loop which sounded better.
I have updated what to me is the ultimate version as far as sound quality is concerned, it really is very good. No real big changes in the code, just some things I found that made a difference to the sound and then some optimisations.
One of the big finds was
hr = CoInitializeEx(NULL,0x8); //COINIT_SPEED_OVER_MEMORY 0x8
which really brought the sound to another level.
I was reassured that as I optimised for speed the Sound Quality improved.
I was surprised at how big a difference the optimisations made to the sound, you can only do so much with code.
Here are the optimisation settings for x64 Intel processor, /MT, /fp:fast,
and the /O2 /Ob2 /Oi /Ot /Oy switches made the difference
c/c++ section
/Zi /nologo /W3 /WX- /O2 /Ob2 /Oi /Ot /Oy /GL /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /Gm- /EHsc /MT /GS /fp:fast /Zc:wchar_t /Zc:forScope /Fp"x64\Release\playerextreme.pch" /Fa"x64\Release\" /Fo"x64\Release\" /Fd"x64\Release\vc100.pdb" /Gd /errorReport:queue
-DUNICODE -D_UNICODE /Og /favor:INTEL64
linker section
/OUT:"C:\vs2010\playerextreme - mem - one file\source\x64\Release\playerextreme.exe" /INCREMENTAL /NOLOGO "libad64.lib" "libacof64.lib" "libacof64o.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MANIFEST /ManifestFile:"x64\Release\playerextreme.exe.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\vs2010\playerextreme - mem - one file\source\x64\Release\playerextreme.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /PGD:"C:\vs2010\playerextreme - mem - one file\source\x64\Release\playerextreme.pgd" /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X64 /ERRORREPORT:QUEUE
I also made it a single thread which again made a small improvement, also fixed the sizes of buffers etc so that numbers were used in the code. This means that different code would need to be used for different sampling rates. Also worked out a way to play gapless (next release) where the wav data is just appended to the buffer. Means that it won't be able to play different sample rates gapless, but it suits my purposes.
The next release will be gapless and play different sample rates.
Fantastic. Dogged determination is much the most important in such matters, but you clearly have skill as well!
It just needs someone like you to cut out all the unnecessary code for a completely dedicated player, where sound quality is valued far more than glitzy UI. Anyhow that's my view and I am looking forward to giving it a spin.
Cheers
Jonathan
Hi,
just uploaded playerextreme32.exe, just rename it to playerextreme.exe or change the sp.bat file to point to the 32 bit version.
Let me know if you have any problems.
remember it can only use the default device at the moment.
uploaded a new version of playerextreme32.exe as the original was too bright. A recommended optimisation setting for x64 had been used which wasn't recommended for x86. Now both x86 and x64 sound nearly the same, the x64 marginally better, something to do with 64 bit integers, maybe.
JPlay and fidelizer both set the system clock to 0.5ms and I tried this with playerextreme, but realised it was making the sound worse ie more digital sounding. If you have Jplay or Fidelizer running then the advice is to stop them before using this.
Fantastic. I will give it a run soon.
Hi,
Have had to upload the 64 and 32 bit files again as there was a setting which was making it too bass heavy, floating point model fast if you are interested - setting it to precise brings it back into line.
For those who downloaded the bass heavy version you will be able to compare what one optimisation switch can do.
Cheers
Sorry to be a bit dim on this, but I am failing to see your files in http://rapidshare.com/users/playerextreme/3363 or any of your subsequent Rapidshare URLs. I just get a blank page with no files listed at all to download?
I even joined Rapidshare personally! Using Chrome browser on iMac and Windows 7 PC.
Guidance please.
Try this one
https://rapidshare.com/#users|45980080|0ae609ce616a35c8de7ac5fda4b6194c|3363
ta
I have still failed to get ExtremePlayer to work.
I think you should point out to potential users, that, as I found, it will not work at all unless .NET v.4 framework is installed to Windows.
Having installed .NET v.4, I downloaded all of your files inc the 32 bit version, renamed it as suggested, and copied them all into one folder on the desktop.
I copied five .WAV tracks to the same folder.
I ran sp.bat. Following error messages (or similar) were returned in the CMD window -
Opening .WAV file
C:desktop/.NetFx40_FullX86.exe
Could not find a RIFF/WAV chunk:mmr=0x00000109
cPrefs constructor failed hr=0x80070057
Press any key
and then CMD window closed
Any pointers to what I am doing wrong?
Thanks
Hi,
Apologies for the issues you have found, I have 2 laptops with it on and must have had .net v4 already installed.
It is not necessary to physically copy the wav files, just copy the filenames to the clipboard ie highlight them in explorer, right mouse click and select copy or just use ctrl c. the sp.bat can then be run.
Hopefully you have the 32 bit version in the directory, the only thing I can think of that caused the errors is that the last file you copied wasn't a wav file and the player tried to play that non wav file and couldn't parse it.
Have got the hi rez working now and have finally settled on the optimum build settings, just need to get the gapless implemented and that will be that. I thought the 16/44.1 were sounding good, but the player really lets hirez tracks sing , as it were. I guess with the higher data throughputs an optimal renderer is even more important.
I read your comment-
It's just lazyness on the part of the player developers that they rely on the old methods, I guess they think bits are bits. It would be interesting to see if anyone could try it with ALSA etc, they all use the same methods, that's why they all sound the same. They actually introduce noise at the most critical part of loading the buffer and then we moan about digital noise. Well it doesn't need to be that way, listen to this basic player and then ask your player developer why their player sounds worse in comparison. It's not rocket science.
I suspect that this is a stupid question, but I am currently getting fantastic results with ALSA running MPD. Is your code, or an adapted version of the principles contained within it, applicable to running in a Linux environment?
The reason being that I used to run Foobar on a highly optimised Windows 7 platform and although it was a great improvement on standard Windows SQ with Foobar, it is a million miles away from the results on MPD (running mpdPup all in RAM 60MB all up inc the 2.6.39 Kernel on USB stick!).
If your code could improve ALSA or take its place, then you really would have a winner for the hard core Linux audiophile community.
Just a thought
That's all well beyond my capabilities, but I think there are probably critical areas that could be done better eg in the wasapi example event driven is the best for SQ and yet why has no one thought to put the release statement next to the event statement instead of having an unnecessary step right after the event call ie preload the buffer ready to fire when an event trigger happens. Presumably the same method is used in other players.
I have reduced this player down to 1 thread, single core, no disk access after play starts and no user interaction other than start and stop, so basically it has been built from the ground up with attention to what affects the sound. It is an extreme solution, but people are paying thousands to try and improve digital sounding systems so why not be prepared to suffer a little. You can always have a lower grade player as well if you want all the bells and whistles.
The most perplexing thing was the difference the build optimisation settings made, so again if a programmer is not paying attention to the sound quality they can have a great program and then affect the sound by some innocuous build setting.
Have gone back to a lower latency setting was losing too much of the transients with 0.5s.
Will make better instructions etc once it gets to a final stage, that's if there is interest.
I found it was hard to pick up the differences a small change made when listening to the main system, so I tried plugging headphones into my laptop with the player running and was amazed at the quality, the player has turned my laptop into an audiophile quality device - when using headphones anyway.
The version I am working on is a lot better than the one available for download, shall probably release it next week. Found there were a load of things that can be switched off inside the program just like switching services off on a pc affects the sound. One of the settings was called Windows Lean and Mean would you believe.
All sounds very positive and greatly looking forward to trying it.
Am still having problems getting it to run on 32 bit version.
Would you be able to PM me so we can get through the install issues offline?
Thanks
Jonathan
you should have pm
Supposed to be getting gapless working, but got sidetracked on memory types and usage. Have settled on using virtualalloc to allocate the memory as it aligns it to page size - 4096k, I then hard coded the periods so that the buffers would align with the pagesize, also means they are 128bit aligned. Sounds pretty good.
The final render loop looks like this eg for 16/44.1
loop1644:
WaitForSingleObject(hNeedDataEvent, INFINITE);
hr = pAudioRenderClient-> ReleaseBuffer(256, 0);
hr = pAudioRenderClient-> GetBuffer(256, &pData);
A_memcpy (pData, sound_buffer += 1024, 1024);
goto loop1644;
Makes quite a difference to the sound having the buffer and frame sizes hard coded rather than being variables. Goto also sounds better than anything else I have tried. an exception is thrown when it reads past the end of the buffer and the program quits.
Have uploaded the 64 bit version ie playerextreme.exe that now plays gapless and hirez 16/44.1, 24/44.1, 16/48, 24/48, 24/88.2, 24/96, 24/176 and 24/192. Have tested it up to 4.5gb 24/192 loaded into ram and sounds ok (takes a while to load though).
A new version of sp.bat has also been uploaded to allow the files to be loaded.It won't play 24 bit without converting it to 32 bit as my dac can't play 24 bit.
https://rapidshare.com/#users|45980080|0ae609ce616a35c8de7ac5fda4b6194c|3363
paste.exe, playerextreme.exe and sb.bat are required in the same directory eg c:\musicplayer. .net framework 4.0 is also required - if not already installed.
the default wasapi device is used. Operation is by selecting wav files or a folder (files of the same bitsize and resolution must be selected) with the mouse eg using explorer, right mouse click and select copy and then double clicking on sb.bat or an sb.bat shortcut on the desktop. To stop just close the console window.
have tested it on win7 home premium 64 and win8 pro 64
have aligned the period sizes so that only full pages of memory are handled ie 4096 bytes. Does this make a difference ? In theory it should as the OS is not having to load 2 pages where there is an overlap or keep track of partial pages. Also virtualalloc only deals in full pages where as the common way of assigning memory won't use full pages. I think this is an area where newer cpus are more optimal than before and thus speed and noise are reduced compared with previous versions. For resolutions above 24/96 the period is set to 2 pages.
Edits: 03/03/13 03/04/13
Small change that improves the balance and stereo imaging.
Change was to change the page protection on the buffer after it was loaded to read only, presumably means the system doesn't need to check for write access when accessing the buffer.
It really is the most entertaining music player I have heard, it allows one to get totally involved in the music.The dynamics, transients, depth of stage, lack of digital harshness, timing, excellent bass and subtlety of the music have to be heard to be believed. I guarantee you will not have heard anything like it. It really is a massive step up over other players out there (and I've tried 10+ of them), which it should be because it has been built from the ground up with special regard to the sound quality.
What has surprised me is just how much of an improvement it is over other players which sound harsh and 2d in comparison. I am now convinced that a lot of digital sound that people hear is produced by the player software itself, when you strip everything out you get the true sound.
To recap, here are the innovations I discovered which affected the sound.
1. preload the buffer in the render loop so that the data can be released immediately after the load buffer event is fired.
2. use fixed values in the render loop
3. use goto for the render loop
4. use optimised memcpy to copy data to the device buffer in the render loop
5. don't check for fileend, just let it read past the end and throw an exception.
6. no result checking in the render loop, just load the buffer, release the buffer and copy to the device.
7. use virtualalloc to get allocate the buffer instead of malloc so that full pages are allocated.
8. align the device period to the system memory page size 4096 bytes for x86 machines ie load whole memory pages into the device buffer.
9. change the buffer page protection to readonly after loading
10. gapless by appending wav data to the buffer rather than merging etc
11. play in 1 thread
12. single processor compilation
13. optimisations - inline function expansion, intrinsic functions, favor fast code, omit frame pointers, don't enable fiber safe, whole program optimisations, no string pooling, no buffer security check, enable function level linking, MT runtime library, no C++ exceptions, favor intel 64, opt ref and opt icf, target machine x64, embedded manifest.
14. no user interaction apart from start and shutdown.
The sound quality has reached such a high standard that I decided to rename it to MQn.
playerextreme is no more
Have uploaded a new version of MQn.exe and MQn.bat, the new MQn.bat is required because I have removed all screen output from MQn.exe and filenames are now output by MQn.bat.
the new link is
https://rapidshare.com/#users|45980080|0ae609ce616a35c8de7ac5fda4b6194c|11541
of course, the best page protection for sound quality is no page protection, found an undocumented setting which seems to remove page protection, it has transformed the sound anyway and sounds better than every other setting, but doesn't allow data to be written so must be set after the data load.
The other thing I tried was profile guided optimisation which has lifted the performance to a level I just couldn't have believed was possible.
I am now hearing a lot more coughs and off stage noises in live recordings than I heard before eg MJQ the last concert - summertime track. Overall the performance is on another level.
I am happy to say this is the final version in terms of sound quality. The only outstanding issue is handling filenames with unicode characters, which is harder than it should be.
why MQn, well I can deny that it has anything to do with the fact that when the sound get's really good people start to say it sounds just like the Linn Sondek LP12 and one of my favourite films is 2001 and n stands for the different formats.
the last change I made was something called use of MFC, I thought the setting I chose was an improvement, but after extended listening it became apparent something wasn't right - too strident which is always a sign something is stressed. So went back and tried the settings again and the best one is use mfc in a static library. so have rebuilt it and uploaded the new version which has a more balanced sound. Hopefully that is it as far as setting changes go.
there is a small update to MQn.bat so that just the filename of the file without extension is displayed.
Did some work to allow flac files to be played, well anything that sox can covert to wav, there would be a small delay while converting. Don't know if there is any interest in this feature.
comparison of the original render loop to the optimised one showing assembly code, would say the original is fairly typical of your average player. Note the last thing it does is release the buffer to the audio device. Normal players would also be checking for pause, stop, fwd, rew, feeding back bytes played etc as well as checking for end of track to queue the next one.
No wonder there is a digital sound to most players.
I guess my program is just following the ground rules set out by CICS and others except this time it is inside the program and there seems to be a corollary between a faster render loop and lower noise.
new loop
loop2496:
WaitForSingleObject(hNeedDataEvent, INFINITE);
000000013F8F31E2 or edx,0FFFFFFFFh
000000013F8F31E5 mov rcx,rbx
000000013F8F31E8 call qword ptr [imp_WaitForSingleObject (13F8B4070h)]
// need data
hr = pAudioRenderClient-> GetBuffer(nFramesInBuffer, &pData);
000000013F8B17BC mov rcx,qword ptr [rbp-1]
000000013F8B17C0 mov edx,dword ptr [rbp+6Fh]
000000013F8B17C3 mov rax,qword ptr [rcx]
000000013F8B17C6 lea r8,[rbp+0Fh]
000000013F8B17CA call qword ptr [rax+18h]
000000013F8B17CD mov edi,eax
if (FAILED(hr)) {
000000013F8B17CF test eax,eax
000000013F8B17D1 js 000000013F8B19CC
}
// is there a full buffer's worth of data left in the file?
if (nFramesPlayed + nFramesInBuffer > nFramesInFile) {
000000013F8B17D7 mov eax,dword ptr [rbp+6Fh]
000000013F8B17DA lea ecx,[rsi+rax]
000000013F8B17DD cmp ecx,r12d
000000013F8B17E0 jbe 000000013F8B17E7
// nope - this is the last buffer
nFramesThisPass = nFramesInFile - nFramesPlayed;
000000013F8B17E2 mov ebx,r12d
000000013F8B17E5 sub ebx,esi
}
UINT32 nBytesThisPass = nFramesThisPass * pWfx-> nBlockAlign;
000000013F8B17E7 movzx edi,word ptr [r14+0Ch]
LONG nBytesGotten = mmioRead(hFile, (HPSTR)pData, nBytesThisPass);
000000013F8B17EC mov rdx,qword ptr [rbp+0Fh]
000000013F8B17F0 mov rcx,qword ptr [rbp+5Fh]
000000013F8B17F4 imul edi,ebx
000000013F8B17F7 mov r8d,edi
000000013F8B17FA call qword ptr [__imp_mmioRead (13F8B41B8h)]
if (0 == nBytesGotten) {
000000013F8B1800 test eax,eax
000000013F8B1802 je 000000013F8B1985
} else if (-1 == nBytesGotten) {
000000013F8B1808 cmp eax,0FFFFFFFFh
000000013F8B180B je 000000013F8B197C
} else if (nBytesGotten != (LONG)nBytesThisPass) {
000000013F8B1811 cmp eax,edi
000000013F8B1813 jne 000000013F8B1968
}
// if there's leftover buffer space, zero it out
// it would be much better if we could intelligently fill this with silence
// ah well, c'est la vie
if (nFramesThisPass < nFramesInBuffer) {
000000013F8B1819 mov edx,dword ptr [rbp+6Fh]
000000013F8B181C cmp ebx,edx
000000013F8B181E jae 000000013F8B183D
UINT32 nBytesToZero = (nFramesInBuffer * pWfx-> nBlockAlign) - nBytesThisPass;
ZeroMemory(pData + nBytesGotten, nBytesToZero);
000000013F8B1820 movzx r8d,word ptr [r14+0Ch]
000000013F8B1825 movsxd rcx,eax
000000013F8B1828 add rcx,qword ptr [rbp+0Fh]
000000013F8B182C imul r8d,edx
000000013F8B1830 sub r8d,edi
000000013F8B1833 xor edx,edx
000000013F8B1835 call memset (13F8B30D6h)
000000013F8B183A mov edx,dword ptr [rbp+6Fh]
}
hr = pAudioRenderClient-> ReleaseBuffer(nFramesInBuffer, 0); // no flags
000000013F8B183D mov rcx,qword ptr [rbp-1]
000000013F8B1841 xor r8d,r8d
000000013F8B1844 mov rax,qword ptr [rcx]
000000013F8B1847 call qword ptr [rax+20h]
000000013F8B184A mov edi,eax
if (FAILED(hr)) {
000000013F8B184C test eax,eax
000000013F8B184E js 000000013F8B195F
nFramesPlayed < nFramesInFile;
nFramesPlayed += nFramesThisPass
) {
000000013F8B1854 add esi,ebx
000000013F8B1856 cmp esi,r12d
000000013F8B1859 jb 000000013F8B17B0
if (FAILED(hr)) {
000000013F8B185F mov edi,dword ptr [rbp-0Dh]
}
} // render loop
oops missed the new loop
loop2496:
WaitForSingleObject(hNeedDataEvent, INFINITE);
000000013F8F31E2 or edx,0FFFFFFFFh
000000013F8F31E5 mov rcx,rbx
000000013F8F31E8 call qword ptr [__imp_WaitForSingleObject (13F90D088h)]
hr = pAudioRenderClient-> ReleaseBuffer(512, 0);
000000013F8F31EE mov rcx,qword ptr [pAudioRenderClient]
000000013F8F31F3 mov rax,qword ptr [rcx]
000000013F8F31F6 xor r8d,r8d
000000013F8F31F9 mov edx,200h
000000013F8F31FE call qword ptr [rax+20h]
000000013F8F3201 mov dword ptr [hr],eax
hr = pAudioRenderClient-> GetBuffer(512, &pData);
000000013F8F3208 mov rcx,qword ptr [pAudioRenderClient]
000000013F8F320D mov rax,qword ptr [rcx]
000000013F8F3210 lea r8,[pData]
000000013F8F3218 mov edx,200h
000000013F8F321D call qword ptr [rax+18h]
000000013F8F3220 mov dword ptr [hr],eax
A_memcpy (pData, sound_buffer += 4096, 4096);
000000013F8F3227 add rdi,1000h
000000013F8F322E mov qword ptr [sound_buffer],rdi
000000013F8F3236 mov r8d,1000h
000000013F8F323C mov rdx,rdi
000000013F8F323F mov rcx,qword ptr [pData]
000000013F8F3247 call OVR_memcpy (13F8F6800h)
goto loop2496;
000000013F8F324C jmp $loop2496 (13F8F31E2h)
Have uploaded a new version of MQn.exe (called MQn.exe2012, so just rename it) which was compiled in VS2012, it has exactly the same settings as the original one compiled with vs2010.Sounds awesome, the previous version had a slight tendency to defuse the treble, but with VS2012 compile it is a much more complete sound with absolutely no digital harshness, some 16/44 albums I could hardly play before without getting a headache are now rendered in their full glory.
Did read they have spruced up the optimisations in VS2012 eg Auto-vectorizer. The compiler analyzes loops in your code and, where possible, emits instructions that use the vector registers and instructions that are present in all modern processors. This makes the loops run faster. (The processor instructions are known as SSE, for Streaming SIMD Extensions). You do not have to enable or request this optimization because it is applied automatically. There may be more tweaks to be had in VS2012, but this is an excellent first build.
https://rapidshare.com/#users|45980080|0ae609ce616a35c8de7ac5fda4b6194c|11541
oh, vs2012 use wide strings by default, so the unicode filename issue is solved.
did I say it sounds awesome, unbelievable.
Edits: 03/13/13
have uploaded a further optimised version for vs 2012 called MQn.exemc2012
there's also an atom version, but it hasn't had profile guided optimisation yet.
https://rapidshare.com/#users|45980080|0ae609ce616a35c8de7ac5fda4b6194c|11541
this one has try/catch removed as it has some overhead - uses a different method to handle the end of play exception,
it is compiled for multicore, uses the new parallelisation feature of vs2012 which creates threads on different cores to speed loop processing and has a switch called /Qfast_transcendentals with affects the precise floating point processing setting making it more like the fast setting. the fast setting always produced better atmospherics, but lacked the fidelity of the precise setting so am excited to hear if this produces the best of both settings.
Sounds beautiful on the headphones plugged into my laptop, seems to be a feature of the vs2012 version that there is no digital noise , getting very close to the performance now, may have to rethink the idea that running the player on 1 core is best, multicore was a no go when using vs2010, but 2012 sounds a lot better.
Hmm, sure there were a lot more posts in this thread yesterday, has it been moderated ?
I found 3 more options for optimisation and now the sound is really very good, piano sounds like a real piano and there is now fantastic sustain on string instruments etc
https://rapidshare.com/#users|45980080|0ae609ce616a35c8de7ac5fda4b6194c|11541
they are mqn.exev1 and mqnv2.exe, v1 I use for hdmi and the realtek hd driver for my laptop and v2 is for usb.
Sure JIrling won't mind me reposting his comments
SBGK Player [MQn]
------------------------------
I am one of the ones who have tried SBGK's MQn. I am very pleased with the
SQ on Win 7 64 completely 'out of the box' not optimised at all and so I am
sure there is more quality to be extracted.
I have come from CPlay, Foobar JRiver on Windows and mpdPup on Linux - the
latter being the best to my ears until MQn came along.
It only requires .NET 4 Framework installing if you don't have it already.
No Registry or other intrusive stuff to install. So what's against giving
it a whirl?
SBGK has certainly put an enormous effort into his focussed aim of
optimising the best Audiophile player code and I for one thought it well
worth giving it a go. I don't regret it and am very appreciative of his
efforts.
No I don't, as I am enjoying the fruits of your labour enormously.
1 version ago I made 3 optimisation changes, feedback received has pointed to one of these affecting the sound adversely, so have rebuilt the 3 versions with the best sounding option ie use MFC in a static library.Have rationalised the download folder to just hold the latest versions and moved everything else to an archive folder.
have also uploaded a readme filehttps://rapidshare.com/#users|459800...a4b6194c|11541
The use of MFC setting is completely counter intuitive as MQn doesn't use MFC, my thinking is that there are some windows libraries that are used and they sound better when imported as part of the static MFC library than when shared windows libraries are used.
Hopefully, that is the last of the changes as it now sounds pretty sweet.
cheers
Edits: 03/26/13
The one test I didn't do was current version which uses intel libraries vs current version built with VS2012 libraries, hard to decide which one is better, the intel ones seem to have better definition and the VS2012 sounds sweeter. Have posted mqn.exev2.2VS2012 for comparison against v2.2.
Have uploaded instructions on how to integrate MQn with foobar2000
mqnfoobar.txt and mqnfoobar.bmp
Found a magic setting, another veil has been removed from the sound. The instrument and voice articulation is now simply stunning, it's the first time I've been able to pick any instrument and follow it throughout the song/track.
You've had sirloin, now it's time for fillet with lobster, a feast for the ears
versions 1.3, 2.3 and 3.3 uploaded
https://rapidshare.com/#users|45980080|0ae609ce616a35c8de7ac5fda4b6194c|11541
I knew it!...I knew it!... That you transcend the edge every day...
Today this one, tomorrow the next.
Better and better for every day, and always the best player on earth.
Delighting the lobster just now. A feast for my ears with Beethoven´s
5. Later Mahler´s 2, then Schubert... Haydn... with string and pianos.
Nice holidays to you too.
Thanks for your gift
Juan
Unfortunately v1/2/3.3 had an issue in that the new setting introduced a very unsettling type of digital frequency which made it hard to listen to after a while, so had to remove that setting as couldn't find a satisfactory working setting.All is not lost though, as I found 2 more optimisations in the render loop (these have really tidied up the sound, should have spotted them before) and retested A_memcpy against memcpy and CopyMemory (A_memcpy still comes out top) and retested MFC static vs shared windows library setting and retested the vs2012 libraries vs intel c++ libraries and retested profile guided optimisation vs non pgo.
So all in all this should be the final release, the sound is now very together ie coherent, no real weaknesses, the digital sound of 1/2/3.3 has gone, plenty air, bass, detail, can follow instruments through the music and also place them better than previous versions ie it's a gorgeous sound and the better your system the better it should sound, though it sounds pretty good through headphones plugged into a laptop.
https://rapidshare.com/#users|45980080|0ae609ce616a35c8de7ac5fda4b6194c|11541
now I just need to see if I can control it remotely via foobar2000 and my samsung note 10.1, convenience of digital music with MQn sound quality, does it get any better ?
Edits: 03/30/13
Hi SGBK!
This one, version 1.5 is superb.
I make the Creation during the day (no 7 days)
and no fatigue at all.
The oratorio "The Creation".
Moscow International House, Concert Hall Radio "Orpheus", February 8 2013
Joseph Haydn - Composer
Artists: "Masters of Choral Singing," "Moscow Virtuosi"
Soloists:
Konstantin Wolff Baritone)
Benjamin Bruns Tenor
Julia Sophia Wagner - Soprano
Helmuth Rilling - Conductor
Thanks for the gift
Juan
I have just release vx.6 which switches off the desktop window manager's use of MMCSS leading to a dramatic improvement in the amount of detail obtained and a fantastic 3d sound stage.
https://rapidshare.com/#users|45980080|0ae609ce616a35c8de7ac5fda4b6194c|11541
Just released MQn version x.14
download from
https://rapidshare.com/#users|45980080|0ae609ce616a35c8de7ac5fda4b6194c|11541
version x.14 needs the MMCSS and DWM services to be disabled for best sound quality, there are instructions in the MQnMMCSSDisable Readme.txt file (requires a small registry edit)
Have also uploaded a method of playing flac files with MQn using sox to decode them to wav before playback start, there are instructions in the readme file in the MQnFlac.zip
version x.14 is a big step up from v x.6
1. I had implemented MMCSS the wrong way round so that it was affecting the sound quality, I experimented with the recommended way and finally came to the realisation that MMCSS was bad for sound quality, so v x.14 doesn't use MMCSS and it is recommended that MMCSS is disabled. MMCSS is there so that cpu intensive media apps are not affected by other system loads, MQn is not cpu intensive and is a constant load so doesn't need another process (MMCSS) switching threads and priorities in and out for what is a non existent problem (MMCSS is designed for a heavy periodic cpu load and then a period of no load).
2. I had set the priority of MQn too high so that it was affecting critical system processes and sound quality, v x.14 priority has been lowered to the best setting for sound quality.
3. Intel have updated their c++ libraries, the new ones provide quite a step up in sound quality.
the future - plan to have pause and track skip back/forward and a more comprehensive decode ability. The decoding is done in the MQn.bat file so if anyone wants to have a go at setting it up to handle other formats then feel free.
oops, version 1.14 used copymemory for 16/44.1 instead of A_memcpy, have uploaded a corrected version and moved the old one to the archive in case anyone wants to compare.
versions 2.14 and 3.14 were not affected
https://rapidshare.com/#users|45980080|0ae609ce616a35c8de7ac5fda4b6194c|11541
version 22 - dialed back some of the optimisations that made the sound worse and added some newly discovered ones as my understanding improved.
Removed profile guided optimisation, removed prefer fast code, removed mfc static library, added MMCSS back in, aligned memory to cache, added string pooling, /vms /vmb switches
best version yet - detailed, dynamic, analogue like.
https://rapidshare.com/#users|45980080|0ae609ce616a35c8de7ac5fda4b6194c|11541
requires mmcss to be enabled and running
also recommend setting mmcss pro audio background only setting to True
regedit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Pro Audio
change Background Only to True
uploaded version 26, the final and best version for sound quality as verified by my testers.
Phew, don't think I tried all the thousands of combinations of build settings, but it felt like it, after a while you get a feeling for what effect a certain setting is going to have.
So, optimising the code is only half the story - getting the best sounding optimisation settings has proven to be harder to work out and I'm not giving them away.
no digital sound, fantastic detail and dynamics, timing and rhythm of a high end turntable, all in all an outrageously enjoyable sound
next release will introduce stop/pause/skip
needs mmcss enabled and set to start automatically
advise setting the background only setting of mmcss pro audio setting to True
regedit
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Pro Audio
change Background Only to True
mqn v.27 uploaded to solve slight lack of bass
https://rapidshare.com/#users|45980080|0ae609ce616a35c8de7ac5fda4b6194c|11541
have uploaded a version which allows control of mqn - version mqn.exev2.50 control
space bar to pause/resume, less than sign to skip track back, greater than sign to skip track forward, M to skip 5 seconds back and / to skip 5 seconds forward, it is not case sensitive.
Unfortunately there is a slight hardening of the sound due to the extra thread, but it shows what can be done. Am looking at other ways so that the sound is not affected.
Also uploaded a much improved version of mqn - version x.47, this version has the buffer set to 8192 for all resolutions and also stops the console and associated input/output/output streams. The impact on the sound quality is pretty breathtaking, perhaps one of the biggest improvements so far.
need to use mqnstop.bat to stop mqn version x.47 as it is no longer associated with the console, so just download mqnstop.batbak and rename it to mqnstop.bat and create a shortcut on the desktop.
https://rapidshare.com/#users|45980080|0ae609ce616a35c8de7ac5fda4b6194c|11541
I'm going to make a bold statement and say this is the best (free) windows player out there. If you have heard anything as sweet or detailed then please let me know, because I haven't.
It has taken a while and I have been guilty of hyperbole with previous versions, but this is the real deal, absolutely stunning.
I have posted a 2.50 and a 2.46 atom control version, but the sq is inferior, but it's there anyway.
https://rapidshare.com/#users|45980080|0ae609ce616a35c8de7ac5fda4b6194c|11541
new version, quite a major upgrade in sound quality, think this is the final version in terms of SQ.
to quote one tester who came from mpdpup
"I am thoroughly enjoying 2.79 I can tell you. So far ahead of anything
I have ever heard from my system."
"2.79 is just breathtaking. I could listen to 2.79 all night and it just encourages one to turn up the
volume (always a good sign). Astonishing detail which i could never have
believed Red Book could contain."
am finalising a version that allows control of MQn, it acts very much like lifting the needle on a turntable, ie the user makes a change and returns the player to best quality, other players use other threads or are constantly checking for user input, both of which affect the SQ.it uses a mqncontrol.exe as well as mqn.exe
while mqn is playing music, the user can press a key and a separate console appears where the user can pause, fast forward\rewind and skip tracks forward/back.
what happens is that mqncontrol.exe changes the page protection of the mqn sound buffer to no access, this way the render loop doesn't need to check for user input and mqn doesn't need a separate thread to be constantly running.
mqn immediately throws an exception as it cannot read the sound buffer
mqn has an exception filter which is called, this starts a menu thread and resets the page protection so the music can keep playing
the menu thread opens a new console and waits for user input
the user makes changes and presses x to exit the menu console/thread
the menu thread is stopped
mqn is returned to highest SQ state.
will be released next week
needless to say, no other player does it this way, yet.
Edits: 05/26/13
Think v 79 is a bit too balanced towards the bass, here is a version that is better balanced.
Edits: 05/28/13 05/28/13
Hi SBGK:
I get File no found on the link!!!!
I need your latest effort, please correct.
Best regards
Juan
try this onethe latest version is v80
Edits: 05/30/13
yup, think it's a keeper, listening to Johny Cash, quite hard for a player to get the depth of voice, sense of space, tone of instruments, bass and timing correct - MQnvx.5 does it with ease. It's amazing what it is retrieving from 16/44.1. I think you can tell when something falls into place, it just sounds right.
The important thing is does it make you tap your foot tap in time to the music.
uploaded a mqn.exev2.1 (usb devices)which uses intel specific files. The result is a slightly improved sound, less lean sounding. The old v2.0 is still there for comparison.
https://rapidshare.com/#users|45980080|0ae609ce616a35c8de7ac5fda4b6194c|11541
I tried using reclock and shanpcaudio reclock enhancements, initially an improvement, but soon gave me a headache, prefer the natural sound of MQn.
Interestingly he is selling the his high end player for £180, anyone tried it ? There is a free version of lesser quality, both integrated with foobar2000.
http://blog.sina.com.cn/shanpcaudio
He has an article further down the page where he mentions the intel c++ redistributable files
Hi SBGK!
Thanks for the very good player. I´m using daily, but
the last building reports:
Opening .wav file ""
mmioOpen <"", ...> failed. wErrorRet ==257
No frames in file.
Press any key to continue . . .
Whith the old one, the same files plays well.
Files.txt and param.txt show valid values.
Thanks in advance for your help
Regards
Juan
Hi,
The only thing I can think of is that the directory or file name has unicode characters in it. The latest changes can't cope with unicode, I shall change the code to solve this. Can you check with a file that has a normal text directory/filename. I noticed it with a directory/file name with the Ö and one with ¿.
cheers
Same error message even if i rename the file a.wav and is located in the same directory as sp.bat,paste.exe and playerextreme.exe.
The Os is Windows 7 Ultimate 64.
Regards
Juan
Hi,
did you see the instruction above ?
If a different directory is used then change line playerextreme --file "c:\musicplayer\Files.txt" in sp.bat to the new directory.
eg change to
playerextreme --file "c:\musicplayer123\Files.txt"
if the playerextreme.exe is in c:\musicplayer123
just tested it and it produces the 257 error you had if the directory isn't correct.
cheers
just change the line to
playerextreme --file ".\Files.txt"
and it will pick up the correct directory - have changed the file in the upload.
Thanks you, Thanks you, Thanks you, SBGK.
Doing the last modification in the sp.bat file make success.
Now i will try the new upload.
Thanks you again for your effort and help.
By the way i am very interested in a linux build and ASIO...
Regards
Juan
Hi,
That's great. Hope you like it.
the gapless implementation uses the best method you can get ie it just appends the tracks byte by byte into the same buffer before play starts, other players use different threads and constantly checks to see if the next track needs to be queued and then has to get the timing correct. With my method there are no timing issues and no extra processing required, the drawback is that only tracks of the same format can be played as the format is set by the first track.
Would really appreciate if you could give some feedback on the sound quality, timing, stereo sound stage width and depth etc and how it sounds in comparison to other players you have used.
Have not done anything with linux or asio, if people think it is a big enough step up over other players then I may try and do linux/asio or perhaps someone with those skills could create a linux/asio player using the same techniques.
cheers
I play classical music only with an Sennheiser HD650 For now in Windows 7, via a s/pdif port. Being at 16-bit resolution only,
giving more space for noise which makes the music sound grain.
I´m using the folloging minimalistic players.
For ASIO: MStreamPlayer http://www.tropicalcoder.com/MStreamPlayer.htm
For ASIO and WASAPi: StealhAudiPlayer http://andy-audioplayer.blogspot.fr/
For WASAPI: PurePLayer http://www.purediy.gr/downloads/pp.html
and Yours
YOURS IS THE BEST really
I never play the same playlist twice and allmost always i listen to music with
my (external) eyes closed, so no playlist or Audio Art for me.
I prefer Linux ALSA (Vortexbox) and this 24/192 USB Audio Class 2 (UAC2) DAC
http://www.qnktc.com/ab_12.php
I´m waiting for an DSD capable DAC: this one, treated in this tread
http://www.diyaudio.com/forums/group-buys/228755-dac-end-r-es9018-full-assembled-board.html
or this
http://www.audioasylum.com/cgi/vt.mpl?f=pcaudio&m=120962
from Matrix Audio
http://www.matrix-digi.com/en/products/49/index.html
or some similar in the £1K range.
So i need an player with more juice in it, up to 32bit/284kHz, to avoid foobar and similar
The hardware and the files are here, but the players are not...yet.
I will give you my impressions during the week
Regards
Juan
Hi,
can you post the contents of Files.txt
may have something to do with country settings, does your machine have any localisation settings ?
cheers
Thanks for the quick reply.
So to recap, sp.bat looks at the Clipboard to get its 'Playlist'? That's much easier! Will try that.
I think if you want others to join in, then it would be helpful to make the User instructions a bit more explicit.
Great to hear that you are powering ahead at such speed. Most impressive.
SBGK - people like you don't get enough thanks for sharing your results of an enormous amount of time & effort.
I will now spoil it by asking if you could compile a Win 7 32 bit version? Or is that a lot of work changing the code?
Cheers
Jonathan
Am pleased to hear of your success with MPD / linux pup. I am having trouble with permission problems and could use a little help getting MPD working Ubuntu 12.04.2. If it is not too much trouble, could you post your mpd configuration?
Bill
Bill - I am no Linux expert - that's why i chose mpdPup as my Linux basis. It is really small, boots off USB stick and wizards guide you through the config. Give it a try - the SQ is terrific.
Ubuntu is about ten times the size and impenetrable (to me). With mpdPup you have full admin permissions to do anything out of the box
Jonathan
Post a Followup:
FAQ |
Post a Message! |
Forgot Password? |
|
||||||||||||||
|
This post is made possible by the generous support of people like you and our sponsors: