This repository has been archived by the owner on Aug 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug.html
103 lines (93 loc) · 4.89 KB
/
debug.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
<html lang="en">
<head>
<title>Piano Scribe</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<link id="favicon" rel="icon" href="https://magenta.tensorflow.org/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="style.css">
<script>
// Microphone access is disabled in Android for http.
if (location.protocol != 'https:') {
location.href = 'https:' + window.location.href.substring(window.location.protocol.length);
}
</script>
<script src="https://cdn.jsdelivr.net/npm/@magenta/music@1.2"></script>
<script src="./app.js" defer></script>
</head>
<body>
<div class="box">
<div class="top">
<div id="modelLoading">
<span>Loading model...</span>
</div>
<div id="modelReady" hidden>
<audio id="recorderPlayer" controls></audio>
<label class="button" id="btnUpload" disabled>
<span class="text">Upload files <input type="file" id="fileInput" multiple="multiple"></span></span>
<span class="loading">Transcribing...</span>
</label>
<span>or</span>
<button class="button" id="btnRecord" disabled>
<span class="text">Record audio</span>
<span class="loading">Transcribing...</span>
</button>
<div id="recordingError" hidden>Oh no, recording audio is not available on your device 😰. Try uploading a file instead!</div>
</div>
</div>
<div class="middle">
<div id="players" hidden>
<button class="button player active" onclick="setActivePlayer(event, false)" id="pianoBtn">Piano</button>
<button class="button player" onclick="setActivePlayer(event, true)">Synth</button>
</div>
<div id="transcribingMessage" hidden>
Longer audio takes a fair bit to transcribe, and will make your browser sluggish. Please hold while
your robots are hard at work...
<div id="safariWarning" hidden><br><br>It looks like you're using Safari! Unfortunately because of a
<a href="https://github.com/WebKit/webkit/blob/4a4870b75b95a836b516163d45a5cbd6f5222562/Source/WebCore/Modules/webaudio/AudioContext.cpp#L109">WebKit bug</a>,
transcription is significantly slower on Safari than other browsers.
</div>
</div>
<div class="container" id="container" hidden>
<canvas id="canvas"></canvas>
</div>
<div class="icon" id="playIcon" hidden >
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path xmlns="http://www.w3.org/2000/svg" d="M8 5v14l11-7z"/>
<path xmlns="http://www.w3.org/2000/svg" d="M0 0h24v24H0z" fill="none"/>
</svg>
</div>
<div class="icon" id="pauseIcon" hidden>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path xmlns="http://www.w3.org/2000/svg" d="M0 0h24v24H0z" fill="none"/>
<path xmlns="http://www.w3.org/2000/svg" d="M6 6h12v12H6z"/>
</svg>
</div>
<button class="button save" onclick="saveMidi(event)" id="saveBtn" hidden>Save MIDI</button>
<div id="help">
<h1>Piano Scribe</h1>
<p>
This app converts raw audio to MIDI using <a href="https://g.co/magenta/onsets-frames">Onsets and Frames</a>, a neural network trained for polyphonic
piano transcription. Record yourself playing piano or choose an audio file with solo piano from your device to transcribe!</p>
<p>Don't have a piano? Try singing to it to see what your voice sounds like played by a piano! Your voice isn't a piano though, so it
might not sound like you at all 😅.</p>
<p>All of the processing happens locally in the browser using <a href="https://g.co/magenta">Magenta.js</a> and
<a href="https://js.tensorflow.org/">TensorFlow.js</a>.</p>
</div>
</div>
<div class="bottom">
<div>Made with <a href="https://magenta.tensorflow.org/js" class="img-link">
<img src="https://magenta.tensorflow.org/assets/magenta-logo.png" height="50" style="vertical-align:middle"></a>.
</div>
<div>See the code on <a href="https://github.com/laqieer/piano-scribe">GitHub</a> /
<a href="https://glitch.com/~piano-scribe-laqieer">Glitch</a>.</div>
</div>
</div>
<script>
if (!window.MediaRecorder) {
document.write(decodeURI('%3Cscript src="./polyfill.js">%3C/script>'))
}
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.8/FileSaver.min.js" defer></script>
</body>
</html>