#!/bin/bash

for f in $(ls *.wav)
do
        id=$(basename $f ".wav")
        dur=$(sox $f -n stat 2>&1 | sed -n 's#^Length (seconds):[^0-9]*\([0-9.]*\)$#\1#p' | awk -F "." '{print $1}')
        expr $dur + 0
        mid=$(( $dur / 2 ))
        sox $f ${id}_0_${mid}.wav trim 0 $mid
        sox $f ${id}_${mid}_${dur}.wav trim $mid $dur
done

 

posted on 2020-06-20 08:14  liuyihua1992  阅读(399)  评论(0编辑  收藏  举报