On Thu, 8 Dec 2016 12:18:47 -0600, James Shatto wrote:
>As well as a few CLI options for the same. Sox is good for that.
For SpaceFM I wrote a script to split and/or merge stereo wav. Written
on the fly, so most likely not good shell script writing, but it does
what it should do and IIRC ffmpeg was easier to use.
[rocketmouse@archlinux bin]$ ls -Ggl s2*
lrwxrwxrwx 1 3 Apr 27 2016 s2a -> s2m
lrwxrwxrwx 1 3 Apr 27 2016 s2d -> s2m
lrwxrwxrwx 1 3 Apr 27 2016 s2l -> s2m
-rwxr-xr-x 1 1791 Apr 28 2016 s2m
lrwxrwxrwx 1 3 Apr 27 2016 s2r -> s2m
[rocketmouse@archlinux bin]$ cat s2m
#!/bin/dash
version="2016-04-28"
usage()
{
cat<<EOF
s2m version $version rocketmouse
stereo.wav > mono.wav:
s2m input_file.wav
stereo.wav > left.wav:
s2l input_file.wav
stereo.wav > right.wav:
s2r input_file.wav
stereo.wav > dual {left,right}.wav:
s2d input_file.wav
stereo.wav > all {mono,left,right}.wav:
s2a input_file.wav
EOF
exit $1
}
outfile()
{
outfile="$(echo "$infile" | sed 's/\(.*\).wav/\1_'$1.$suffix/I)"
if [ -f "$outfile" ]; then
echo "$outfile already exists"
usage 1
fi
}
ex2file()
{
outfile $1
echo "Export to $outfile"
case $1 in
mono)
ffmpeg -i "$infile" -ac 1 "$outfile"
;;
left)
ffmpeg -i "$infile" -map_channel 0.0.0 "$outfile"
;;
right)
ffmpeg -i "$infile" -map_channel 0.0.1 "$outfile"
;;
esac
}
case $1 in
-h|--help)
usage 0
;;
esac
infile="$1"
if [ ! -f "$infile" ]; then
echo "No file $infile"
usage 1
fi
num_ch=$(exiftool "$infile" | grep -v "File Name" | grep -v "Directory" | grep
"Num Channels" | cut -d: -f2 | sed s/\ //)
plural=""
if [ "$num_ch" = "" ]; then
num_ch="No"
else
if [ "$num_ch" -ge "2" ]; then
plural="s"
fi
fi
if [ "$num_ch" != "2" ]; then
echo "$num_ch channel$plural, not a stereo file"
usage 1
fi
suffix=$(echo "$infile" | rev | cut -d. -f1 | rev)
if [ "$(echo "$suffix" | tr [:upper:] [:lower:])" != "wav" ]; then
echo "Suffix is \"$suffix\", must be \"wav\", case sensitivity is not
required"
usage 1
fi
case $(basename $0) in
s2m)
ex2file mono
;;
s2l)
ex2file left
;;
s2r)
ex2file right
;;
s2d)
outfile right
ex2file left
ex2file right
;;
s2a)
outfile left
outfile right
ex2file mono
ex2file left
ex2file right
;;
esac
exit
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/xeonphi
_______________________________________________
Alsa-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-user