Arduino (and CMake) packaging of FAAC, the Freeware Advanced Audio Coder: an AAC-LC / HE-AAC v1 encoder that emits ADTS or raw AAC.
| Path | Content |
|---|---|
original/faac |
upstream git checkout (not compiled) |
src/ |
generated by create_arduino_lib.py – do not edit |
examples/encode-sine |
Arduino sketch |
examples/cmake/adts_encode.c |
desktop example, extracted from docs/libfaac.md |
git -C original/faac pull
python3 create_arduino_lib.pyThe script copies include/faac.h and libfaac/ into src/, generates
src/libfaac/faac_config.h (replaces the meson config.h) and adds an include of it to each .c file,
because Arduino cannot force-include headers.
Define these before compiling (e.g. via build_opt.h or -D...) to override the defaults:
| Define | Default | Description |
|---|---|---|
MAX_CHANNELS |
2 on Arduino, 8 otherwise | Maximum number of channels (1-8) |
FAAC_SBR_DECIMATION |
1 | SBR analysis density (1 = full quality, up to 8 = faster) |
FAAC_STATS |
undefined | Print end-of-encode statistics to stderr |
For Arduino, you can download the library as zip and call include Library -> zip library. Or you can git clone this project into the Arduino libraries folder e.g. with
cd ~/Documents/Arduino/libraries
git clone https://github.com/pschatzmann/codec-faac.git
This project can also be built and executed on your desktop with cmake:
cd codec-faac
mkdir build
cd build
cmake ..
make
This builds the faac library and the adts_encode example, which reads 16 bit stereo PCM at 48000 Hz from stdin and writes ADTS to stdout:
ffmpeg -f lavfi -i "sine=frequency=1000:duration=3" -ac 2 -ar 48000 -f s16le - | ./adts_encode > test.aac
CMake options: FAAC_MAX_CHANNELS, FAAC_SBR_DECIMATION, FAAC_STATS, FAAC_SSE2, FAAC_BUILD_EXAMPLES.
Use it from another project with add_subdirectory(codec-faac) and link against faac.
The directory can also be used as an ESP-IDF component.
See docs/libfaac.md.
LGPL 2.1 or later – see COPYING. The use of AAC may require patent royalties.