1
$\begingroup$

When a computer transcodes an audio file from one file format to another, does the computer first decode it into the raw digital stream (exactly what is fed into the DAC for the audio output) , or does it do something different without having to completely decode it?

Take Spotify files for example, I believe that they are not in a standard MP3 format that can be played on any device. However, shouldn't it be relatively easy to convert these files into standard MP3 files, by first decoding them and then re-encoding to MP3 format?

Or would it require getting the analogue audio, converting it back to digital and then encoding again. My main query is, do we generally have access to this raw decoded digital audio data?

$\endgroup$
2
$\begingroup$

A program to convert an .mp3 audio file-format into , say, an .ra (real audio) audio file-format needs fully to decode the mp3 file into raw waveform audio and then re-encode it into its new format.

This raw audio waveform data can be contained within 32/64-bit floating point or some integer formats though. But when it's sent to audio DAC, it should be in an integer format; this depends on the PC audio standard and as far as I know, Windows (and like) systems use 8/16 bit integer formats at this stage (you have to check for their developer knowledge base for their latest implementations)

So there can be a very slight difference between the raw data at the input buffer of DAC and raw data that reside in the system RAM, but they are both raw waveform data.

Nevertheless, unless the the two audio formats have some common design layering, then it's not possible to transcode from one format to the other without full decoding of the original.

Finally, analog audio is practically never required as it would introduce more errors and complexities than do anything useful.

$\endgroup$
1
$\begingroup$

You can transcode by going from any encoded format to a PCM format (which is the raw waveform as it would be sent to a DAC) and then re-encode in the new format. PCM is always the input to an encoder and the output of a decoder.

Most perceptual codecs like MP3, AAC, or Vorbis (which Spotify uses) are all sub-band codecs and in theory it would be possible to transcode in the sub-band domain. However, the devil is in the details and it's really not worth the extra effort, especially since decode/encode is fast and super simple.

Things can be more complicated if digital rights management or other copyright protection features are in place. In this case it may not be possible (or legal) to keep significant chunks of PCM format around.

$\endgroup$
  • $\begingroup$ What about if the audio was encoded in a special format, and it could only be decoded by a specific application? Only this application will then know how to decode it and send the raw audio data to the DAC. If we then wish to transcode, we need to use that specific application first to decode the file and then catch the decoded data somehow on the way to the DAC? This I don't understand exactly how it works $\endgroup$ – Engineer999 Mar 21 at 11:56
  • $\begingroup$ The output of every decoder is PCM format (or "raw audio" as you call it). This can be fed fed into a DAC, or into another encoder. Or you could save it as a wave file, or process it, or send it over a network etc. There is no special connection between a decoder and a DAC. $\endgroup$ – Hilmar Mar 22 at 2:58

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.