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 {} \;
Looking for a good programming book? Code Complete influenced me a lot as a programmer trying to write better code.
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *