Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: 8 Bit uLaw decoder

  1. #1

    8 Bit uLaw decoder

    I have a radio with a digital output port. The Data is 8 Bit uLaw at 8KHz I need to expand the ULaw from Log to linear. Is there a Lib that does this?

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Colmar, France
    I’m not aware of a Lib which could do this. You didn’t give enough information, though. In what format does the digital output of your radio send the digital audio data? Most probably, the stream will first have to be decoded to restore the 8bit uLaw Audio data into a buffer. Then, expanding it to 14bit linear audio is trivial and can be done within a few lines of code.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Inside the audio library, you can find code which expands ulaw. It's really just a very simple table lookup.

    The code is inside the memory player.

    The actual expansion from ulaw to linear pcm is done with this table:

    Easy stuff.

    Here's the encoding side which produces the data arrays that memory player uses:

  4. #4
    trying not to state the obvious, with my Teency 3.6 and your stereo codec card on top, I can run this as a 12bit audio output with a 8KHz serial input to the Teency. ( i will work on that later, as the audio is digitally TX'd from an ARINC 429 bus). the next question is: in our Avionics lab audio is measured in dB SINAD. so I need to do an FFT of the audio, read the RMS of the 1KHz tone, notch out the tone, read the resultant RMS and do :20xLog(tone/noise) it may be 10Log, I will look it up later...with a digital read of SINAD VRMS and an audio out to a speaker it will replace a bunch of old stuff from the '80s

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    I've been told some audio testing gear doesn't handle the moderate amount of ultrasonic content that is often left over on the output of modern oversampling DACs, like the one in the SGTL5000. If you get really bad results, that might be one of the possible causes.

    If ulaw encoding will be part of this process, and if you care about whether the results honestly measure real-world performance, you might consider how ulaw affects sounds. It will of course add some harmonic distortion, but that's rarely the big issue. The main problem with ulaw is how it affects multiple non-harmonically related frequencies, especially when one is lower amplitude than the other (the smaller signal is often treated quite horribly). This is the reason ulaw is mostly used for telephone voice, where the content is a single vocal source. If you try using it for music containing vocals and multiple instruments, the results are usually terrible. It really only sounds acceptable when the source is a single vocal or instrument or something that emits primarily one sound.

  6. #6
    The ulaw audio is from a VHF aircraft comm box, if this works I would put a 3KHz LPF on the output. The primary purpose it to get a SINAD and a RMS of the % of full scale audio on a display, audio to a speaker would be a nice feature. if this works, I could see making about 30 audio boxes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts