From a125bdde52461839e42b3abae07a88f776563547 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 1 Dec 2016 11:10:32 +0100 Subject: --temp und --reject neu --- sound-cutter.in | 55 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/sound-cutter.in b/sound-cutter.in index 526fb07..666e32f 100644 --- a/sound-cutter.in +++ b/sound-cutter.in @@ -13,7 +13,11 @@ verwendung() { >&2 echo ' -n, --dummy nur auszuführenden Befehl anzeigen und nichts tun' >&2 echo ' -o, --output=outputDatei Zieldatei' >&2 echo ' -p, --points=pointsDatei Punktedatei' + >&2 echo ' -r, --reject=Kanal,Frequenz,Breite,Harmonische' + >&2 echo ' blocke in Kanal Frequenz, Frequenz*2 ...' + >&2 echo ' Frequenz*Harmonische, jeweils mit Breite (-3dB)' >&2 echo ' -s, --sampleRate=Rate alternative Samplerate zum Abspeichern' + >&2 echo ' -t, --temp=tempDir alternatives temporäres Verzeichnis für sox' >&2 echo \ '#HELPTEXT# #' [ -z "$1" ] && exit 1 || exit $1 @@ -38,7 +42,7 @@ timetosample() { me="$(readlink -f "$0")" eval set -- "$( - getopt -o 1acfi:no:p:s: \ + getopt -o 1acfi:no:p:r:s:t: \ --long noGain \ --long ausfuehrlich \ --long cd \ @@ -48,7 +52,9 @@ eval set -- "$( --long dummy \ --long output: \ --long points: \ + --long reject: \ --long sampleRate: \ + --long tempDir: \ --long version \ -n "$(basename "$0")" -- "$@" || \ echo verwendung @@ -96,11 +102,30 @@ while true; do [ -n "${points}" ] && echo 'Ich kann nur eine Point-Datei-Option verstehen.' && verwendung points="$1" ;; + -r|--reject) + shift + tmp="$1" + kanal="${tmp%%,*}" + tmp="${tmp#*,}" + freq="${tmp%%,*}" + tmp="${tmp#*,}" + breite="${tmp%%,*}" + maxn="${tmp#*,}" + for ((i=1; i<=$maxn; i++)) + do + rejects[${kanal}]="${rejects[${kanal}]} bandreject $[${i}*${freq}] ${breite}" + done + ;; -s|--sampleRate) shift [ -n "${outRate}" ] && echo 'Ich kann nur eine Samplerate-Option verstehen.' && verwendung outRate="$1" ;; + -t|--tempDir) + shift + [ -n "${tempDir}" ] && echo 'Ich kann nur ein temporäres Verzeichnis verstehen.' && verwendung + tempDir="$1" + ;; --version) >&2 echo '#VERSION#' exit 0 @@ -144,6 +169,8 @@ echo "${points}" | grep -q "\s" && \ >&2 echo "Bitte keine Leerzeichen im points-Dateinamen!" && \ exit 1 +[ -n "${tempDir}" ] && tempDir="--temp ${tempDir}" + if [ -e "${output}" ] then if ${force} @@ -367,17 +394,23 @@ then remixcmd="${remixcmd} gain -n" fi -echo sox -M "${inputs[@]}" -p trim ${firstline} -echo sox -t sox - -p ${repcmd} -echo sox -t sox - -p ${trackmodcmd} -echo sox -t sox - ${extraIn} -p ${splicecmd} ${remixcmd} -echo sox -t sox - ${output} ${trimcmd} +for ((i=0; i<=${#inputs[@]}; i++)) +do + [ -z "${rejects[${i}]}" ] && continue + inputs[${i}]="|sox ${inputs[${i}]} -p${rejects[${i}]}" +done + +echo sox ${tempDir} -M "${inputs[@]}" -p trim ${firstline} +echo sox ${tempDir} -t sox - -p ${repcmd} +echo sox ${tempDir} -t sox - -p ${trackmodcmd} +echo sox ${tempDir} -t sox - ${extraIn} -p ${splicecmd} ${remixcmd} +echo sox ${tempDir} -t sox - ${output} ${trimcmd} if ! ${dummy} then - sox -M "${inputs[@]}" -p trim ${firstline}| \ - sox -t sox - -p ${repcmd} | \ - sox -t sox - -p ${trackmodcmd} | \ - sox -t sox - ${extraIn} -p ${splicecmd} ${remixcmd} | \ - sox -t sox - ${output} ${trimcmd} + sox ${tempDir} -M "${inputs[@]}" -p trim ${firstline}| \ + sox ${tempDir} -t sox - -p ${repcmd} | \ + sox ${tempDir} -t sox - -p ${trackmodcmd} | \ + sox ${tempDir} -t sox - ${extraIn} -p ${splicecmd} ${remixcmd} | \ + sox ${tempDir} -t sox - ${output} ${trimcmd} fi -- cgit v1.2.3-54-g00ecf