0
$\begingroup$

I am trying to understand what a codec actually is

Wikipedia says

In hardware, audio codec refers to a single device that encodes analog audio as digital signals and decodes digital back into analog. In other words, it contains both an analog-to-digital converter (ADC) and digital-to-analog converter (DAC) running off the same clock. This is used in sound cards that support both audio in and out, for instance.

So this implies codec is something that comes with both ADC and DAC converters (so a codec should have an analog input with a corresponding digital output and a digital input with a corresponding analog output)

From my limited understanding, codec should have some kind of coder and a decoder, that is, for whatever digital representation I get from a particular analog input, the codec should should give me a different, encoded version of this digital representation, and it should also be able to reverse this encoding (since it's a codec, unless I got it wrong and the digital equivalent itself is considered a type of encoding?)

However, this doesn't seem to make sense to me in terms of the DSP that I am working with

The following figure is from the datasheet of the CSR8670 Bluetooth Audio chip enter image description here

In a lot of a places, the datasheet, other documents and comments in the sample programs mention the audio input ADC as a codec, so I assumed codec here meant the wikipedia definition

Looking at this picture, we can see that it shows ADC and digital codec to be two separate entities. Moreover, both the inputs from the analog mics as well digital mics go through the digital codec

What exactly does this mean? I can use the debugger to check the DSP memory for the numerical representation of whatever audio that comes in through the microphone. Does this imply that the numerical representation that I see in the DSP memory is not the same as what was generated by the ADC?

What is codec here, in very simple terms?

$\endgroup$
2
  • 1
    $\begingroup$ You're confusing the "software" term with the "hardware" term. They mean different things. Which is why Wikipedia takes care to state "In hardware...". $\endgroup$ Jun 27, 2017 at 10:26
  • $\begingroup$ @marcus Then what does the codec in the given figure mean? $\endgroup$
    – user13267
    Jun 27, 2017 at 10:37

1 Answer 1

1
$\begingroup$

As Marcus have pointed, the codec in that article refers to a narrower meaning of the term codec specifically applied to digital (computer) hardware systems.

The term codec is acronym for coder and decoder, hence a codec consists of two separate parts (at different ends) working together to perform an information processing task in between.

A coder is an algorithm (implemented in digital hardware, software or analog hardware) that is used to convert a source of information into a form that has some advantages for the purpose of representation, storage or transmission etc. The source after being processed by the coder is said to be as encoded. The most typical application for coders is compressing digial media such as music, speech, images, video so that they can be represented with less number of bits then their raw formats which is advantageous for storage space and transmission bandwidth for a fixed transmission time such as in real time communications or equivalently transmission time for a given fixed bandwidth for file downloading from internet. The algorithm of the coder is specified mathematically, and it can be implemented in software such as those dll files in a Windows operating system or inside specific program folders. It can also be implemented in hardware which is the case for such as the digital cameras where the hardware device is required to convert the captured raw video input stream into a chosen video format for storage purposes as fast and efficient as possible. A software codec running on a general purpose CPU could be weak for such embedded applications. Note that historically analog hardware base encoders were also used for transforming raw media analog inputs into feasible analog formats, the prime example being a TV encoding IC which converts RGB raw analog video stream into an NTSC/ PAL/ SECAM video format which enables a low bandwidth and black and white compatible transmission over RF broadcasting.

The decoder does the inverse; given an encoded data stream, it produces the original raw data stream as accurate as possible, exactly if the codec is a lossess type and approximately if lossy type. The decoder can also be implemented in hardware or software. The hardware implementation is always faster wheres the software is always more flexible.

As a general principle, the coder and decoder pairs are designed such that the encoders are more powerful and expensive, so that decoders can be less powerful and cheaper (form a commercial perspective) which is the case in multimedia broadcasting systems.

Coming to your figure, it's an accepted misusage of the term codec. Where the input audio from the digital microphone (which is another accepted misusage) is converted into a suitable form for representation and transmission in the following digital systems and vice versa. Hence conventionally an ADC chip which converts analog audio into digital PCM stream and a DAC chip shich converts digital PCM stream into analog audio output may be termed as a codec in the digital audio industry.

$\endgroup$
2
  • $\begingroup$ but then why does that figure show the ADC and digital codec as two separate blocks? $\endgroup$
    – user13267
    Jun 27, 2017 at 13:05
  • 1
    $\begingroup$ Perhaps my last statement caused a confusion. In your figure, I cannot explicitly tell what the codec block is doing, all I can say is it resides in between digital PCM audio stream from ADC (or from a digital stream from a digital microphone) and converts that into another digital format. For instance it may convert high-sample rate data of the digital microphone into a conventional PCM at usual audio rates of 44100 Hz or alike. In that case it would possibly skip the ADC input and only process the digital microphone. You should decide it from the system references and datasheets. $\endgroup$
    – Fat32
    Jun 27, 2017 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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