Jump to content
IGNORED

Visual studio 2012 c++ and wasapi minimalist player


sbgk

Recommended Posts

EXCLUSIVE: on EVENT DRIVEN: on

-------------------------------------------------------------------------

44100 16 2 176400 4 1 0 - Format works ok

44100 16 2 176400 4 65534 22 16 3 - Format works ok

44100 24 2 264600 6 65534 22 24 3 - Format works ok

44100 16 4 352800 8 65534 22 16 51 - Format works ok

44100 24 4 529200 12 65534 22 24 51 - Format works ok

44100 16 6 529200 12 65534 22 16 1551 - Format works ok

44100 24 6 793800 18 65534 22 24 1551 - Format works ok

44100 16 8 705600 16 65534 22 16 1599 - Format works ok

44100 24 8 1058400 24 65534 22 24 1599 - Format works ok

48000 16 2 192000 4 1 0 - Format works ok

48000 16 2 192000 4 65534 22 16 3 - Format works ok

48000 24 2 288000 6 65534 22 24 3 - Format works ok

48000 16 4 384000 8 65534 22 16 51 - Format works ok

48000 24 4 576000 12 65534 22 24 51 - Format works ok

48000 16 6 576000 12 65534 22 16 1551 - Format works ok

48000 24 6 864000 18 65534 22 24 1551 - Format works ok

48000 16 8 768000 16 65534 22 16 1599 - Format works ok

48000 24 8 1152000 24 65534 22 24 1599 - Format works ok

96000 16 2 384000 4 1 0 - Format works ok

96000 16 2 384000 4 65534 22 16 3 - Format works ok

96000 24 2 576000 6 65534 22 24 3 - Format works ok

96000 16 4 768000 8 65534 22 16 51 - Format works ok

96000 24 4 1152000 12 65534 22 24 51 - Format works ok

96000 16 6 1152000 12 65534 22 16 1551 - Format works ok

96000 24 6 1728000 18 65534 22 24 1551 - Format works ok

96000 16 8 1536000 16 65534 22 16 1599 - Format works ok

96000 24 8 2304000 24 65534 22 24 1599 - Format works ok

192000 16 2 768000 4 1 0 - Format works ok

192000 16 2 768000 4 65534 22 16 3 - Format works ok

192000 24 2 1152000 6 65534 22 24 3 - Format works ok

192000 16 4 1536000 8 65534 22 16 51 - Format works ok

192000 24 4 2304000 12 65534 22 24 51 - Format works ok

192000 16 6 2304000 12 65534 22 16 1551 - Format works ok

192000 24 6 3456000 18 65534 22 24 1551 - Format works ok

192000 16 8 3072000 16 65534 22 16 1599 - Format works ok

192000 24 8 4608000 24 65534 22 24 1599 - Format works ok

looks like you have a 24 in 24 dac, which I am working on a solution for.

There is no harm in doubt and skepticism, for it is through these that new discoveries are made. Richard P Feynman

 

http://mqnplayer.blogspot.co.uk/

Link to comment
not my area of knowledge, but generally I have found lower frequencies sound better. I know higher frequencies and smaller buffers can make it seem like you are hearing more detail.

 

Actually, the creator of XA said buffers size is much more important to be in syn with the clock rate in the registry (than the size itself):

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Audio

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Pro Audio

e.g. if you DAC has buffer size 640samples, and you play music in 44100, 640/44100=0.014512, then he said you should set clock rate at 14512 or 14512*(any multiple) instead of the default value at 10000. He set his at 85075. He said 85074, or 85076 are both not as good. I tried the method, it works for me, seems like magic to me... If you could explain to me, that would be great.

Link to comment
Digital sounding? That's strange. Did you apply his ASIO4ALL mod? And he said you need to set the buffers exactly as he said. Also, were you using the foobar2000.exe inside the 'foobar2000 XA wav' folder? actually there are a lot to setup with his player...

 

i don't get it either. but it works. i am pretty sure it is for 44/24.

 

i am loving MQn!! it is just annoying i have to restart the PC to compare XA with MQn because XA requires affinity untouched... if i have to complain about MQn, there is nothing really, perhaps it is a bit strong for my ears. it is certainly the best player on my loud speakers!

Link to comment
i don't get it either. but it works. i am pretty sure it is for 44/24.

 

i am loving MQn!! it is just annoying i have to restart the PC to compare XA with MQn because XA requires affinity untouched... if i have to complain about MQn, there is nothing really, perhaps it is a bit strong for my ears. it is certainly the best player on my loud speakers!

MQn resets the affinities when you press x in MQn control, so you shouldn't need to restart the pc

There is no harm in doubt and skepticism, for it is through these that new discoveries are made. Richard P Feynman

 

http://mqnplayer.blogspot.co.uk/

Link to comment
Actually, the creator of XA said buffers size is much more important to be in syn with the clock rate in the registry (than the size itself):

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Audio

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Pro Audio

e.g. if you DAC has buffer size 640samples, and you play music in 44100, 640/44100=0.014512, then he said you should set clock rate at 14512 or 14512*(any multiple) instead of the default value at 10000. He set his at 85075. He said 85074, or 85076 are both not as good. I tried the method, it works for me, seems like magic to me... If you could explain to me, that would be great.

Interesting, I have always found the default to sound best ie 10000, shall try the other values. MQn would need to update the registry for each format.

There is no harm in doubt and skepticism, for it is through these that new discoveries are made. Richard P Feynman

 

http://mqnplayer.blogspot.co.uk/

Link to comment
MQn resets the affinities when you press x in MQn control, so you shouldn't need to restart the pc

 

pressing 'x' doesn't work for me somehow. i just kill the mqnplay.exe process in task manager. even though i see no mqnplay.exe nor mqncontrol.exe in the task manager, somehow whenever i start application, its affinity is changed. don't know what's going...as long as it is good SQ i use MQn.

Link to comment
pressing 'x' doesn't work for me somehow. i just kill the mqnplay.exe process in task manager. even though i see no mqnplay.exe nor mqncontrol.exe in the task manager, somehow whenever i start application, its affinity is changed. don't know what's going...as long as it is good SQ i use MQn.

Probably need to click into the mqn console and press x

Mqn control changes the affinities

There is no harm in doubt and skepticism, for it is through these that new discoveries are made. Richard P Feynman

 

http://mqnplayer.blogspot.co.uk/

Link to comment
I don't have a hand built machine, just use an i3 laptop, (wifi and lan disabled), I use ws2012 with high performance power plan to get no core parking and set the max/min processor frequency to 0%, so it appears I am underclocking the cpu, if it at 100% I can detect a digital sound, can't adjust the voltages. Was speaking to someone who optimised music pcs and he was using "i7 2600k in a asus p8z77m with 16gb ram the processor is under clocked to 1.6ghz and the ram to 800mhz not sure why but sounds better that way" also read an intel article that recommended ram frequency to be half the cpu frequency.

 

You are right! ram clocks at 800Mhz does sound MUCH better! Provided that CPU clocks at 1.6Ghz, 2.4Ghz, 3.2Ghz or 4Ghz. CPU doesn't have to be 1.6Ghz! The ram timing do have to be perfect though.

Link to comment
You are right! ram clocks at 800Mhz does sound MUCH better! Provided that CPU clocks at 1.6Ghz, 2.4Ghz, 3.2Ghz or 4Ghz. CPU doesn't have to be 1.6Ghz! The ram timing do have to be perfect though.

 

found some code references which affected the sound and applied 3 more tweaks, have uploaded mqnplay.exe 2.11 sse4 intel, initial testing shows it has amazing levels of detail.

There is no harm in doubt and skepticism, for it is through these that new discoveries are made. Richard P Feynman

 

http://mqnplayer.blogspot.co.uk/

Link to comment
found some code references which affected the sound and applied 3 more tweaks, have uploaded mqnplay.exe 2.11 sse4 intel, initial testing shows it has amazing levels of detail.

 

plenty of detail, but lack of bass, have uploaded 2.12 which corrects the bass issue

There is no harm in doubt and skepticism, for it is through these that new discoveries are made. Richard P Feynman

 

http://mqnplayer.blogspot.co.uk/

Link to comment
Actually, the creator of XA said buffers size is much more important to be in syn with the clock rate in the registry (than the size itself):

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Audio

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Multimedia\SystemProfile\Tasks\Pro Audio

e.g. if you DAC has buffer size 640samples, and you play music in 44100, 640/44100=0.014512, then he said you should set clock rate at 14512 or 14512*(any multiple) instead of the default value at 10000. He set his at 85075. He said 85074, or 85076 are both not as good. I tried the method, it works for me, seems like magic to me... If you could explain to me, that would be great.

mqn uses 2048 for 16 bit and 1024 for 24 bit, tried 23219 and 46439 for 16/44100, there is definitely an effect - music sounds more stable, 46439 is a richer sound than 23219 and 23219 has more detail.

There is no harm in doubt and skepticism, for it is through these that new discoveries are made. Richard P Feynman

 

http://mqnplayer.blogspot.co.uk/

Link to comment
mqn uses 2048 for 16 bit and 1024 for 24 bit, tried 23219 and 46439 for 16/44100, there is definitely an effect - music sounds more stable, 46439 is a richer sound than 23219 and 23219 has more detail.

 

i believe 1024/44100=0.02321995 should be rounded to 23220. if 23220 is the correct value, then 23219 should sound a bit wrong like being too bright, and 23221 would sound a bit messy.

 

in the control panel, i have set the sound to 24/44100, does this mean MQn will play a 16bits music file as 24?

Link to comment
i believe 1024/44100=0.02321995 should be rounded to 23220. if 23220 is the correct value, then 23219 should sound a bit wrong like being too bright, and 23221 would sound a bit messy.

 

in the control panel, i have set the sound to 24/44100, does this mean MQn will play a 16bits music file as 24?

 

in fact, this method works the same way on RAM timing, as i told you before. given whatever ram frequency- 800, 1600, 2000 etc, the timing should be

 

a-b-c-d-e where d=(b+c)*0.5*multiple and d must be exact number.

 

e.g. many ram are rated at 9-9-9-24. using the formula, e.g. d=(9+9)*0.5*3=27 actually sounds better than the default timing. for my Consair ram, multiple=5 works best for all frequencies. for my ram, if d is the correct value, d-1 will lose details and d+1 will sound messy. you said that 800mhz is the best frequency, i agree! and 800mhz needs a correct timing to sound at its best.

Link to comment
in fact, this method works the same way on RAM timing, as i told you before. given whatever ram frequency- 800, 1600, 2000 etc, the timing should be

 

a-b-c-d-e where d=(b+c)*0.5*multiple and d must be exact number.

 

e.g. many ram are rated at 9-9-9-24. using the formula, e.g. d=(9+9)*0.5*3=27 actually sounds better than the default timing. for my Consair ram, multiple=5 works best for all frequencies. for my ram, if d is the correct value, d-1 will lose details and d+1 will sound messy. you said that 800mhz is the best frequency, i agree! and 800mhz needs a correct timing to sound at its best.

 

this is new to me, what does 27 mean, what do you change to set the timing ?

 

with ram and cpu frequencies you are trying to optimise the relationship between cpu cycles and ram cycles and the fact it takes several cpu cycles to read from ram.

 

with mmcss you are trying to get a time slice that aligns with the buffer size.

 

the calculation is actually 44100/1024 = 43.06640625 ie 43 buffers need to be filled a second so take reciprocal of that and you get 0.0232199 which = 23219 hundred nanoseconds ie each buffer should take 23219 hundred nanoseconds. Not sure if no of channels should be used ie 2 * 44100/1024 = 11609, the bytes per second calc is 2 * 44100 * 16/8

 

with ram I believe it is more complicated because different banks of ram may perform differently to each other even though they are identical specs. So the player should calibrate the ram performance and then choose banks that are a match.

 

in your initial post about mmcss you said to adjust audio and pro audio profiles, MQn just uses pro audio, does the audio profile need adjusted as well ?

 

 

re your question about 24/44100 setting, no those settings won't change anything because mqn uses wasapi exclusive so the conversion is bypassed.

There is no harm in doubt and skepticism, for it is through these that new discoveries are made. Richard P Feynman

 

http://mqnplayer.blogspot.co.uk/

Link to comment
this is new to me, what does 27 mean, what do you change to set the timing ?

 

with ram and cpu frequencies you are trying to optimise the relationship between cpu cycles and ram cycles and the fact it takes several cpu cycles to read from ram.

 

with mmcss you are trying to get a time slice that aligns with the buffer size.

 

the calculation is actually 44100/1024 = 43.06640625 ie 43 buffers need to be filled a second so take reciprocal of that and you get 0.0232199 which = 23219 hundred nanoseconds ie each buffer should take 23219 hundred nanoseconds. Not sure if no of channels should be used ie 2 * 44100/1024 = 11609, the bytes per second calc is 2 * 44100 * 16/8

 

with ram I believe it is more complicated because different banks of ram may perform differently to each other even though they are identical specs. So the player should calibrate the ram performance and then choose banks that are a match.

 

in your initial post about mmcss you said to adjust audio and pro audio profiles, MQn just uses pro audio, does the audio profile need adjusted as well ?

 

 

re your question about 24/44100 setting, no those settings won't change anything because mqn uses wasapi exclusive so the conversion is bypassed.

 

according to XA's blog, you need to change both clock rates of pro audio and audio.

 

i tried 23219 with MQn but it just sounded bright to me. 23220 sounds good to me. XA's creator used the same calculation like you and derived a clockrate=87074 for 640buffers, and he rounded it to 87075 because he said it sounded better.

in fact, given this clock rate, i am positive that MQn 2.13 sounds even more amazing because i am actually using it on headphone not just on loud speakers.

 

as for ram timing, just go to bios and change that timing 'd', and see if it works.... if it doesn't, change back... a while ago i was deeply into ram overclock, and wondered why every d sounded different and every frequency sounded different... given CPU=4Ghz, for my ram, 800Mhz sounds the best(if you didn't inspire me, i wouldn't have tried, who is crazy enough to underclock for less performance), 1600 sounds fine, 1800 sounds bright, 2000 sounds bright+soar, 2400 sounds soar+bright+messy. from my experience, ram timing doesn't change the sound signature of each frequency, it just makes SQ more/less stable more/less correct.

 

you ask me why, i have no idea why... i went bottom-up, like a scientific experiment. i did test a wide range of values in the bios, so, i am positive with the result.

 

Link to comment
just wondering, if buffer=441, 44100/441=1000 exactly, no time will be wasted in filling buffers! is that pushing too much?
44100/441 = 100. MQn is based around page size of 4k so everything is either 4k or 8k Bytes which equates to 1024 or 2048 samples. Wasapi needs a buffer size which is 128 Byte aligned etc. Have uploaded the latest Mqnplay.exe 2.14 sse4 intel, this after an evening spent browsing agner fog's assembly optimisation guide Optimizing subroutines in assembly language: An optimization guide for x86 platforms Software optimization resources. C++ and assembly. Windows, Linux, BSD, Mac OS X, getting near the end.

There is no harm in doubt and skepticism, for it is through these that new discoveries are made. Richard P Feynman

 

http://mqnplayer.blogspot.co.uk/

Link to comment

Uploaded mqnplay.exe 2.15 sse4 intel, the final version for now as far as SQ goes. It has improved quite a bit over the last week and is pretty much the best thing I have heard on my system, a very live irrepressible sound if you are playing live music. Don't blame me if you stay up all night rediscovering your music collection. RapidShare ? Secure Data Logistics Shall build the other versions at the weekend.

There is no harm in doubt and skepticism, for it is through these that new discoveries are made. Richard P Feynman

 

http://mqnplayer.blogspot.co.uk/

Link to comment

Before yesterday, testing the MQn was a mix of surprise and frustration, all 3 versions of x[1].10 sse4 intel and both mqncontrol versions (with and without affinity) were run under x64 of Win8 pro and ws2012, with and without system optimization. It was easier today with the newer 2[1].15 sse4 intel. The machine consists of i7 3770 and 8Gb ram.

Correct me if I'm wrong. All 4 essential files were placed together under c:\mqnplayer and renamed as :

MQn.batc2.0 => MQn.bat

mqnplay.exe 2[1].10 sse4 intel => mqnplay.exe

mqncontrol.exe (no change)

paste.exe (no change)

Most of the time, the command window (console ?) just flashed and then disappeared. 2 text files were generated with path\filenames pasted onto it, contents were same. No playback.

But when the console did appear and play, the SQ was surprisingly clean and dimensional.

MQnStop.batbak (renamed as MQnStop.bat) had once been added but does not seem helpful.

taskkill /fi "PID gt 0" /IM mqn.exe /F >nul Could this mqn.exe refer to an earlier version ?

One persistent behaviour was that in the optimized WS2012, the MQn generated "Files.txt" was blank while the "Param.txt" contains the track names.

Process seemed to have worked differently inside MQn.bat under optimized OS.

That led me to make my own Trackcopy.bat

@echo off

cd c:\mqnplayer

taskkill /fi "PID gt 0" /IM mqnplay.exe /F >nul

del Files.txt /q

paste > Files.txt

edited this "Files.txt" and manually deleted the last carriage return;

finally ran a simplified MQn.bat like this :

@echo off

cd c:\mqnplayer

rem Title MQn - Just good music

rem taskkill /fi "PID gt 0" /IM mqnplay.exe /F >nul

rem net stop "Desktop Window Manager Session Manager"

MQncontrol --file ".\Files.txt"

rem pause

exit

@echo on

No. of successful plays increased.

At the end of the day, discovered that track names with double byte characters might be the cause of the problem.

Under optimized WS2012, for filenames with non double byte characters, Trackcopy.bat + simplified MQn.bat works.

MQn.bat still does'nt work - the console just flash and disappear.

Link to comment
Before yesterday, testing the MQn was a mix of surprise and frustration, all 3 versions of x[1].10 sse4 intel and both mqncontrol versions (with and without affinity) were run under x64 of Win8 pro and ws2012, with and without system optimization. It was easier today with the newer 2[1].15 sse4 intel. The machine consists of i7 3770 and 8Gb ram.

 

MQn.bat still does'nt work - the console just flash and disappear.

you seem to have a grasp on how things work, you are right about mqnstop.bat. mqn doesn't play files with Unicode chars in the path/filename, (shall fix it eventually). surprised mqn.bat doesn't work for you at all. you could try to rem the @echo off at the start and un rem the pause at the end and post the output. am thinking 2.15 is just a bit too bright, sometimes, mainly when the system has just been switched on, after 30 mins the sound has warmed up.

There is no harm in doubt and skepticism, for it is through these that new discoveries are made. Richard P Feynman

 

http://mqnplayer.blogspot.co.uk/

Link to comment

the 2.15 sse4 intel was just too bright in my system so have uploaded 2.15 v2 sse4 intel which maybe has a better balance. It just differs by 1 instruction in my tuned version of memcpy that is run once per call, but that is enough to give the difference in sound. 2.15 has sub al,-64 and 2.15 v2 has mov al, 64 - just resetting the counter for the second loop.

There is no harm in doubt and skepticism, for it is through these that new discoveries are made. Richard P Feynman

 

http://mqnplayer.blogspot.co.uk/

Link to comment
the 2.15 sse4 intel was just too bright in my system so have uploaded 2.15 v2 sse4 intel which maybe has a better balance. It just differs by 1 instruction in my tuned version of memcpy that is run once per call, but that is enough to give the difference in sound. 2.15 has sub al,-64 and 2.15 v2 has mov al, 64 - just resetting the counter for the second loop.
uploaded a version mqnplay.exe 2.15 oword 512 that has thunderous bass if anyone is interested, again just one instruction changed that is used once per call.

There is no harm in doubt and skepticism, for it is through these that new discoveries are made. Richard P Feynman

 

http://mqnplayer.blogspot.co.uk/

Link to comment
sbgk,

 

Would you be kind enough to summarize what needs to be downloaded in order to sample your player? I'd love to try it but can't figure out what's what from your page/folder. Thanks.

there is a readme file so best to start there. The required files are paste.exe, mqn.bat, mqncontrol.exe and mqnplay.exe, just put them all in the same directory eg c:\mqnplayer and then change the directory in the first few lines of mqn.bat to that directory. mqnplay.exe 2.15 v2 is the latest one, but may not work with your dac so try the 1.10 or 3.10 versions, if sse4 doesn't work then the sse2 version should, you can check your cpu via cpuz or google. The controls apart from x don't work at the moment. MQncontrol.exe sets everything on core 0 apart from mqnplay.exe (reverts back if closed down using x), the no affinity version doesn't.

There is no harm in doubt and skepticism, for it is through these that new discoveries are made. Richard P Feynman

 

http://mqnplayer.blogspot.co.uk/

Link to comment

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

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...