Gary Sieling

Convert a folder of mp3s into 1 second wav files with SOX

for i in $( ls sources ); do
  sox sources/$i -b 16 samples-processed/$i channels 1  
done

idx=0
for f in `ls samples-processed/*.wav`
do
  for i in `seq 0 240`
  do
    filename=$(basename "$f")
    filename="${filename%.*}"
 	  
    #echo $i
    #echo $(($i + 1))
    #echo $f
    out=samples/$idx.wav
    sox "$f" -b 16 "$out" trim $i 1.000 channels 1 
    idx=$(($idx + 1))
  done  
done 

cd samples
find *.wav -size -80k -exec rm {} \;
Exit mobile version