Debian Codegraph @

tests/impulse-tests/deprecated/faust2impulse6

raw symbols SCIP
1 #!/bin/bash
2
3 #####################################################################
4 # #
5 # Compiles Faust programs to impulse tests #
6 # (c) Grame, 2017 #
7 # #
8 #####################################################################
9
10
11 #-------------------------------------------------------------------
12 # Set Faust include path
13
14 if [ -f $FAUST_LIB_PATH/music.lib ]
15 then
16 FAUSTLIB=$FAUST_LIB_PATH
17 elif [ -f /usr/local/share/faust/all.lib ]
18 then
19 FAUSTLIB=/usr/local/share/faust/
20 elif [ -f /usr/share/faust/all.lib ]
21 then
22 FAUSTLIB=/usr/share/faust/
23 else
24 echo "ERROR : $0 cannot find Faust library dir (usually /usr/local/share/faust)"
25 fi
26
27 for p in $@; do
28 if [ ${p:0:1} = "-" ]; then
29 OPTIONS="$OPTIONS $p"
30 elif [[ -f "$p" ]]; then
31 FILES="$FILES $p"
32 else
33 OPTIONS="$OPTIONS $p"
34 fi
35 done
36
37 #-------------------------------------------------------------------
38 # compile the *.dsp files
39
40 for f in $FILES; do
41
42 name=$(basename "$f" .dsp)
43 dirname=$(dirname "$f");
44
45 # compile Faust to wasm
46 faust $OPTIONS -lang wasm-i "$f" -o "${f%.dsp}.wasm" || exit
47
48 # create the nodejs ready file
49 cd $dirname
50 sed -e "s/mydsp/"$name"/g" "$name.js" >> "$name-tmp1.js"
51 sed -e "s/mydsp/"$name"/g" $FAUSTLIB/webaudio/wasm-standalone-node-wrapper-double.js >> "$name-tmp1.js"
52 sed -e "s/DSP/"$name"/g" "$name-tmp1.js" >> "$name-tmp2.js"
53
54 # run the binary to generate the impulse response
55 node --expose-wasm $name-tmp2.js || exit
56
57 # cleanup
58 rm $name-tmp1.js $name-tmp2.js $name.js $name.wasm
59
60 done
61