Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A lossless audio codec for embedded devices

I want to transmit a stereo audio stream with 48K rate (which corresponds to 768 Kbit per channel at 16-bit samples) via a radio channel, and feed it to a DAC using a Cortex-M3 microcontroller. While the channel technically works at 2 Mbit, range degrades quickly with speed, and I want to optimize it to a certain degree.

Is there any lossless audio codec which can work on a microcontroller with ~8K of RAM, approx. 20 MIPS of processing power, a 32-bit hardware multiplier and no hardware divisor? I don't need a great compression ratio, but it should handle stream errors correctly and without long pauses in the playback.

like image 728
whitequark Avatar asked Oct 10 '22 12:10

whitequark


2 Answers

Xiph.org's FLAC might be embeddable - see the "Embedded Developer" section at the bottom of this page. It is fixed point, fast. open source, and fairly widely supported. I haven't tried it, but I did use the embedded version of their Ogg Vorbis decoder (Tremor), and found it reasonably easy to up and running.

like image 111
AShelly Avatar answered Oct 20 '22 08:10

AShelly


Instead of, or maybe as well as using a audio compression, you should also consider down sampling to a lower sample rate.

You will also need to consider the robustness of your wireless connection. This will also eat into your overall wireless bandwidth as you may have look at error correction techniques.

Both of these issues depends on the quality of the audio required.

The Linux JACK program I think utilizes a CELT Audio Codec(Lossy) that you may want to look at.

like image 35
simon Avatar answered Oct 20 '22 08:10

simon