summaryrefslogtreecommitdiffstats
path: root/tools/split_audio
diff options
context:
space:
mode:
Diffstat (limited to 'tools/split_audio')
-rw-r--r--tools/split_audio24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/split_audio b/tools/split_audio
new file mode 100644
index 0000000..4e97221
--- /dev/null
+++ b/tools/split_audio
@@ -0,0 +1,24 @@
+#!/bin/bash
+#
+# Date: 2009-11-30
+# Author: Ole Kristian Lien
+# License: GNU General Public License
+#
+# Splits stereo channel into left and right, then
+# combines them back into an audio file (stereo)
+
+BITRATE=`./audio_bitrate $1`
+EXT=`echo "$1"|awk -F . '{print $NF}'`
+NAME=`basename $1 .$EXT`
+
+if [ -z "$1" ]; then
+ echo "Usage: $0 <audio-file>"
+ exit 1
+fi
+
+sox $1 -c 1 left.wav mixer -l 2> /dev/null
+sox $1 -c 1 right.wav mixer -r 2> /dev/null
+sox -m left.wav right.wav mono.wav 2> /dev/null
+sox mono.wav -c 2 stereo.wav 2> /dev/null
+ffmpeg -i stereo.wav -acodec $EXT -ab "$BITRATE"k $NAME-new.$EXT 2> /dev/null
+rm left.wav right.wav mono.wav stereo.wav