Jon Olick
  • Home
  • Presentations
  • Publications
  • Patents
  • Videos
  • Code
  • Games
  • Art
  • Blogspot
  • Twitter
  • WikiCoder
  • Contact
  • Links
  • Home
  • Presentations
  • Publications
  • Patents
  • Videos
  • Code
  • Games
  • Art
  • Blogspot
  • Twitter
  • WikiCoder
  • Contact
  • Links

Introducing a single file PCM/ADPCM WAV file writer

11/22/2021

1 Comment

 
For a great many years I've had a PCM WAV file writer which is super duper simple (<20 LoC).

I recently came across a git repo where somebody made a super high quality ADPCM encoder called ADPCM-XQ (stands for Xtreme Quality ADPCM Encoder/Decoder). I've looked at that code, re-wrote it to single file STB style, and greatly improved the algorithm it uses, fixed some bugs it had in the algorithms, etc...

Namely compared to the original adpcm-xq, for the same quality as adpcm-xq it is lots faster - as well as it now includes a non-greedy search which further improves ADPCM quality. This improved speed is in part due to an improved search function around the current heuristic choice. 

The new slow mode is similar in speed to adpcm-xq, while having ~20% improved error per sample.

First some examples.

Uncompressed PCM: (0 error per sample)
Fastest ADPCM encode configuration: (1201 error per sample)
Fast ADPCM encode configuration: (1196 error per sample, similar quality to adpcm-xq)
Slow ADPCM encode configuration: (1007 error per sample)
Usage is something like:

jo_write_wav_adpcm_slow("adpcm_slow.wav", num_channels, 44100, samples, num_samples);

You can grab the code here:
jo_wav.h
File Size: 13 kb
File Type: h
Download File

1 Comment

    Archives

    November 2021
    October 2021
    September 2021
    April 2021
    February 2021
    January 2021
    December 2020
    June 2020
    May 2020
    April 2020
    November 2019
    April 2019
    August 2018
    April 2017
    March 2017
    January 2017
    November 2016
    October 2016
    September 2016
    January 2016
    March 2015
    August 2013
    July 2013
    December 2012

    Categories

    All
    Compression
    Dxt

    RSS Feed