-
Notifications
You must be signed in to change notification settings - Fork 0
/
empi_2_run.sh
executable file
·95 lines (88 loc) · 2.27 KB
/
empi_2_run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
servo=1 # default on
# 0 = off, 1 = on, 2 = disconnected
model=2 # default off
# 0 = noise, 1 = synth, 2 = human
# Process arguments
for arg in "$@"
do
if [ "$arg" == "--noise" ]
then
echo "Noise Model"
model=0
elif [ "$arg" == "--synth" ]
then
echo "Synth Model"
model=1
elif [ "$arg" == "--human" ]
then
echo "Human Model"
model=2
elif [ "$arg" == "--noservo" ]
then
echo "No Servo Mode"
servo=0
elif [ "$arg" == "--servo" ]
then
echo "Servo Mode"
servo=1
elif [ "$arg" == "--disco" ]
then
echo "Disconnected Servo Mode"
servo=2
fi
done
# Set volume
amixer sset 'PCM' 95%
# Start opening software.
cd /home/pi/empi
# start the alsa midi interface.
if [ $servo -eq 0 ]
then
## no servo
python3 empi_alsa_midi_interface.py &
# --screen
echo "No Servo Mode"
elif [ $servo -eq 1 ]
then
## connected servo
python3 empi_alsa_midi_interface.py --servo &
# --screen
echo "Servo Mode"
elif [ $servo -eq 2 ]
then
## disconnect servo
python3 empi_alsa_midi_interface.py &
# --screen
else
echo "No servo mode chosen, shutting down."
fi
# Start Pd
pd -nogui -alsamidi -audiooutdev 1 -audiobuf 50 -mididev 128 -noadc -nrt -verbose -open synth/lever_synthesis_midi.pd &
# Connect MIDI IO
sleep 4
aconnect EMPIMIDI:1 Pure\ Data:0
aconnect Pure\ Data:1 EMPIMIDI:0
# wait a bit
sleep 3
# Start prediction server
if [ $model -eq 0 ]
then
echo "Noise Model"
python3 predictive_music_model.py -d=2 --modelfile="models/musicMDRNN-dim2-layers2-units32-mixtures5-scale10-noise.h5" --modelsize xs --call --log --verbose
elif [ $model -eq 1 ]
then
echo "Synth Model"
python3 predictive_music_model.py -d=2 --modelfile="models/musicMDRNN-dim2-layers2-units32-mixtures5-scale10-synth.h5" --modelsize xs --call --log --verbose
elif [ $model -eq 2 ]
then
echo "Human Model"
python3 predictive_music_model.py -d=2 --modelfile="models/musicMDRNN-dim2-layers2-units32-mixtures5-scale10-human.h5" --modelsize xs --call --log --verbose
else
echo "No model chosen, shutting down."
fi
# Start interface
#python3 empi_2_runloop.py --screen
# After the RNN box controller exits, stop Pd
pkill -u pi pd
pkill -u pi python3