libfreeaptx is based on version 0.2.0 of libopenaptx with the intent of continuing under a free license without the additional license restriction added to 0.2.1. The initial version of libfreeaptx was reset to 0.1.0 to prevent confusion between the two projects.
This is Open Source implementation of Audio Processing Technology codec (aptX) derived from ffmpeg 4.0 project and licensed under LGPLv2.1+. This codec is mainly used in Bluetooth A2DP profile.
It provides dynamic linked shared library libfreeaptx.so and simple command line utilities freeaptxenc and freeaptxdec for encoding and decoding operations. Documentation for shared library is provided in C header file freeaptx.h.
There is support for aptX and aptX HD codec variants. Both variants operates on a raw 24 bit signed stereo audio samples. aptX provides fixed compress ratio 6:1 and aptX HD fixed compress ratio 4:1.
For building and installing into system simply run: make install. For building without installing run: LD_RUN_PATH='$ORIGIN' make. For producing windows builds run: make SOFILENAME=freeaptx0.dll.
It is suggested to compile library with -O3 optimizations (enabled by default when env variable CFLAGS is not set) and -mavx2 switch (not enabled by default, needs CPU with AVX2: Intel Haswell or AMD Excavator) as it provides significant boost to the performance.
Usage of command line utilities together with sox for resampling or playing:
To convert Wave audio file sample.wav into aptX audio file sample.aptx run:
$ sox sample.wav -t raw -r 44.1k -L -e s -b 24 -c 2 - | freeaptxenc > sample.aptx
To convert aptX audio file sample.aptx into Wave audio file sample.wav run:
$ freeaptxdec < sample.aptx | sox -t raw -r 44.1k -L -e s -b 24 -c 2 - sample.wav
To convert MP3 audio file sample.mp3 into aptX HD audio file sample.aptxhd run:
$ sox sample.mp3 -t raw -r 44.1k -L -e s -b 24 -c 2 - | freeaptxenc --hd > sample.aptxhd
To play aptX HD audio file sample.aptxhd run:
$ freeaptxdec --hd < sample.aptxhd | play -t raw -r 44.1k -L -e s -b 24 -c 2 -