Home | Rules and Guide | Sign In/Create Account | Write a Post | Reddit | #ludumdare on irc.afternet.org (Info)

Thanks for making Ludum Dare 26 AWESOME! See you in August!

Ludum Dare 26 — April 26-29th, 2013
[ Results: Top 100 Compo, Jam | Top 25 Categories | View My Entry ]
[ View All 2346 Games (Compo Only, Jam Only) | Warmup ]

[ 10 Sec Video Compilation (x3) | 260 Game Video Compilation | IndieCade Deal | Ludum Deals (Unity Deal Ends Soon!) ]


Need an audio codec?

Posted by
August 21st, 2012 5:52 am

Here’s DFPWM, a 1-bit-per-sample compressed audio codec. Reference implementation is aucmp.py, C version is aucmp.c and audecmp.c, all public domain. Look at aucmp.py for a (totally not peer-reviewed) mathematical definition of the base encoder, as well as some suggestions to get rid of the whining and make it not look so high-pass filtered.

https://github.com/asiekierka/pixmess/tree/master/scraps

Is this the right codec for me?

Well, let’s look at what it’s not for:

  • If you can’t stream your own audio to the sound card, this is not for you.
  • If you’re an audiophile, run away now. It’s a fairly comprehensible codec, but it definitely sounds compressed (it tends to add noise).
  • There are definitely better-quality codecs. This is supposed to be simple to implement.

Now, some stuff itcould be good for:

  • Low-power CPUs. Note, a hardware multiply would help.
  • Low-latency encoding. This encodes sample-per-sample.
  • Really, really small audio data. Encoding at 16kHz gives you 2KB/s.
  • Avoiding having dependencies for libogg/libvorbis – though these DO have better audio quality than this codec.

…Well, I’m not all too sure what the hell this’d be useful for, considering that most people in Ludum Dare can’t code at any level other than “as far away from the hardware as possible”, but it’s a suprisingly decent codec.

So, if you’re implementing voice chat for whatever reason, or you are limited by memory (storage and/or RAM), this might be the codec for you.

2 Responses to “Need an audio codec?”

  1. JH says:

    This is really useful, thanks! As I want to stay away from dependencies this just comes right. A while ago I came up with my own ADPCM codec but it only has a 1:4 compression ratio (4 bits per sample). I couldn’t get a higher compression without introducing major noise.

  2. GreaseMonkey says:

    OOPS. Forgot to mention: DFPWM = Dynamic Filter Pulse Width Modulation.

Leave a Reply

You must be logged in to post a comment.


All posts, images, and comments are owned by their creators.

[cache: storing page]