Pages

Sunday, March 24, 2013

Converting mpc to wav

Today I was confronted with some mpc files which I needed to convert into wav files. There is a tool called mpcdec but it has to be compiled first. I have tested the following instruction successfully on my Slackware 14 machine (64bit).
To start create a directory where you can store the sources and change into it: 

# mkdir -p /usr/src/mpc
# cd /usr/src/mpc


Then check out the sources:

# svn export http://svn.musepack.net/libcuefile libcuefile
...
# svn export http://svn.musepack.net/libreplaygain libreplaygain
...
# svn export http://svn.musepack.net/libmpc/trunk libmpc
...


When all sources are checked out then you can begin to compile them. Start with configuring libcuefile:

# cd /usr/src/mpc/libcuefile/trunk/
# cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=/usr -DLIB_SUFFIX=64
...


Run make to compile and install the sources:

# make
...
# make install
...


The header files must be copied manually:

# cp -r include/cuetools /usr/include

The next library to compile is libreplaygain:

# cd /usr/src/mpc/libreplaygain/
# cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=/usr -DLIB_SUFFIX=64
...
# make
...
# make install


Again, the header files have to be copied manually:

# cp -r include/replaygain /usr/include

Finally compile libmpc. This package contains the library as well as the binary mpcdec to convert mpc files into wav files:

# cd /usr/src/mpc/libmpc/
# cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=/usr
...
# make
...
# make install
...


Check that mpcdec was installed:

# which mpcdec
/usr/bin/mpcdec


When run mpcdec the first time then you might notice the following error:

# mpcdec
mpcdec: error while loading shared libraries: libmpcdec.so: cannot open shared object file: No such file or directory


The issue is that libmpcdec.so is not available on your system:

# ldd /usr/bin/mpcdec
        ...
        libmpcdec.so => not found
        ...


OK, it is available but it was not installed by make before. Just copy libmpcdec.so manually and run ldd again:

# cp /usr/src/mpc/libmpc/libmpcdec/libmpcdec.so /usr/lib64/
# ldd /usr/bin/mpcdec
        ...
        libmpcdec.so => /usr/lib64/libmpcdec.so (0x00007ff7478f9000)
        ...


Finally you can convert a mpc file into a wav file:

# mpcdec track-01.mpc track-01.wav
mpcdec - Musepack (MPC) decoder v1.0.0 (C) 2006-2009 MDT
Built Mar 24 2013 14:48:34
1978620 samples decoded in 70 ms (640.95x)


Links:

http://trac.musepack.net/wiki/SV8Build

No comments:

Post a Comment