-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
56 lines (55 loc) · 1.67 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>speech2sing</title>
<script src="js/swLoader.js" charset="utf-8"></script>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<h1>speech2sing</h1>
<h2>Turn talking into singing!</h2>
<p>See report <a href="Report.pdf">here</a> (PDF, Traditional Chinese)</p>
<p>Or listen to <a href="demo.html">some demo</a></p>
<ul>
<li><a href='record.html'>Record in browser</a></li>
<li><a href='changepitch.html'>Change pitch by changing playback speed</a></li>
<li><a href='pitch.html'>Detect pitch</a></li>
<li><a href='segment.html'>Segment each word</a></li>
<li><a href='makesong.html'>Make song</a></li>
<li><a href='beat.html'>Beat tracking (experimental)</a></li>
<li><a href='persist.html'>Request persistent storage</a></li>
</ul>
<p>
<span id=lblCached>This app can be accessed offline.</span>
<button id=btnUpdateCache>Update</button>
<button id=btnDropCache>Drop Cache</button>
</p>
<script>
function sendToServiceWorker(cmd) {
try {
return fetch(cmd).then(function (ret) {
return ret.text();
}).then(function (txt) {
if (txt === 'ok') return alert('ok'), true;
else alert('fail ;-(');
})['catch'](function () {
alert('service worker might be broken');
});
}
catch (c) {
alert('your browser is too old!');
}
}
btnUpdateCache.onclick = function () {
sendToServiceWorker('cacheControl/update').then(function (yes) {
if (yes) location.reload();
})
};
btnDropCache.onclick = function () {
sendToServiceWorker('cacheControl/drop');
};
</script>
</body>
</html>