Shop OBEX P1 Docs P2 Docs Learn Events
Audio compression — Parallax Forums

Audio compression

Jay KickliterJay Kickliter Posts: 446
edited 2010-09-24 11:20 in Propeller 1
I've seen mention of it, but does anyone have any working mu-law/ADPCM CODEC PASM to share? Just checking before I reinvent the wheel.

And to anyone curious of what I'm talking about, it's a simple(ish) way to compress speech to a 4 bit 8 kHz stream. Used in telephony.

Thanks.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-09-19 13:16
    I haven't done anything with it, but I've always thought that it (or something like it) would be fun to try, in order to communicate voice between two Props via XBee.

    -Phil
  • Erik FriesenErik Friesen Posts: 1,071
    edited 2010-09-19 15:22
    You mean 8 bit 8khz, I believe.

    http://hazelware.luggle.com/tutorials/mulawcompression.html

    I imagine a lookup dat table is how you would do it. I have some c# code for alaw , but ran across the above, which looks like you could translate a bit easier into pasm.
  • Jay KickliterJay Kickliter Posts: 446
    edited 2010-09-20 18:25
    You mean 8 bit 8khz, I believe.

    Using ADPCM you can reduce it to 4 bit "samples". Thanks for the link.

    Phil. Don't want to go into specifics yet, but you read my mind.
  • Dave HeinDave Hein Posts: 6,347
    edited 2010-09-21 09:11
    The original 32 kbps ADPCM standard was G.721. This was replaced by G.726, which provides for various bit rates down to 16 kbps. The ITU audio standards are available at http://www.itu.int/rec/T-REC-G/e . G.711 is the mu-law/A-law standard. The other codec standards are listed under G.72x numbers.

    G.728 runs at 16 kbps with good performance, but it is somewhat compute intensive. G.729 runs at 8 kbps, and is lower compute than G.728. I don't know if it will fit on a Prop or not.

    There is license-free C source for these standards available on the internet. I would suggest implementing the codec in C first using the Catalina compiler. If this is not fast enough, then you can optimize compute-intensive portions of the code in PASM.

    Dave
  • Heater.Heater. Posts: 21,230
    edited 2010-09-22 23:43
    "There is license-free C source for these standards available on the internet."

    Download link please:)
  • Dave HeinDave Hein Posts: 6,347
    edited 2010-09-23 09:59
    An internet search of "G.721 source code" will yield lots of hits. Sun Microsystems has license-free code for G.721.

    About 15 years ago the ITU realized that it is more precise to specify an audio codec as a program than just in words, block diagrams and tables. So they have both a human language version of the standard as well as source code. The G.191 standard contains C source code for G.711, G.722, G.726, G.727 and G.728. It is located at http://www.itu.int/rec/T-REC-G.191/en .

    I think G.729 was the first ITU audio standard that bundled both the human language version and the C source code together into one document. There is also a G.723.1, which I believe is a 16 ksps at low data rates.

    The earlier audio codecs are completely license free. However, I believe some of the later standards do have intellectual property claimed against them. It is best to thouroughly research the licensing issues of any standard before it is included in a product.

    Dave
Sign In or Register to comment.