I am trying to stream audio from device. I can't use the PCM audio because it is not compact enough, and I don't have so much bandwidth.

What is the option to substitute wave PCM with some codec? I am interested in good quality for speech and sampling frequency up to 16 kHz. Is ADPCM a good choice? Where can I find info about that?

  • 3
    $\begingroup$ You might try Opus. $\endgroup$ – Jason R Mar 3 '15 at 14:32
  • $\begingroup$ thank you Jason!! any other ideas ?? what are the tradeoffs? $\endgroup$ – Black Yasmin Mar 3 '15 at 18:50
  • $\begingroup$ What OS is the device running? $\endgroup$ – ruoho ruotsi Mar 3 '15 at 20:50
  • $\begingroup$ this is prototype yet and i think this is going to be an embeded system. we are considering stm32 of a sort. $\endgroup$ – Black Yasmin Mar 3 '15 at 22:15

Opus would be a good choice. It claims to be the superior solution for Internet (i.e. lossy transmission with inconsistent latency) music and speech streaming applications. Specifically, it provides tight control over encoding latency when that's important. It's based on technology from two previous codecs: SILK, developed by Skype for speech transmission, and CELT, a codec developed for low-latency streaming audio.

One nice aspect of Opus is that it is an open standard, so a reference implementation is available that has source code for both floating-point and fixed-point computations. It also claims to have support for multiple architectures, including x86, ARM, and MIPS, which might be useful.

As far as quality goes, there are a number of detailed comparisons available between Opus and other audio codecs like AAC or MP3. Here is a plot that seems to summarize it well:

enter image description here

Basically, the makers of Opus claim superior audio quality to its competitors over a wide range of bitrates. Especially in the pretty-low-bitrate range of 16-32 kbps, it seems to have no peer at the present time. This page has a number of live tests that you can run in your browser, showing its performance with both speech and audio, its robustness to packet loss, and its ability to change bitrates (and therefore audio quality) on the fly.

| improve this answer | |

Speex has been in use for some time for real-time chat. It was specifically designed for voice. Some more advanced codecs for voice are based on it. The advantage of Speex is that it is free, source code readily available and fast in terms of encoding and decoding. The compression ratio is variable but your are most likely to use a setting of about 10:1 for quality reasons.

I haven't used Speex in some time and have no idea where the code currently stands. I recall having to use an older revision because a newer version used C++ new extensively and was unsuitable for use by the system's coprocessor environment it was running in.

You didn't mention whether the source you are streaming is live or pre-recorded. Whether you need to both encode and decode is important. It typically takes longer to encode than to decode.

Also important is whether you will always play from the beginning or can jump to any point ahead or behind. Many compression schemes rely on "state" from the previously decoded block which can make seeking a problem. (This would be a comment but I'm a lowly newb.)

| improve this answer | |
  • $\begingroup$ I think that even qualifies as an answer. Nevertheless Opus mentioned by Jason took place of Speex. $\endgroup$ – jojek Mar 4 '15 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.