#!/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 # usage: # mg_overlay infile outfile outdur_sec # create a temporary work directory in the directory of the output file mkdir -p /tmp/overlayTmpDir # splice input file into segments of outdur_sec length and store into temporary directory sox "$1" /tmp/overlayTmpDir/output.wav trim 0 $3 : newfile : restart # mix splices together and normalize sox -m "/tmp/overlayTmpDir/output*.wav" "$2" norm # remove temporary directory rm -r /tmp/overlayTmpDir # TODO # make this work without tmp dir and use sox's stdin function. # due to the creation/deletion of overlayTmpDir only one invocation of this script can be active # howto create a unique directory name? # check for correct number and type of arguments, if files and directories are writeable and if awk and sox(i) are installed # suppress SoX warnings