diff options
| author | jules on spawn <spawn@cortex> | 2018-07-23 17:51:19 +0200 |
|---|---|---|
| committer | jules on spawn <spawn@cortex> | 2018-07-23 17:51:19 +0200 |
| commit | 3be97f05798e1c49a6bb8ef9ac79822e255c05b2 (patch) | |
| tree | 1dc70595895b90c421d500f056aaf902363eb069 | |
| parent | c170491e3582338ab77d4cf1db108789c8f579b2 (diff) | |
fix filenames in split script
| -rw-r--r-- | .gitignore | 1 | ||||
| -rwxr-xr-x | split.sh | 25 |
2 files changed, 26 insertions, 0 deletions
@@ -12,4 +12,5 @@ data output build dist +test_data diff --git a/split.sh b/split.sh new file mode 100755 index 0000000..416d425 --- /dev/null +++ b/split.sh @@ -0,0 +1,25 @@ +#/bin/sh + +if [ "$#" -ne 3 ]; then + echo "Usage: $0 <filename.wav> <chunk size in seconds> <dataset path>" + exit +fi + +fn=$1 +chunk_size=$2 +dataset_path=$3 + +converted=".temp2.wav" +rm -f $converted +ffmpeg -y -hide_banner -loglevel error -i $fn -ac 1 -ar 24000 $converted + +mkdir $dataset_path +length=$(ffprobe -i $converted -show_entries format=duration -v quiet -of csv="p=0") +end=$(echo "$length / $chunk_size - 1" | bc) +echo "splitting..." +for i in $(seq 0 $end); do + id=$(printf "%04d" $i) + ffmpeg -y -hide_banner -loglevel error -ss $(($i * $chunk_size)) -t $chunk_size -i $converted "${dataset_path}/${dataset_path}_${id}.wav" +done +echo "done" +rm -f $converted |
