forked from Breathinglabs/JS-Breathing-Monitoring
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
221 lines (175 loc) · 7.95 KB
/
index.html
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<!doctype html>
<html lang="sl">
<head>
<meta charset="utf-8">
<title> BreathingLabs monitoring</title>
<link href="style.css" type="text/css" rel="stylesheet"></link>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="js/main.js"></script>
<script type="text/javascript" src="js/graph.js"></script>
<script type="text/javascript" src="js/textBox.js"></script>
<script type="text/javascript" src="js/algorithm.js"></script>
<script type="text/javascript" src="js/parameters.js"></script>
<script type="text/javascript" src="js/addOns.js"></script>
</head>
<body>
<header class="clearfix">
<div class="content">
<div class="main-title">
<img src="images/header.png">
</div>
<div class="menu">
<ul>
<li><a>Algorithm Explanation</a></li>
<li><a>Set Parameters</a></li>
<li><a href="http://www.breathinglabs.com/">BreathingLabs</a></li>
</ul>
</div>
</div>
</header>
<div id="main">
<div class="content">
<div class="startstop">
<input type="button" value="Start" onClick="startFunction()">
<input type="button" value="Stop" onClick="stopFunction()">
<!--<h3>Audio center</h3>
<audio controls loop>
<source src="images/audiotest center.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<h3>Audio inverted</h3>
<audio controls loop>
<source src="images/audiotest inverted.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>-->
</div>
<!--Explanation-->
<div class="explanation clearfix" style="height:80px;"><h1>Algorithm explanation</h1></div>
<div class="explanation clearfix">
<div class="node node-add">
<p>Source microphone input</p>
</div>
<div class="node node-add">
<p>FFT analyser</p>
</div>
<div class="node node-add">
<p>Now we have Array of 512 elements with values from 0 to 255</p>
</div>
<div class="node node-add" style="width:220px">
<p><b>pow = Frequency power spectrum</b></p>
<img src="images/sum.png">
</div>
<div class="node" style="width:320px">
<p><b>var = variance [power diference]</b></p>
<p>pow(n) - pow(n-1)</p>
<hr>
<p><b>nl = noise level (room signal)</b></p>
<img src="images/var.png" style="width:80%;">
</div>
</div>
<div class="explanation clearfix">
<div class="node_event">
<h1>On event conditions</h1>
<h2>Fast:</h2>
<p> if pow > nl + 5000 (some constant we add to noise level)
we try to grab maximum detected variance (= var_max)on positive variance spike. As soon as variance spike hits in negative direction we check if next 4 variances are inside interval +varmax * 0,4 and -varmax * 0,4.
</p>
<h2>Slow:</h2>
<p>If fast event hasn't triggered .... Check if next 35 pow > nl + 5000 and all variances are bigger than -3000</p>
</div>
<div class="node_event">
<h1>Off event conditions</h1>
<h2>Fast:</h2>
<p> pow < nl + 2000 and variance spike negative > varmax * 0,4 * 0,5
</p>
<h2>Slow:</h2>
<p>If fast event hasn't triggered .... Check if next 35 pow < nl + 2000</p>
</div>
</div>
<div class="explanation clearfix">
<img src="images/expl_1.png">
</div>
<!--Parameters-->
<div class="parameters">
<h1 class="paramChange_title">Parameters</h1>
<div id="checkClick" class="param_hide">
<div class="enter-param enter-param-left">
<h2>On event parameters</h2>
<form name="firstForm">
<div class="form_content">
<h3>Fast:</h3>
<p>pow > noise level + <input type="text" id="onFastFirst" value="5000"><span>&&</span> next <input type="text" id="onFastNum" value="4"> <span class="spanAnd"> variables inside interval -/+ max. var * </span><input type="text" id="onFastSecond" value="0.4"></p>
</div>
<div class="form_content">
<h3>Slow:</h3>
<p>last 35 pow > noise level + 5000 && var > -3000</p>
</div>
</form>
</div>
<div class="enter-param enter-param-left">
<h2>Off event parameters</h2>
<form name="secondForm">
<div class="form_content">
<h3>Fast:</h3>
<p>pow < noise level + <input type="text" id="offFastFirst" value="2000"><span>&&</span>one of previous 5 variances < (-1) * max.var * 0.4 * <input type="text" id="offFastSecond" value="0.5"></p>
</div>
<div class="form_content">
<h3>Slow:</h3>
<p>last <input type="text" id="offSlowFirst" value="10"> <span class="spanOff">pow < noise level + <input type="text" id="offSlowSecond" value="2000"></span></p>
</div>
</form>
</div>
<div class="enter-param clearfix">
<p id="paramWarning"></p>
<input id="SubmitValue" type="button" value="submit" onClick="changeValues()">
</div>
</div>
<!--
<div class="parametersBar param_hide clearfix">
<div class="showParam"style="width:100%"><h2>On events param:</h2></div>
<hr>
<div class="showParam"><h3>noise level constant:<span id="par_10">Empty</span></h3></div>
<div class="showParam"><h3>num of last var:<span id="par_11">Empty</span></h3></div>
<div class="showParam"><h3>min. var constant:<span id="par_12">Empty</span></h3></div>
</div>
<div class="parametersBar param_hide clearfix">
<div class="showParam"style="width:100%"><h2>Off events param:</h2></div>
<hr>
<div class="showParam"><h3>fast noise level constant:<span id="par_13">Empty</span></h3></div>
<div class="showParam"><h3>min. var constant:<span id="par_14">Empty</span></h3></div>
</div> -->
<div class="parametersBar clearfix">
<div class="showParam"><h3>Power:<span id="par_1">Empty</span></h3></div>
<div class="showParam"><h3>Noise level:<span id="par_2">Empty</span></h3></div>
<div class="showParam"><h3>TOF: <span id="par_3">Empty</span></h3></div>
<div class="showParam"><h3>Variance: <span id="par_5">Empty</span></h3></div>
<div class="showParam"><h3>Max variable:<span id="par_6">Empty</span></h3></div>
<div class="showParam"><h3>On var interval:<span id="par_7">Empty</span></h3></div>
<div class="showParam"><h3>Off thr var:<span id="par_8">Empty</span></h3></div>
<div class="showParam"><h3>Blow status:<span id="par_4">Empty</span></h3></div>
</div>
</div>
<div class="graph">
<h2>Real time microphone Frequency & Time domain</h2>
<div class="canvas_group_1 clearfix">
<div class="canvas_in">
<p class="graphTitles"> <span id="scrollStatus" style="color:red">No Exhelation</span><span style="margin-left:20px; border-left:2px solid white;padding-left:20px;">Frequency amplitude window</span></p>
<canvas id="main_graph" class="width_graph" width="1300" height="256"></canvas>
</div>
<div class="canvas_in">
<p class="graphTitles"> <span id="scrollStatus_2" style="color:red">.... false</span> <span style="margin-left:20px; border-left:2px solid white;padding-left:20px;">Frequency amplitude variance</span></p>
<canvas id="variance_graph" width="1300" height="256"></canvas>
</div>
</div>
</div>
<!-- For text output-->
<div class="arrayDiv">
<input type="button" value="Start" id="showFft" onClick="displayData.startTextb('true')">
<input type="button" value="Stop" id="showFft" onClick="displayData.stopTextb()">
<input type="button" value="Clear all" id="clear" onClick="displayData.clearTb()">
<p style="float:right; font-size:20px;">Copy all data into Excel or Spreadsheet go to Data > text to columns and separate by | character</p>
</div>
<textarea id="textbox" rows="25" cols="187" style="text-align:left"></textarea>
</div>
</div>
</body>