Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Audio codec development help for a noob (Read 2231 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Audio codec development help for a noob

Hi all,

So I've been thinking about asking this question here for a long time, since I have no idea if somebody willing to help on such low level. Here goes nothing.

I would like to learn how to develop an audio codec. Since this is a vast subject, and involves lot of math and DSP theory, I'm looking for something simple which can introduce me to the area. I have no prior knowledge or education with this, besides knowing what these codecs do on the high level, and experimenting with them as an end user. I'm a developer in my day job though. (I've rewritten WavPack in the past into Dart, but it was more-or-less a direct translation without actually understanding what each part of the codec does.)

Since my math knowledge is rusty (uni was a long time ago), I would appricate something which allows me to approach from the coding side and to lookup the related concepts and expressions from that.

I'm trying to find some example code which is not too complex, but involves researching and also to provide some fun with experimentation by fine-tuning things. I would like to redo and rewrite it myself.

I was thinking about some kind of sub-band ADPCM codec as the initial goal, since splitting the audio to multiple bands is something which many lossy codecs do, so it seem essential to understand. Also ADPCM enables some very rudimentary lossy compression which I can play with. Maybe starting with a simple ADPCM codec and then adding the band-splitting part as a second stage is a good approach.
Can somebody recommend me a starting point for this, please?

(Maybe this sub-forum was not the best location for this, feel free to move it to correct location. Though a hybrid-lossless codec is something which I would like to aim at in the long-run.)

Re: Audio codec development help for a noob

Reply #1
Nothing subband to follow, but a couple of educational codecs have been posted here, like
https://github.com/dbry/slac by the creator of WavPack
https://github.com/sahaRatul/sela

Quite OK Audio is lossy: https://hydrogenaud.io/index.php/topic,123838.0.html ... oh you posted there.


Re: Audio codec development help for a noob

Reply #2
Thanks Porcus! These all look like great candidates to start experimenting with. Yes, I was aware of Quite OK Audio, though it's great that you mention it because I have kind of forgot about it. :o
(Sorry for answering late, I haven't got time to check back sooner).

Re: Audio codec development help for a noob

Reply #3
Quite OK seems to work as follows: it does a linear prediction (what in FLAC lingo is a "fixed" predictor, and only one of those that FLAC has to choose from). Then for the residual: Instead of storing it losslessly in some representation (like FLAC does), it chooses to approximate each sample residual by a value from a hardcoded short list. As long as that is quite close, the result is hopefully quite OK.

Re: Audio codec development help for a noob

Reply #4
Understanding LPC is probably important, it appears to be the main model in many codecs or at least is heavily related: https://uforobot.github.io/2018/04/01/flac-format/

Storing the residual boils down to understanding the distribution the models tend to produce and using an efficient way to store data with that distribution. Or let generic compression figure it out.

Re: Audio codec development help for a noob

Reply #5
The LAME website says:
Quote
LAME is an educational tool to be used for learning about MP3 encoding

If you haven't studied DSP there is a FREE online book.

...I can understand it as a learning project but the last thing the world needs is another CODEC.  ;)