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
  • 22050 Hz stereo

options

  • hold Alt: 44100 Hz stereo
  • hold Shift: larger lookahead mode (slower, marginally better results)

download

notes

  • app is signed by me, but I can only test on Mojave - so no support on other versions of macOS, sorry
  • requires ffmpeg to be installed at /usr/local/bin to handle the sample rate conversion

screenshots

source code

optKeyDown=`./keys option`
shiftKeyDown=`./keys shift`

if [ $optKeyDown -eq 0 ]
then
	RATE=22050
else
	RATE=44100
fi

if [ $shiftKeyDown -eq 0 ]
then
	LOOK=3
else
	LOOK=5
fi
echo "Converting... @ $RATE Hz, lookahead $LOOK"

for file in "$@"
do
	FILENAME=`basename "$file"`
	FILENAME="${FILENAME%.*}"
	FOLDER=`dirname "$file"`

	mkdir -p "$FOLDER/ADPCM/"

	echo "$FILENAME"
	/usr/local/bin/ffmpeg -i "$file" -ar $RATE "$FOLDER/ADPCM/.temp.wav" 2> /dev/null
	./adpcm-xq -$LOOK -q -y "$FOLDER/ADPCM/.temp.wav" "$FOLDER/ADPCM/$FILENAME.wav"
	rm "$FOLDER/ADPCM/.temp.wav"
done
7 Likes

Worth noting in the discussion here that this still works on 12.0.1 Monterey on an M1 iMac; thanks for the easy-to-use tool @matt :raised_hands:t5:

1 Like

Inspired by this, I made a quick node cli tool that has a wasm compiled ffmpeg & adpcm-xq lib.

I didn't test this, but the WASM thing should mean that this script works on any system with node 14+.
It also might mean you could make a browser tool out of this. :thinking:

edit: I should also mention that I did not expose any flags. will do that soon-ish.

2 Likes

Thanks for this tool Matt.

Not sure what to think of the results I get when comparing tools.

Your processed version sounds fine on mac simulator, but the waveform seems off and gives a pop at the end of the sample.

thrust_orig.wav.zip (19.0 KB)

@Nino we will need to see if the problem is ffmpeg or admpcm-xq, and then file the issue in the correct place

all I do is wrap those with a GUI