Spaces:
Running
Running
Delete midi_viz.html
Browse files- midi_viz.html +0 -92
midi_viz.html
DELETED
@@ -1,92 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html lang="en">
|
3 |
-
|
4 |
-
<head>
|
5 |
-
<style>
|
6 |
-
#midi-section midi-player {
|
7 |
-
display: block;
|
8 |
-
width: inherit;
|
9 |
-
margin: 4px;
|
10 |
-
margin-bottom: 0;
|
11 |
-
}
|
12 |
-
|
13 |
-
#midi-section midi-player::part(control-panel) {
|
14 |
-
background: #ff5;
|
15 |
-
border: 2px solid #000;
|
16 |
-
border-radius: 10px 10px 0 0;
|
17 |
-
}
|
18 |
-
|
19 |
-
#midi-section midi-player::part(play-button) {
|
20 |
-
color: #353;
|
21 |
-
border: 2px solid currentColor;
|
22 |
-
background-color: #4d4;
|
23 |
-
border-radius: 20px;
|
24 |
-
transition: all 0.2s;
|
25 |
-
content: "hello";
|
26 |
-
}
|
27 |
-
|
28 |
-
#midi-section midi-player::part(play-button):hover {
|
29 |
-
color: #0a0;
|
30 |
-
background-color: #5f5;
|
31 |
-
border-radius: 10px;
|
32 |
-
}
|
33 |
-
|
34 |
-
#midi-section midi-player::part(time) {
|
35 |
-
font-family: monospace;
|
36 |
-
}
|
37 |
-
|
38 |
-
#midi-section midi-visualizer .piano-roll-visualizer {
|
39 |
-
background: #ffd;
|
40 |
-
border: 2px solid black;
|
41 |
-
border-top: none;
|
42 |
-
border-radius: 0 0 10px 10px;
|
43 |
-
margin: 4px;
|
44 |
-
margin-top: 0;
|
45 |
-
overflow: auto;
|
46 |
-
}
|
47 |
-
|
48 |
-
#midi-section midi-visualizer svg rect.note {
|
49 |
-
opacity: 0.6;
|
50 |
-
stroke-width: 2;
|
51 |
-
}
|
52 |
-
|
53 |
-
#midi-section midi-visualizer svg rect.note[data-instrument="0"] {
|
54 |
-
fill: #e22;
|
55 |
-
stroke: #500;
|
56 |
-
}
|
57 |
-
|
58 |
-
#midi-section midi-visualizer svg rect.note[data-instrument="2"] {
|
59 |
-
fill: #2ee;
|
60 |
-
stroke: #055;
|
61 |
-
}
|
62 |
-
|
63 |
-
#midi-section midi-visualizer svg rect.note[data-is-drum="true"] {
|
64 |
-
fill: #888;
|
65 |
-
stroke: #888;
|
66 |
-
}
|
67 |
-
|
68 |
-
#midi-section midi-visualizer svg rect.note.active {
|
69 |
-
opacity: 0.9;
|
70 |
-
stroke: #000;
|
71 |
-
}
|
72 |
-
</style>
|
73 |
-
</head>
|
74 |
-
|
75 |
-
<body>
|
76 |
-
<section id="midi-section"><midi-player sound-font="" visualizer="#midi-section midi-visualizer"></midi-player><midi-visualizer></midi-visualizer></section>
|
77 |
-
<script src="https://cdn.jsdelivr.net/combine/npm/tone@14.7.58,npm/@magenta/music@1.23.1/es6/core.js,npm/focus-visible@5,npm/html-midi-player@1.5.0"></script>
|
78 |
-
</body>
|
79 |
-
<script>
|
80 |
-
function base64ToBlobUrl(base64, mimeType = "audio/midi") {
|
81 |
-
const byteCharacters = atob(base64.split(",")[1] || base64);
|
82 |
-
const byteNumbers = new Array(byteCharacters.length);
|
83 |
-
for (let i = 0; i < byteCharacters.length; i++) {
|
84 |
-
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
85 |
-
}
|
86 |
-
return URL.createObjectURL(new Blob([new Uint8Array(byteNumbers)], { type: mimeType }));
|
87 |
-
}
|
88 |
-
let midi_data = "{midi_data}";
|
89 |
-
document.querySelector("midi-player").src = base64ToBlobUrl(midi_data);
|
90 |
-
</script>
|
91 |
-
|
92 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|