Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
# Usage: ./rodecaster_conv.sh POD000131.WAV
# Tool sox is needed!
# Installation..
# ..under Debian/Ubuntu: sudo apt-get install sox
# ..under maxOS using Homebrew: brew install sox
function convert() {
filename=$1
suff=$2
channel=$3
dest=$4
basename=`echo $(basename $filename)`
filename_without_ext=`echo "${basename}"|sed "s/\(.*\)\.\(.*\)/\1/"`
mkdir -p "${dest}/${filename_without_ext}"
channel_frmt=`printf "%02d" $channel`
new_filename="${dest}/${filename_without_ext}/${filename_without_ext}-${channel_frmt}$suff.flac"
echo "Extracting channel ${channel} to ${new_filename}..."
sox "$filename" "$new_filename" remix $channel
}
if [ ! -f "$1" ]; then
echo "File '$1' does not exist!"
exit
fi
dest=${2:-.}
convert $1 "Left" 1 "$dest"
#convert $1 "Right" 2 "$dest"
convert $1 "Mic-1" 3 "$dest"
#convert $1 "Mic-2" 4 "$dest"
#convert $1 "Mic-3" 5 "$dest"
#convert $1 "Mic-4" 6 "$dest"
convert $1 "USB-Left" 7 "$dest"
#convert $1 "USB-Right" 8 "$dest"
#convert $1 "TRRS-Left" 9 "$dest"
#convert $1 "TRRS-Right" 10 "$dest"
#convert $1 "Bluetooth-Left" 11 "$dest"
#convert $1 "Bluetooth-Right" 12 "$dest"
#convert $1 "Sounds-Left" 13 "$dest"
#convert $1 "Sounds-Right" 14 "$dest"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment