#! /bin/sh

set -eux

input_file="$1"
output_file="$2"
tempfile=$(mktemp /tmp/stereoXXXXXX.wav)

# Two step process:
#   1. Convert s16 PCM to a stereo wav file
#   2. Convert stereo wav file to mono
sox -r 44100 -e signed-integer -b 16 -c 2 ${input_file} ${tempfile}
sox ${tempfile} -c 1 ${output_file}
