-
Notifications
You must be signed in to change notification settings - Fork 33
/
start.sh
executable file
·83 lines (59 loc) · 2.35 KB
/
start.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
#!/bin/bash
# Copyright 2018 Marc René Schädler
#
# This file is part of the mobile hearing aid prototype project
# The the mobile hearing aid prototype project is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
#
# The mobile hearing aid prototype project is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with the mobile hearing aid prototype project. If not, see http://www.gnu.org/licenses/.
# Simple sound configuration
SOUNDDEVICE=audioinjectorpi
SOUNDSTREAM=0
SOUNDCHANNELS=1,2
SAMPLERATE=48000
FRAGSIZE=48
NPERIODS=2
# MHA config
MHACONFIG="openMHA.cfg"
MHAIP=127.0.0.1
MHAPORT=33337
echo ""
echo "OPENMHA EXAMPLE FOR HEARING AID PROTOTYPE"
echo ""
echo "killall thresholdnoise"
killall thresholdnoise -9 &> /dev/null
echo "killall pink noise"
killall pinknoise -9 &> /dev/null
echo "killall abhang"
killall abhang -9 &> /dev/null
echo "killall mha"
killall mha -9 &> /dev/null
echo "killall jackd"
killall jackd -9 &> /dev/null
echo "killall commander.sh"
killall commander.sh -9 &> /dev/null
echo "killall octave-cli"
killall octave-cli -9 &> /dev/null
echo "killall tcpserver"
killall tcpserver -9 &> /dev/null
sleep 1
echo "start jackd"
taskset -c 1 jackd --realtime -d alsa -d hw:$SOUNDDEVICE,$SOUNDSTREAM -p $FRAGSIZE -r $SAMPLERATE -n $NPERIODS -s 2>&1 | sed 's/^/[JACKD] /' &
sleep 2
echo "start threshold noise"
(cd tools/signals && taskset -c 2 ./thresholdnoise) | sed 's/^/[THRESHOLDNOISE] /' &
echo "start mha"
taskset -c 3 mha --interface=$MHAIP --port=$MHAPORT "?read:${MHACONFIG}" 2>&1 | sed 's/^/[MHA] /' &
echo "start commander"
[ -e "commandqueue" ] || mkfifo commandqueue
./commander.sh | sed 's/^/[COMMANDER] /' &
sleep 1
echo "connect mha"
jack_connect MHA:out_1 system:playback_2
jack_connect MHA:out_2 system:playback_1
echo "initial commands"
echo feedback 3 > commandqueue
echo "start network command server"
tcpserver -H -R 0.0.0.0 33338 ./netcommand.sh | sed 's/^/[NETCMD] /' &
(cd tools && octave-cli --eval "userinterface")