gcc -o findloop findloop.c -lfftw3 -Wall -Wextra -ffast-math -lsndfile -O3
)
+t=`mktemp -dt loopfinder.XXXXXX`
+trap 'rm -rf "$t"' EXIT
+
synth=$1; shift
program=$1; shift
velocity=$1; shift
loopmax=1.5
len=1.8
-perl tuba_loopnote_maker.mid.pl tuba_loopnote_maker.mid $delta $program $velocity $transpose -18 -12 -6 0 6 12 18 24
+perl tuba_loopnote_maker.mid.pl "$t"/tuba_loopnote_maker.mid $delta $program $velocity $transpose -18 -12 -6 0 6 12 18 24
case "$synth" in
timidity)
- timidity -Ow "$@" -o out.wav tuba_loopnote_maker.mid
- normalize out.wav
+ timidity -Ow "$@" -o "$t"/out.wav "$t"/tuba_loopnote_maker.mid
;;
fluidsynth)
- fluidsynth -v -n -i -l -T wav -F out.wav "$@" tuba_loopnote_maker.mid
- normalize out.wav
+ fluidsynth -v -n -i -l -T wav -F "$t"/out.wav "$@" "$t"/tuba_loopnote_maker.mid
;;
esac
+normalize "$t"/out.wav
start=$delta
step=$(($delta*2))
for note in -18 -12 -6 0 6 12 18 24; do
- sox out.wav n$note.wav \
+ sox "$t"/out.wav "$t"/n$note.wav \
trim $start $step \
silence 1 1s 0
fn=tuba"$tubaid"_loopnote"$note".ogg
# now find loop point
- loopfinder/findloop n$note.wav $fftsize $len $loopmin $loopmax t$note.wav | while read -r SAMPLES SECONDS; do
- oggenc -q9 -o "$fn" -c "LOOP_START=$SAMPLES" t$note.wav
+ loopfinder/findloop "$t"/n$note.wav $fftsize $len $loopmin $loopmax "$t"/t$note.wav | while read -r SAMPLES SECONDS; do
+ oggenc -q9 -o "$fn" -c "LOOP_START=$SAMPLES" "$t"/t$note.wav
done
# next!
start=$(($start+$step))
done
+
+exit 0