English | Simplified Chinese
CherryAVP is a tiny and beautiful, low-memory and high-performance audio and video processing library designed for MCUs.
- Most chip companies use open‑source libraries, but they do not open‑source their own modifications or additions. I don't understand this—it's just like toolchain vendors who keep their DSP instructions proprietary.
- There is no unified framework or API, so switching to a different chip requires re‑adaptation of the entire codebase.
- The sources of the open‑source libraries used are often disorganised(we only rely on official libraries with specific commit hashes).
- I want to use it.
- Support audio codec
- Support video codec
- Support Multiple audio front-end algorithms
- Support Multiple audio effects algorithms
- Support sample-rate, channel, bit-depth, data weaver conversion
We suggest to use Hardware-based MJPEG encoder.
We suggest to use Hardware-based H264 encoder.
- Supports parsing file format from containers, extracting audio stream offsets and total lengths, and automatically configuring decoder parameters; see the
audio_stream_demux_openAPIs - Supports frame-based decoding; the input must be a complete audio frame. See the
audio_codec_stream_dec_frameAPIs
- Raw Opus, Vorbis and no adts AAC cannot identify complete frames, so a complete frame must be provided when using
audio_codec_stream_dec_frame
- Supports IMA ADPCM block PCM decoding
- Input bit depth: 4-bit ADPCM
- Sample rates: all sample rates
- Channels: [1, 8]
- Output: 16-bit signed interleaved PCM
- Supports ALAC (Apple Lossless) PCM decoding
- ALAC decoder based on apple-alac
- Supports ALAC audio in CAF and M4A/MP4 containers
- Reads the ALAC magic cookie and automatically configures frame length, sample rate, channels, and bit depth
- Input bit depth: 16 / 20 / 24 / 32-bit
- Channels: [1, 8]
- Output: 16-bit signed interleaved PCM
- Supports AAC with or without ADTS headers
- AAC PCM decoder based on opencore-aac
- Sample rates (Hz):
96000 / 88200 / 64000 / 48000 / 44100 / 32000 / 24000 / 22050 / 16000 / 12000 / 11025 / 8000 / 7350 - Channels: [1, 2]
- Output: 16-bit signed interleaved PCM
- Supports AMR-NB / AMR-WB file format parsing
- AMR-NB / AMR-WB PCM decoder based on opencore-amr
- Sample rates (Hz): AMR-NB
8000, AMR-WB16000 - Channels: 1
- Output: 16-bit signed mono PCM
- Supports FLAC file format parsing
- FLAC PCM decoder based on xiph-flac
- Sample rates (Hz):
8000 / 16000 / 22050 / 24000 / 32000 / 44100 / 48000 / 88200 / 96000 / 176400 / 192000 - Channels: [1, 8]
- Input bit depth: 8 / 12 / 16 / 20 / 24-bit
- Output: 16-bit signed interleaved PCM
- G711A (A-law) and G711U (u-law) PCM decoders
- Input bit depth: 8-bit companded G711
- Sample rates: all sample rates
- Channels: [1, 255]
- Output: 16-bit signed interleaved PCM
- Supports G.722 ADPCM PCM decoding
- Input bit depth: 6 / 7 / 8-bit ADPCM codes
- Sample rates:
16000Hz wideband PCM output,8000Hz low-band output - Channels: 1
- Output: 16-bit signed mono PCM
- Supports MP3 file format parsing
- MP3 PCM decoder based on minimp3 or opencore-mp3
- Sample rates (Hz): MPEG 1:
44100 / 48000 / 32000; MPEG 2:22050 / 24000 / 16000; MPEG 2.5:11025 / 12000 / 8000 - Channels: [1, 2]
- Output: 16-bit signed interleaved PCM
- Opus PCM decoder based on xiph-opus
- Sample rates:
8000 / 12000 / 16000 / 24000 / 48000 - Channels: [1, 2]
- Output: 16-bit signed interleaved PCM
- Vorbis PCM decoder based on xiph-vorbis
- Sample rates (Hz):
8000 / 11025 / 12000 / 16000 / 22050 / 24000 / 32000 / 44100 / 48000 - Channels: [1, 2]
- Output: 16-bit signed interleaved PCM
We suggest to use Hardware-based MJPEG decoder.
We suggest to use Hardware-based H264 decoder.
- Supports WAV file format parsing
- Supports PCM, IMA ADPCM, G711A, G711U, and G.722
- Supports Ogg Opus file format parsing:
OpusHeadandOpusTags - Supports Ogg Vorbis file format parsing: the three header packets,
identification,comment, andsetup - Automatically combine the segments into complete frame based on the segment tables.
- Supports M4A box parsing
- Automatically parses the AAC configuration from the
mp4aandesdsboxes - Automatically parses the ALAC magic cookie from the
alacbox
- Supports CAF file header and chunk parsing
- Automatically extracts the ALAC stream offset, stream size, and decoder configuration
- Supports AVI file format parsing
- Uses peek/pop to extract complete frames
- Supports MP4 box parsing with MJPEG video and AAC audio tracks
- Uses peek/pop to extract complete frames
- Input / output: 16-bit signed mono PCM
- Sample rates:
8000 / 16000 / 32000Hz - Frame duration: fixed
10 ms, orsample_rate * AVP_AFE_3A_FRAME_MS / 1000samples - Processing model: single-instance mono processing;
near_in,far_in, andnear_outmust use the same sample rate and frame length - Processing order: split -> HPF -> AGC Analyze -> NS Analyze -> AEC -> NS Process -> VAD -> AGC Process -> merge
Implemented features:
- High-pass filter (HPF): removes DC offset and low-frequency noise
- Acoustic echo cancellation (AEC): based on WebRTC legacy AEC, with far-end reference input, stream delay, and echo status
- Advanced AEC options: metrics, delay logging, drift/skew compensation, extended filter, delay agnostic mode, and next generation AEC
- Noise suppression (NS): based on WebRTC float NS, with mild / medium / aggressive policies
- NS observation data: prior speech probability and noise estimate getters
- Automatic gain control (AGC): based on WebRTC legacy AGC, with fixed digital, adaptive digital, and adaptive analog modes
- AGC configuration: target level, compression gain, limiter, analog level input / output, and saturation warning
- Voice activity detection (VAD): based on WebRTC VAD, with normal / low bitrate / aggressive / very aggressive modes
- 32 kHz band splitting: 32 kHz input is split into two 16 kHz bands; the low band is used by AEC / NS / AGC / VAD and then merged back to full-band output
- Support Runtime control: AEC / NS / AGC / VAD / HPF can be enabled or disabled, and AEC, NS, AGC, and VAD parameters can be updated at runtime
Supports low-pass, high-pass, band-pass, band-stop / notch, all-pass, peaking, low-shelf, and high-shelf filters.
Run with the following command to test all cases.
./scripts/test_examples.sh