Ad4

From HalfgeekKB
Jump to navigation Jump to search

An .ad4 file is an audio track encoded in a format that can be readily used by low-cost sound modules such as the WTV020* (e.g. WTV020-SD-16P).

Encoding settings

Most examples of the file format appear to have these properties:

  • No header (raw)
  • Encoded as VOX/Dialogic/OKI/Intel ADPCM, a lossy but relatively uncomplicated codec with a suitable speed/quality tradeoff for this application
  • One channel (mono)
  • 32000Hz sample rate (some reports vary)

Audacity

Audacity appears to be able to successfully decode this format based on these settings. (Without the module in hand, not sure whether it can also encode successfully.)

I suspect that the codec is doing something similar to what sox is doing (see below) but silencing the warnings.

sox

sox is able to decode from this format using the -t vox specification; however, all times I've tried this have resulted in a non-fatal warning to the effect of "ADPCM state errors: some large number". However, the result sounds more or less equal to the result from Audacity.

$ sox -t vox -r 32000 src.ad4 dst.wav
sox WARN adpcms: src.ad4: ADPCM state errors: 14409

When encoding to this format, a clipping warning may appear.

$ sox src.wav -t vox -r 32000 dst.ad4
sox WARN dither: dither clipped 18240 samples; decrease volume?