ADPCM en/decoding


The Nabaztag can handle several types of data: MIDI-tracks, virtual machine-bytecode and soundfiles. The first 2 are reasonably well documented: the MIDI-tracks should be single-track and everything should work and the VM-bytecode is documented by Violet itself. One file format isn't documented yet: that of the sound-files.

The Nabaztag uses an Oki chipset to play its sounds, and because the format wasn't immediately recognized as something much-used as PCM or AU, it was presumed that the format was Okis proprietary 'ADPCM'-format. For this format, converters do exist, e.g. Sox has support for them. When you convert the audio-data received from the Nabaztag-site to something else, however, it sounds clipped and distorted. So while Oki ADPCM isn't the format that's used, it is close.

After some more research, I found out that Oki has upgraded it's chips to a newer format, ADPCM2. While ADPCM is documented quite well, ADPCM2 doesn't have any documentation: it really is a closed, proprietary Oki file format. Some mobile phones seem to use them too, and someone I worked with on this problem managed to whip up a Windows commandline en/decoder using some dlls provided with the PC tools for the phone. I used that to figure out what happened on en/decoding hexedited sound files.

Eventually, I found out that 4-bit ADPCM2-files don't differ that much from normal ADPCM-files: The tables used to en/decode them are a bit different, but the inner workings of the algorithms aren't. That's why I decided to butcher the original vox en/decoding code from here. The license of that package allows modification and duplication, and because I don't want others to have to duplicate my work, I hereby offer my hack to the public at large.

Download the package here.



Quavadis wrote at 3 Nov 2010, 9.38:

Awesome! I have looking for adpcm2 decoder from so long time ago... So I must say for you Thanks.

Leave a comment:

Your name:

What does this picture say?
Sorry, this is a captcha

Your comment:

© 2006-2022 Sprite_tm - Contact