]> de.git.xonotic.org Git - xonotic/mediasource.git/blob - sound/weapons/tuba_loopnote_maker.sh
update for fluidsynth
[xonotic/mediasource.git] / sound / weapons / tuba_loopnote_maker.sh
1 #!/bin/sh
2
3 set -ex
4
5 (
6         cd loopfinder
7         gcc -o findloop findloop.c -lfftw3 -Wall -Wextra -ffast-math -lsndfile -O3
8 )
9
10 synth=$1; shift
11 program=$1; shift
12 tubaid=$1; shift
13
14 case "$synth" in
15         timidity)
16                 timidity -Ow -EI$program "$@" -o out.wav tuba_loopnote_maker.mid
17                 normalize out.wav
18                 ;;
19         fluidsynth)
20                 {
21                         echo "prog 0 $program"
22                 } > in.cfg
23                 fluidsynth -f in.cfg -n -i -l -T wav -F out.wav "$@" tuba_loopnote_maker.mid
24                 normalize out.wav
25                 ;;
26 esac
27
28 exit
29
30 start=0
31 step=4
32 loop=1.0
33 len=1.5
34 for note in -18 -12 -6 0 6 12 18 24; do
35         sox out.wav n$note.wav \
36                 trim $start $step \
37                 silence 1 1s 0
38
39         fn=tuba"$tubaid"_loopnote"$note".ogg 
40
41         # now find loop point
42         loopfinder/findloop n$note.wav 4096 $len $loop t$note.wav | while read -r SAMPLES SECONDS; do
43                 oggenc -q9 -o "$fn" -c "LOOP_START=$SAMPLES" t$note.wav
44         done
45
46         # next!
47         start=$(($start+$step))
48 done