{"assets":[],"author_link":"author\/greasemonkey\/","author_name":"GreaseMonkey","cat":"LD #24","categories":["LD #24"],"comments":[],"epoch":1345528320,"event":"LD24","likes":5,"metadata":{"p_key":"77060","p_author":"GreaseMonkey","p_authorkey":"0","p_urlkey":"285605","p_title":"Need an audio codec?","p_cat":"LD #24","p_event":"LD24","p_time":"1345528320","p_likes":"5","p_comments":"0","p_status":"WAYBACK","us_key":null,"us_name":null,"us_username":null,"event_start":"1345766400","event_key":"12","event_name":"LD24"},"source_url":"2012\/08\/21\/need-an-audio-codec\/","text":"<p>Here\u2019s 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.<\/p>\n<p><a href=\"https:\/\/github.com\/asiekierka\/pixmess\/tree\/master\/scraps\" title=\"heck, it even sounds compressed\">https:\/\/github.com\/asiekierka\/pixmess\/tree\/master\/scraps<\/a><\/p>\n<p><strong>Is this the right codec for me?<\/strong><\/p>\n<p>Well, let\u2019s look at what it\u2019s <strong>not<\/strong> for:<\/p>\n<ul>\n<li>If you can\u2019t stream your own audio to the sound card, this is not for you.<\/li>\n<li>If you\u2019re an audiophile, <em>run away now<\/em>. It\u2019s a fairly comprehensible codec, but it definitely sounds compressed (it tends to add noise).<\/li>\n<li>There are definitely better-quality codecs. This is supposed to be simple to implement.<\/li>\n<\/ul>\n<p>Now, some stuff itcould be good for:<\/p>\n<ul>\n<li>Low-power CPUs. Note, a hardware multiply would help.<\/li>\n<li>Low-latency encoding. This encodes sample-per-sample.<\/li>\n<li>Really, <em>really<\/em> small audio data. Encoding at 16kHz gives you 2KB\/s.<\/li>\n<li>Avoiding having dependencies for libogg\/libvorbis \u2013 though these DO have better audio quality than this codec.<\/li>\n<\/ul>\n<p>\u2026Well, I\u2019m not all too sure what the hell this\u2019d be useful for, considering that most people in Ludum Dare can\u2019t code at any level other than \u201cas far away from the hardware as possible\u201d, but it\u2019s a suprisingly decent codec.<\/p>\n<p>So, if you\u2019re implementing voice chat for whatever reason, or you are limited by memory (storage and\/or RAM), this might be the codec for you.<\/p>","time":"August 21st, 2012 5:52 am","title":"Need an audio codec?"}