You are here

Monkey's Audio

Monkey's Audio is a lossless audio compression algorithm. The codec uses the ".APE" file extension, so if you come across them, you'll know what to do.

I've found that xAct is the best GUI app for these files. But if you're looking for command-line tools, your best bet is at Sourceforge.

I had been using version 3.97 successfully until I received an "Error: 1002" while attempting to decompress an ape file. Googling turned up the following on the Monkey's Audio forum:

Errorcodes for mac 3.97 (not sure but 3.98 should be the same):

1000=I/O read error
1001=I/O write error
1002=invalid input file
1003=invalid output file
1004=input file too Large
1005=input file unsupported bit depth
1006=input file unsupported sample rate
1007=input file channel count
1008=input file too small
1009=invalid checksum
1010=decompressing frame
1011=initializing unmac
1012=invalid function parameter
1013=unsupported file type
1014=unsupported file version
2000=insufficient memory
3000=loading MAC.dll
3001=loading MACinfo.dll
3002=loading UnMAC.dll
4000=user stopped processing
4001=skipped...
5000=bad parameter
6000=APE compress too much data

After digging a little more, I concluded that the ape file was probably created by a newer version of the codec, so I downloaded version 3.99 from Sourceforge.net (The latest avaialable as of this writing).

I had difficulty compiling this version, and I suspected that it was due to the default configuration of Mac OS X 10.4 to use gcc 4.0.

To set gcc 3.3 as the default compiler on Mac OS X 10.4, run the "gcc_select" script from the Terminal. This script basically creates some symbolic links to point to the appropriate executables and directories for the version you choose. In my case, I issued:

$ sudo gcc_select 3.3

It has to be run as root or with the -root command-line option since it creates files in read-only directories under /usr. For help, use:

$ gcc_select -h

This solved the comple errors I was receiving, but then the make process complained about a space in the directory I was building from a directory named "Monkey's Audio (APE)" (not the best choice for compiling source). The spaces and apostrophe where screwing up the compile, so I renamed the path to monkeys_audio_ape and started the process over.

$ ./configure
$ make clean
$ make
$ sudo make install

This time it worked. The install process created several libraries and include files along with the executable /usr/bin/mac.

And the verdict? I'm still getting "Error: 1002" messages. Rats. Running:

$ mac -v file.ape

Generates the message "Input File Not Found..."

Somewhere I found mention of permissions as a cause for the error (this was actually the first thing I checked). After double-checking, I confirmed this was not the problem. So I decided to take a look at the file itself in HexEdit. Turns out it's not a valid audio file. I might fault the application for the inaccurate error reporting, but I did discover (as shown above) the meaning of the error code, so I have only myself to blame. Trying it on a valid ape file proved successful.