-
Notifications
You must be signed in to change notification settings - Fork 415
/
index.html
243 lines (198 loc) · 6.1 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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<html>
<head>
<title>Model comparison</title>
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="filenamesAndModels.js"></script>
</head>
<style>
.navbar {
overflow: hidden;
background-color: #333;
font-family: Arial, Helvetica, sans-serif;
}
.navbar a {
float: left;
font-size: 16px;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.dropdown {
float: center;
overflow: hidden;
}
.dropdown .dropbtn {
cursor: pointer;
font-size: 16px;
border: none;
outline: none;
color: white;
padding: 14px 16px;
background-color: inherit;
font-family: inherit;
margin: 0;
}
.navbar a:hover, .dropdown:hover .dropbtn, .dropbtn:focus {
background-color: red;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
float: none;
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {
background-color: #ddd;
}
.show {
display: block;
}
</style>
<script>
var currentCount = 0;
var currentFile = fileNames[currentCount];
console.log(currentCount);
console.log(currentFile);
var modelsCount = baseUrls.length;
var filesCount = fileNames.length;
var modifiedFiles = []
</script>
<div class="navbar">
<button class="btn btn-primary btn-lg" onclick="loadMsRecordings()">MS Recordings</button>
<button class="btn btn-primary btn-lg" onclick="loadAudiosetRecordings()">Audioset Recordings</button>
<button class="btn btn-primary btn-lg" onclick="loadReverbRecordings()">Synthetic Reverb Recordings</button>
<button class="btn btn-primary btn-lg" onclick="loadNoReverbRecordings()">Synthetic NoReverb Recordings</button>
Enter the noise type to filter on<input type="text" name="noiseType"></input><button class="btn btn-info btn-lb" onclick="searchNoiseType()">Search noise type</button>
</div>
<div class="container">
<h2>Audio Clips</h2>
<table class="table" id="table2">
<tbody>
<tr><td>Index</td><td id="index"></td></tr>
<tr><td>Progress</td><td><div class="progress"><div class="progress-bar" role="progressbar" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">25%</div></div></td></tr>
<tr><td>Clipname</td><td id="clipname"></td></tr>
</tbody>
</table>
<div class="row">
<button class="btn btn-success btn-lg" onclick="previous()" style="margin: 10px"> Previous</button>
<button class="btn btn-primary btn-lg" onclick="next()" style="margin: 10px"> Next</button>
<button class="btn btn-primary btn-lg" onclick="skip10()" style="margin: 10px"> Skip 10</button>
<button class="btn btn-primary btn-lg" onclick="skip100()" style="margin: 10px"> Skip 100</button>
</div>
</div>
<script>
// setup
function setupIndexAndClip(){
let current = ((currentCount+1)*100/filesCount)+"%";
$("#index").html((currentCount+1)+" / "+filesCount);
if(modifiedFiles.length > 0) {
current = ((currentCount+1)*100/modifiedFiles.length)+"%";
$("#index").html((currentCount+1)+" / "+modifiedFiles.length);
}
$(".progress-bar").css("width", current);
$(".progress-bar").html(current);
$("#clipname").html(currentFile);
}
function setupSrcs(){
setupIndexAndClip();
for(let i=0; i<modelsCount; i++)
$("#clip"+i).attr("src", baseUrls[i]+currentFile);
}
function changeFileSet(prefix) {
modifiedFiles = [];
for(let i=0; i<filesCount; i++) {
if(fileNames[i].startsWith(prefix)) {
modifiedFiles.push(fileNames[i]);
}
}
currentCount = 0;
currentFile = modifiedFiles[currentCount];
setupSrcs();
}
function loadMsRecordings() {
changeFileSet("ms_");
}
function loadAudiosetRecordings() {
changeFileSet("audioset_");
}
function loadReverbRecordings() {
changeFileSet("reverb_");
}
function loadNoReverbRecordings() {
changeFileSet("noreverb_");
}
function searchNoiseType() {
modifiedFiles = [];
for(let i=0; i<filesCount; i++) {
console.log(document.getElementsByName('noiseType')[0].value);
if(fileNames[i].includes(document.getElementsByName('noiseType')[0].value)) {
modifiedFiles.push(fileNames[i]);
}
}
currentCount = 0;
if(modifiedFiles.length > 0) {
currentFile = modifiedFiles[currentCount];
} else {
currentFile = fileNames[currentCount];
}
setupSrcs();
}
function moveNextOrPrev(valueToAdd) {
if(modifiedFiles.length == 0) {
if(currentCount == (filesCount - valueToAdd))
alert("This is the last Clip. Hit 'Previous' to load the previous clip, or you may close the browser. ");
else{
currentCount = currentCount + valueToAdd;
currentFile = fileNames[currentCount];
setupSrcs();
}
} else {
if(currentCount == (modifiedFiles.length - valueToAdd))
alert("This is the last Clip. Hit 'Previous' to load the previous clip, or you may close the browser. ");
else{
currentCount = currentCount + valueToAdd;
currentFile = modifiedFiles[currentCount];
setupSrcs();
}
}
}
// set the scr to the next values on clicking next
function next(){
moveNextOrPrev(1);
}
function skip10(){
moveNextOrPrev(10);
}
function skip100(){
moveNextOrPrev(100);
}
function previous(){
if(currentCount == 0)
alert("This is the very first Clip. Hit 'Next' to load the next clip. ");
else{
currentCount--;
currentFile = fileNames[currentCount];
if(modifiedFiles.length > 0)
currentFile = modifiedFiles[currentCount];
setupSrcs();
}
}
setupIndexAndClip();
var tbody = $("#table2>tbody");
for(let i=0; i<modelsCount; i++)
tbody.append("<tr><td>"+modelsUsed[i]+"</td><td><audio controls id=clip"+i+" src='"+baseUrls[0]+currentFile+"' type='audio/wav'></audio></td></tr>");
</script>
</html>