Last active
December 6, 2015 03:05
-
-
Save utahka/244e44bd6b4652e29b1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
file_name=${1:?File name is not set} | |
base_name=`basename ${file_name} .wav` | |
interval=${2:-1} | |
duration=`soxi ${file_name} | awk '/Duration/ {print $3}' | tr ':.' ' '` | |
hour=`echo ${duration} | awk '{print $1}'` | |
minute=`echo ${duration} | awk '{print $2}'` | |
second=`echo ${duration} | awk '{print $3}'` | |
max_num=$(( (hour * 3600 + minute * 60 + second) / interval )) | |
echo "Divide ${file_name} into ${max_num} parts" | |
for ((start=0; start < max_num; start++)) { | |
end=`printf %05d $((start + 1))` | |
sox ${file_name} ./parts/${base_name}_${end}.wav trim ${start} ${interval} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
trim
trim
divide a wav file to any number of parts.dependance