ADPCM encoder tool (Mac-only)

I've been using a small script wrapped in an app (using Platypus) to convert my audio to ADPCM.

Today I updated that from using ffmpeg to using adpcm-xq (thanks to @mandra via @neven for the tip!)

Results are higher quality, compatible ADPCM audio files albeit with slightly longer conversion time.

usage

  • run app and select files to process
    or
  • drag and drop files onto the app icon

output

  • folder ADPCM next to source files
  • 22KHz MONO, by default

options

hold modifier keys as you select files to change settings:

  • ​CONTROL... sample rate 44KHz
  • OPTION... sample rate 11KHz
  • SHIFT... less look-ahead (faster but slightly worse results)
  • CMD... output stereo

download

  • ADPCM.app.zip (279.6 KB)
  • Universal app for Intel (x86_64) and Apple silicon (arm64)
  • uses adpcm-xq version 0.5 release

latest version

  • adpcm-xq version 0.5 is much faster so have increase the quality to keep processing time roughly the same
  • now uses zsh shell
  • shows time taken for each file

notes

  • app is signed by me, but I can only test on Sonoma - so no support on other versions of macOS, sorry
  • you might need to right-click and choose Open, perhaps a couple of times, to get the app to launch
  • uses macOS built-in tool afconvert to handle the sample rate conversion part of the process

screenshots

source code

#!/usr/bin/env zsh

echo "CONTROL... sample rate 44KHz"
echo "OPTION... sample rate 11KHz"
echo "SHIFT... less look-ahead"
echo "CMD... output stereo"
echo

optKeyDown=$(./keys option)
shiftKeyDown=$(./keys shift)
cmdKeyDown=$(./keys cmd)
controlKeyDown=$(./keys control)
# capslockKeyDown=$(./keys capslock)

RATE="LEI16@22050"
if [[ $optKeyDown -ne 0 ]]; then
    RATE="LEI16@11025"
fi
if [[ $controlKeyDown -ne 0 ]]; then
    RATE="LEI16@44100"
fi

if [[ $shiftKeyDown -eq 0 ]]; then
    LOOK=9
else
    LOOK=5
fi

if [[ $cmdKeyDown -eq 0 ]]; then
    CHANNELS=1
else
    CHANNELS=2
fi

echo "lookahead $LOOK && channels ${CHANNELS: -1:1} && sample rate ${RATE: -5:2}KHz"
echo
echo "Converting..."
echo

for file in "$@"; do
    FILENAME=${file:t:r}
    FOLDER=${file:h}
    mkdir -p "$FOLDER/ADPCM/"
    echo "• $FILENAME"
    afconvert -f WAVE -d $RATE -c $CHANNELS "$file" "$FOLDER/ADPCM/.temp.wav"
    { time ./adpcm-xq -$LOOK -q -y "$FOLDER/ADPCM/.temp.wav" "$FOLDER/ADPCM/$FILENAME.wav"; } 2>&1 | awk '{print $6; exit}'
    rm "$FOLDER/ADPCM/.temp.wav"
    echo
done

echo
echo "done"
8 Likes