Thursday, October 08, 2015

 

MQn setup

MQn sounds great, but it's a little tricky to setup, the instructions (at least as of now) are incomplete.  So I decided to add a blog post to help others set it up.

Note that I'm using a Haswell based Xeon CPU, a E3-1225 V3.
I'm not sure if MQn works with a non haswell based CPU now.

OS is Windows Server 2012 R2.


EDIT Jan 26, 2016 (sounds really good):
Blog updated to install mqn from the zip file.
I have not tried mqnrewrite yet, so no instructions for that yet.  I do have a section for it at the end, with information supplied in the mqn thread.


Here is the blog for MQn
Official mqnplayer blog


Go here to get the files
MQn files


A google drive window should open, select the Main directory folder

Download mqnfiles.zip from Main.

As of Jan 26,2016, it contains the following files:


On your music PC, create a directory called C:\musicplayer

Unzip the files into the musicplayer directory.

rename
mqncontrol.exe haswell v99 (or whatever version it is) to mqncontrol.exe
mqnloader.exe haswell v84 (or whatever version it is) to mqnloader.exe
mqnplay.exe haswell w2012 r2 v224 (or whatever version it is) to mqnplay.exe*

notes:
*   If you are using Windows 10, use mqnplay.exe win 10 v224.


Double click on setupmqnparam
It will create mqnparam.txt.  If you open mqnparam.txt, it should look similar to this (but only two lines):
\\?\usb#vid_1852&pid_7022&mi_01#6&851d114&0&0001#{6994ad04-93ef-11d0-a3cc-00a0c9223196}\global
0

Now, you're ready to play wav files.  Go to a wav file, select it, right click and then select copy

And then go double click on the MQn.bat file.  A screen should pop up with the name of the wav file you selected, and it should play music.

At some point, I couldn't use some versions of MQn, they wouldn't play.
I broke my MQn, and it took a little while to recover.  So I'd recommend, as soon as you get a working setup, copy all the files to a backup directory, to save the configuration.  The files are small, and space is cheap now.

And you can try the different play and control.exe's to see what you like best.
But periodically backup your backup you working directory, so you can recover if things stop working.


Playing FLAC files
EDIT:  I figured out how to play FLAC files.
You need to download, and install SOX.  I used
sox 14.4.1 files

I used sox 14.4.1a-win32.exe
Just run this program, and let it install sox

I read online that the 1a fixes a problem where they forgot to enable flac.  I started with 1, and it didn't work, but 1a works fine.  It's not the latest version, but works so I'm using it.



I then tried the mqnflac batch file, but it didn't work.
I made some changes to it, to make it more closely match the mqn batch file, and got it to work.
You can get the new batch file from the directory below.
shared directory with new file

If you install sox, and change the mqn.bat file to the one in my shared directory, you should be able to play flac files.

It is also included below:
@echo off

cd c:\musicplayer

Title MQn - Just good music 

rem stop other instances of program if they are currently playing
taskkill /fi "PID gt 0" /IM mqnplay.exe /F >nul
taskkill /fi "PID gt 0" /IM mqnloader.exe /F >nul

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

rem  delete old file
del Files.txt /q

rem  changing pag
FOR /F "tokens=*" %%A IN ('CHCP') DO FOR %%B IN (%%~A) DO SET CodePage=%%B

rem chcp 65001 

rem paste from clipboard to param file
paste > param.txt

rem following converts flac file to wav, in the musicplayer directory

rem  first delete any wav files in musicplayer dir

del *.wav /q

rem  If a single file only, convert it from flac to wav using sox
for /F "usebackq delims==" %%i IN (`sort param.txt ^| FIND ".flac"`) do "C:\Program Files (x86)\sox-14-4-1\sox.exe" "%%i" "%CD%\%%~ni.wav" && echo %%~ni.wav >> File1.txt 

if exist File1.txt goto :wav

rem if a flac folder, convert contents of folder to wav files in musicplayer dir

for /F "usebackq delims==" %%i IN (`sort param.txt`) DO for /f "delims=" %%f in ('dir /b "%%i\*.flac"') do "C:\Program Files (x86)\sox-14-4-1\sox.exe" "%%i\%%f" "%CD%\%%~nf.wav" && echo %%~nf.wav >> File1.txt

if exist File1.txt goto :wav

rem for a wav file

for /F "usebackq delims==" %%i IN (`sort param.txt ^| FIND /I ".wav"`) do echo %%i >> File1.txt

if exist file1.txt goto :wav

rem for a wav folder

for /F "usebackq delims==" %%i IN (`sort param.txt`) DO for /f "delims=" %%f in ('dir /b "%%i\*.wav"') do echo %%i\%%f >> Files1.txt


:wav


rem remove cr/lf from last line


setlocal DisableDelayedExpansion

set "firstLineReady="
(
    for /F "eol=$ delims=" %%a in (File1.txt) DO (
        if defined firstLineReady (echo()
        set "firstLineReady=1"
       
    )
) > Files.txt"

del File1.txt /q


rem CHCP %CodePage% 

cls

set TIMESTAMP=%TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2%

echo Playback commenced - %timestamp%
echo.
for /F "usebackq delims==" %%i IN (`sort Files.txt`) do echo %%~ni

echo.

rem lets play music

MQncontrol --file ".\Files.txt"


exit

@echo on





Foobar
The two problems with mqn is getting it to work, and the user interface.
Hopefully this blog will with the first one.  For the 2nd one, MQn will work with foobar, so if you're ok with foobar, the UI problem is solved

First off, get MQn working with flac files per the instructions above.  Then if you don't already use foobar, install it, and get foobar working.
For some reason, if I used MQn, I need to reset my PC before foobar will work.

After foobar works, install scheduler and run command.
Here is where I downloaded the zip files from.  Just click on download under links
foobar scheduler
foobar run cmd

Download the zip files.  I usually install through foobar.
Click on File, Preferences, Components
Click on Install button in lower left corner

If you did default download, go to download directory, double click on the
foo_runcmd-1.1-20100107.zip

Click on Apply and let foobar restart

Repeat this for
foo_scheduler.zip


Now click on File, Scheduler, Preferences,




Click the Add in the middle by Action lists


Type playmqn, and you should get this


Right click playmqn, "Add Action" then "Stop playback"

This reason for this step is kind of self explanatory.  It tells foobar not to play the song. So foobar doesn't think its really playing a song.



Right click playmqn, "Add Action" then "Launch application", then type
C:\Program Files (x86)\foobar2000\foobar2000.exe /runcmd-playlist=Copy

The start of this (C:\Program Files (x86)\foobar2000\) needs to point to where your foobar2000.exe file is

This step copies whatever is in the playlist to the clipboard. It is equivalent to when you right click on a song file, and then select copy.
BTW, I think this step is why remote control software like monkeymote is not working correctly, but I can't figure out what to change to make it work.









Right click playmqn, "Add Action" then "Launch application",
then type C:\musicplayer\MQnload.exe

This needs to point to where MQnload.exe is
NOTE: the "official" instructions use MQn.bat here, but since I'm using MQnload to play flac files, I point to MQnload instead.

If you want to used MQn.bat,
instead of C:\musicplayer\MQnload.exe
type C:\musicplayer\MQn.bat
Pointing to where MQn.bat is located.

So, the last line in the action lists window in the screenshot below for playmqn will say
Launch "C:\musicplayer\MQn.bat" instead of  Launch "C:\musicplayer\MQnload.exe"
after you're done.

This is the step that actually calls MQnload.exe, or MQn.bat to play a song.  As an aside, this really can be anything, if you wanted to use another player instead of MQn.

new note:  Since I first did this, I was able to make mqn.bat work for playing flac files, so I changed it to mqn.bat, and it works fine.





Click on Apply in bottom right
Click on the top Add, by Event, then Add Player Event
Choose On playback start (re-enable event), then OK





Right click on that, select Assign action list, then select playmqn




click apply again
Scheduler enabled box should be checked
Click preferences, playback, output set the device to null output




Click on preferences, media library, album list then tick the start playback when sending selection to playlist option


Click on preferences, shell integration then tick the always send new files to playlist Default option


Now you can use foobar as you normally would to play music


I'm trying to get remote software working with this, so I can control foobar with either a ipad or my android phone.
So far, not working correctly.  I've tried monkeymote (ipad) foobar2000 controller (android) and foobarcon (android).

MQnstop batch file

The mqnstop file didn't work for my until I added these two lines to it
taskkill /fi "PID gt 0" /IM mqnplay.exe /F >nul
taskkill /fi "PID gt 0" /IM mqncontrol.exe /F >nul

I added them to the end, but it probably doesn't matter where they are


mqnload
This is a utility written  by someone else, that makes mqn more usable.

Download it from here
mqnload

get the zip file. Unzip the files into the musicplayer directory.
Read the txt file for instructions, but you can just double click on it, and run it.


First time will take you to a setup screen.  You can either select a different MQnControl and MQnPlay file to use, or if you leave it on "none", the ones you have been using will be used.
This makes it easy to try other versions, you just copy the files into the musicplayer directory, and you don't need to change the extension.
And if you want to get to the setup screen later, just push ALT+space.  Thats the default hot key to get to the mqnload setup screen.

But the real reason I like mqnload is that it makes it easier to select a song.  Just select a song, right click, select "MQn", and it calls MQn and starts playing the song.  Or select a song and push F9 (default hot key to play a song), and the song will play.  If you select a directory, all songs in the directory will play.

And you can setup to play flac files.  The readme tells you how.  You just have to download the flac file,










Download: http://www.rarewares.org/lossless.phpChoose: FLAC v.1.3.0 win32 bundle OR FLAC v.1.3.0 win64 bundle

I used win64 for Server 2012 r2
Copy it the musicplayer/data directory, and now you can play flacs.


Since I was able to make the flac batch file work, I have stopped using mqnload, and deleted it.  I never noticed a difference in sound, but the method below appears to be less obtrusive, so I figured it would be better.




MQN rewrite
uploaded mqnrewrite haswell v2

need to create a directory called mqnrewrite and mqnrewrite\out

open a cmd window

cd \
md mqnrewrite
cd mqnrewrite
md out

close the window

copy mqnrewrite.exe to mqnrewrite

copy the track you want to rewrite to mqnrewrite directory
rename it to test.wav
double click on mqnrewrite
wait until process has finished

rewritten test.wav file will be in the out directory

play as usual

I think there is an improvement, not sure whether to incorporate it in mqn or make it standalone. 

would be quite easy to have a batch process to copy/rename/rewrite/rename in a loop

not suitable for copying other types of files because it misses a few bytes off the end



uploaded mqnrewrite.bat

copy it to c:\mqnrewrite

also copy paste.exe to c:\mqnrewrite (it's in the same folder as mqn.bat eg c:\musicplayer or can be downloaded)

then just use it like mqn ie copy files or folder to the clipboard and double click on mqnrewrite.bat

the rewritten files will be in the c:\mqnrewrite\out folder

don't delete your original source files as the rewritten files are a few bytes smaller, I'll fix that sometime.

tried rewriting an already rewritten file and sounds different again. If it's better I'll alter mqnrewrite.bat to rewrite twice, worth a try.

seems to take a bit of edge/treble away, not sure that's a good thing. Some tracks sound better than others.


 @echo off

cd c:\mqnrewrite

Title MQnRewrite - Just good music


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



rem net stop "Desktop Window Manager Session Manager"

del Files.txt /q

FOR /F "tokens=*" %%A IN ('CHCP') DO FOR %%B IN (%%~A) DO SET CodePage=%%B



paste > param.txt

rem echo off

rem file

for /F "usebackq delims==" %%i IN (`sort param.txt ^| FIND /I ".wav"`) do echo %%i >> File1.txt

if exist file1.txt goto :crlf

rem folder

for /F "usebackq delims==" %%i IN (`sort param.txt`) DO for /f "delims=" %%f in ('dir /b "%%i\*.wav"') do echo %%i\%%f >> File1.txt

:crlf

rem remove cr/lf from last line


setlocal DisableDelayedExpansion

set "firstLineReady="
(
    for /F "eol=$ delims=" %%a in (File1.txt) DO (
        if defined firstLineReady (echo()
        set "firstLineReady=1"
            )
) > Files.txt"

del File1.txt /q


echo files to rewrite


for /F "usebackq delims==" %%i IN (`sort Files.txt`) do echo %%~ni



echo starting rewrite


for /F "usebackq delims==" %%i IN (`sort Files.txt`) do (echo %%~ni & copy "%%i" c:\mqnrewrite\test.wav & start /wait mqnrewrite & ren c:\mqnrewrite\out\test.wav "%%~ni%%~xi")

echo rewrite complete

pause
@echo on

exit






Comments:
Very helpful.
Is it mqndevinfo, rather than mqndeviceinfo? Aanyway it crashes on my laptop.
Do you know any other way to get this info, which is presumably an internal link to a driver? Does it need Haswell or later, and are there earlier versions of it for non-haswell? Thanks.
 
It needs to be Haswell or later, from what I understand.
 
I have seen posts recently where guys with non haswell pc's are using the newest version of MQN.
 
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?