#!/bin/bash # this script is written by Peter Plessas # and was published through http://plessas.mur.at # It is released under the GNU/GPL license # and requires sox # # This is version 20161211 # check if the input file exists and is readable if [ ! -f $1 ]; then echo "Input file does not exist or is not readable"; exit 1; fi # if two arguments, we set threshold to default value 0.02 if [ "$#" -lt 3 ] then sox $1 $2 silence 1 0 2% reverse silence 1 0 2% reverse else sox $1 $2 silence 1 0 $3 reverse silence 1 0 $3 reverse fi