Spaces:
Sleeping
Sleeping
Finishing MVP
Browse files- README.md +3 -5
- src/keyarrange/piano/transforms.py +2 -2
- src/keyarrange/pipeline.py +3 -3
- web/index.html +77 -102
README.md
CHANGED
|
@@ -74,19 +74,17 @@ The quick test: can a pianist sight-read it at moderate tempo, clearly assign ha
|
|
| 74 |
## Roadmap
|
| 75 |
|
| 76 |
**v1 — in progress**
|
| 77 |
-
- [
|
| 78 |
-
- [
|
| 79 |
-
- [
|
| 80 |
|
| 81 |
**v2 — planned**
|
| 82 |
- [ ] Chord-aware left hand voicing (root + third + fifth from chord analysis)
|
| 83 |
- [ ] MuseScore PDF rendering
|
| 84 |
-
- [ ] Before/after example gallery
|
| 85 |
|
| 86 |
**v3 — planned**
|
| 87 |
- [ ] Beat tracking with madmom for better metric strength scoring
|
| 88 |
- [ ] Melody smoothing — strip ornaments and melisma from vocal transcription
|
| 89 |
-
- [ ] Difficulty score on output
|
| 90 |
|
| 91 |
**Later**
|
| 92 |
- [ ] Fine-tuned arrangement model on POP909 dataset
|
|
|
|
| 74 |
## Roadmap
|
| 75 |
|
| 76 |
**v1 — in progress**
|
| 77 |
+
- [x] End-to-end pipeline: audio → MIDI
|
| 78 |
+
- [x] Three core playability transforms (density, span, note cap)
|
| 79 |
+
- [x] Web UI with MIDI download
|
| 80 |
|
| 81 |
**v2 — planned**
|
| 82 |
- [ ] Chord-aware left hand voicing (root + third + fifth from chord analysis)
|
| 83 |
- [ ] MuseScore PDF rendering
|
|
|
|
| 84 |
|
| 85 |
**v3 — planned**
|
| 86 |
- [ ] Beat tracking with madmom for better metric strength scoring
|
| 87 |
- [ ] Melody smoothing — strip ornaments and melisma from vocal transcription
|
|
|
|
| 88 |
|
| 89 |
**Later**
|
| 90 |
- [ ] Fine-tuned arrangement model on POP909 dataset
|
src/keyarrange/piano/transforms.py
CHANGED
|
@@ -22,7 +22,7 @@ def _group_by_onset(notes: list[Note], window_ms: float = 50.0) -> list[list[Not
|
|
| 22 |
|
| 23 |
return groups
|
| 24 |
|
| 25 |
-
def density_reducer(notes: list[Note], bpm: float) -> list[Note]:
|
| 26 |
window_duration = 0.5 # 500ms
|
| 27 |
step_size = 0.25 # 250ms
|
| 28 |
dropped_note_ids = set()
|
|
@@ -37,7 +37,7 @@ def density_reducer(notes: list[Note], bpm: float) -> list[Note]:
|
|
| 37 |
while t <= last_note_start_time + window_duration: # Extend windowing slightly past the last note's start time
|
| 38 |
window_notes = [note for note in notes if t <= note.start < t + window_duration and note.id not in dropped_note_ids]
|
| 39 |
|
| 40 |
-
max_notes_in_window = max(1, int(120 / bpm))
|
| 41 |
|
| 42 |
if len(window_notes) > max_notes_in_window:
|
| 43 |
# Sort by duration (longest first) and keep only the top `max_notes_in_window`
|
|
|
|
| 22 |
|
| 23 |
return groups
|
| 24 |
|
| 25 |
+
def density_reducer(notes: list[Note], bpm: float, multiplier: int = 1) -> list[Note]:
|
| 26 |
window_duration = 0.5 # 500ms
|
| 27 |
step_size = 0.25 # 250ms
|
| 28 |
dropped_note_ids = set()
|
|
|
|
| 37 |
while t <= last_note_start_time + window_duration: # Extend windowing slightly past the last note's start time
|
| 38 |
window_notes = [note for note in notes if t <= note.start < t + window_duration and note.id not in dropped_note_ids]
|
| 39 |
|
| 40 |
+
max_notes_in_window = max(1, int(120 / bpm)) * multiplier
|
| 41 |
|
| 42 |
if len(window_notes) > max_notes_in_window:
|
| 43 |
# Sort by duration (longest first) and keep only the top `max_notes_in_window`
|
src/keyarrange/pipeline.py
CHANGED
|
@@ -61,9 +61,9 @@ class Pipeline:
|
|
| 61 |
quantized_left_notes = quantize_to_beats(left_notes, beat_times)
|
| 62 |
|
| 63 |
logger.info("Applying transformations to Right hand notes...")
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
|
| 68 |
logger.info("Applying transformations to Left hand notes...")
|
| 69 |
left_notes = density_reducer(quantized_left_notes, bpm)
|
|
|
|
| 61 |
quantized_left_notes = quantize_to_beats(left_notes, beat_times)
|
| 62 |
|
| 63 |
logger.info("Applying transformations to Right hand notes...")
|
| 64 |
+
right_notes = density_reducer(right_notes, bpm, multiplier=2) # Allow density relaxation for vocals
|
| 65 |
+
right_notes = span_enforcer(right_notes, max_span=12, hand="right")
|
| 66 |
+
right_notes = note_cap(right_notes, max_notes=3)
|
| 67 |
|
| 68 |
logger.info("Applying transformations to Left hand notes...")
|
| 69 |
left_notes = density_reducer(quantized_left_notes, bpm)
|
web/index.html
CHANGED
|
@@ -4,6 +4,10 @@
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>KeyArrange</title>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
<style>
|
| 8 |
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Mono:wght@400;500&family=DM+Sans:wght@300;400;500&display=swap');
|
| 9 |
|
|
@@ -56,10 +60,7 @@
|
|
| 56 |
margin-bottom: 16px;
|
| 57 |
}
|
| 58 |
|
| 59 |
-
h1 em {
|
| 60 |
-
font-style: italic;
|
| 61 |
-
color: var(--accent);
|
| 62 |
-
}
|
| 63 |
|
| 64 |
.subtitle {
|
| 65 |
font-size: 14px;
|
|
@@ -68,10 +69,8 @@
|
|
| 68 |
line-height: 1.7;
|
| 69 |
}
|
| 70 |
|
| 71 |
-
/* Upload
|
| 72 |
-
.upload-section {
|
| 73 |
-
margin-bottom: 32px;
|
| 74 |
-
}
|
| 75 |
|
| 76 |
.drop-zone {
|
| 77 |
border: 1px dashed var(--border);
|
|
@@ -98,19 +97,8 @@
|
|
| 98 |
height: 100%;
|
| 99 |
}
|
| 100 |
|
| 101 |
-
.drop-icon {
|
| 102 |
-
|
| 103 |
-
font-size: 28px;
|
| 104 |
-
margin-bottom: 12px;
|
| 105 |
-
color: var(--text-dim);
|
| 106 |
-
}
|
| 107 |
-
|
| 108 |
-
.drop-label {
|
| 109 |
-
font-size: 14px;
|
| 110 |
-
color: var(--text-mid);
|
| 111 |
-
margin-bottom: 6px;
|
| 112 |
-
}
|
| 113 |
-
|
| 114 |
.drop-sub {
|
| 115 |
font-family: 'DM Mono', monospace;
|
| 116 |
font-size: 11px;
|
|
@@ -129,7 +117,6 @@
|
|
| 129 |
border: 1px solid rgba(200, 240, 67, 0.2);
|
| 130 |
border-radius: 3px;
|
| 131 |
}
|
| 132 |
-
|
| 133 |
.file-selected.visible { display: flex; }
|
| 134 |
|
| 135 |
.file-name {
|
|
@@ -151,10 +138,8 @@
|
|
| 151 |
line-height: 1;
|
| 152 |
padding: 0 4px;
|
| 153 |
}
|
| 154 |
-
|
| 155 |
.file-clear:hover { color: var(--text); }
|
| 156 |
|
| 157 |
-
/* Arrange button */
|
| 158 |
.btn-arrange {
|
| 159 |
width: 100%;
|
| 160 |
padding: 16px;
|
|
@@ -171,11 +156,7 @@
|
|
| 171 |
margin-top: 12px;
|
| 172 |
transition: all 0.15s;
|
| 173 |
}
|
| 174 |
-
|
| 175 |
-
.btn-arrange:hover:not(:disabled) {
|
| 176 |
-
background: #d8ff55;
|
| 177 |
-
}
|
| 178 |
-
|
| 179 |
.btn-arrange:disabled {
|
| 180 |
background: var(--border);
|
| 181 |
color: var(--text-dim);
|
|
@@ -191,7 +172,6 @@
|
|
| 191 |
border-radius: 3px;
|
| 192 |
margin-top: 20px;
|
| 193 |
}
|
| 194 |
-
|
| 195 |
.status-card.visible { display: block; }
|
| 196 |
|
| 197 |
.status-eyebrow {
|
|
@@ -203,11 +183,7 @@
|
|
| 203 |
margin-bottom: 8px;
|
| 204 |
}
|
| 205 |
|
| 206 |
-
.status-message {
|
| 207 |
-
font-size: 14px;
|
| 208 |
-
color: var(--text-mid);
|
| 209 |
-
line-height: 1.6;
|
| 210 |
-
}
|
| 211 |
|
| 212 |
.progress-bar-track {
|
| 213 |
height: 2px;
|
|
@@ -221,8 +197,6 @@
|
|
| 221 |
height: 100%;
|
| 222 |
background: var(--accent3);
|
| 223 |
border-radius: 2px;
|
| 224 |
-
width: 0%;
|
| 225 |
-
transition: width 0.6s ease;
|
| 226 |
animation: indeterminate 2s ease-in-out infinite;
|
| 227 |
}
|
| 228 |
|
|
@@ -244,15 +218,10 @@
|
|
| 244 |
color: #ff6b6b;
|
| 245 |
font-family: 'DM Mono', monospace;
|
| 246 |
}
|
| 247 |
-
|
| 248 |
.error-card.visible { display: block; }
|
| 249 |
|
| 250 |
/* Results */
|
| 251 |
-
.results-section {
|
| 252 |
-
display: none;
|
| 253 |
-
margin-top: 32px;
|
| 254 |
-
}
|
| 255 |
-
|
| 256 |
.results-section.visible { display: block; }
|
| 257 |
|
| 258 |
.results-header {
|
|
@@ -281,8 +250,8 @@
|
|
| 281 |
color: var(--text);
|
| 282 |
}
|
| 283 |
|
| 284 |
-
/*
|
| 285 |
-
.
|
| 286 |
background: var(--surface);
|
| 287 |
border: 1px solid var(--border);
|
| 288 |
border-radius: 3px;
|
|
@@ -290,48 +259,62 @@
|
|
| 290 |
margin-bottom: 20px;
|
| 291 |
}
|
| 292 |
|
| 293 |
-
.
|
| 294 |
font-family: 'DM Mono', monospace;
|
| 295 |
font-size: 10px;
|
| 296 |
letter-spacing: 0.15em;
|
| 297 |
text-transform: uppercase;
|
| 298 |
color: var(--text-dim);
|
| 299 |
-
padding: 12px 16px
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
width: 100%;
|
| 304 |
-
display: block;
|
| 305 |
}
|
| 306 |
|
| 307 |
-
.
|
| 308 |
display: flex;
|
| 309 |
-
gap:
|
| 310 |
-
padding: 10px 16px 14px;
|
| 311 |
}
|
| 312 |
|
| 313 |
.legend-item {
|
| 314 |
display: flex;
|
| 315 |
align-items: center;
|
| 316 |
-
gap:
|
| 317 |
-
font-size:
|
| 318 |
-
color: var(--text-
|
| 319 |
}
|
| 320 |
|
| 321 |
.legend-dot {
|
| 322 |
-
width:
|
| 323 |
-
height:
|
| 324 |
border-radius: 2px;
|
| 325 |
flex-shrink: 0;
|
| 326 |
}
|
| 327 |
|
| 328 |
-
/*
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 333 |
}
|
| 334 |
|
|
|
|
|
|
|
|
|
|
| 335 |
.btn-download {
|
| 336 |
padding: 12px 20px;
|
| 337 |
background: transparent;
|
|
@@ -349,12 +332,7 @@
|
|
| 349 |
align-items: center;
|
| 350 |
gap: 8px;
|
| 351 |
}
|
| 352 |
-
|
| 353 |
-
.btn-download:hover {
|
| 354 |
-
border-color: var(--accent);
|
| 355 |
-
color: var(--accent);
|
| 356 |
-
}
|
| 357 |
-
|
| 358 |
.btn-download .btn-icon { font-size: 15px; }
|
| 359 |
|
| 360 |
/* Footer */
|
|
@@ -370,7 +348,6 @@
|
|
| 370 |
flex-wrap: wrap;
|
| 371 |
gap: 8px;
|
| 372 |
}
|
| 373 |
-
|
| 374 |
footer a { color: var(--text-dim); text-decoration: none; }
|
| 375 |
footer a:hover { color: var(--accent); }
|
| 376 |
</style>
|
|
@@ -404,11 +381,11 @@
|
|
| 404 |
<!-- Status -->
|
| 405 |
<div class="status-card" id="statusCard">
|
| 406 |
<div class="status-eyebrow">Processing</div>
|
| 407 |
-
<div class="status-message"
|
| 408 |
Separating stems, transcribing, arranging… this takes 1–3 minutes depending on song length.
|
| 409 |
</div>
|
| 410 |
<div class="progress-bar-track">
|
| 411 |
-
<div class="progress-bar-fill"
|
| 412 |
</div>
|
| 413 |
</div>
|
| 414 |
|
|
@@ -422,22 +399,29 @@
|
|
| 422 |
<h2 class="results-title">Your arrangement</h2>
|
| 423 |
</div>
|
| 424 |
|
| 425 |
-
<div class="
|
| 426 |
-
<div class="
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
<div class="legend-item" style="margin-left:auto; font-size:11px; color:var(--text-dim)">
|
| 438 |
-
Dashed line = middle C
|
| 439 |
</div>
|
| 440 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 441 |
</div>
|
| 442 |
|
| 443 |
<div class="download-row">
|
|
@@ -464,16 +448,13 @@
|
|
| 464 |
const fileClear = document.getElementById('fileClear');
|
| 465 |
const arrangeBtn = document.getElementById('arrangeBtn');
|
| 466 |
const statusCard = document.getElementById('statusCard');
|
| 467 |
-
const statusMsg = document.getElementById('statusMessage');
|
| 468 |
const errorCard = document.getElementById('errorCard');
|
| 469 |
const results = document.getElementById('resultsSection');
|
| 470 |
-
const
|
| 471 |
-
const pianoImg = document.getElementById('pianoRollImg');
|
| 472 |
const midiDownload = document.getElementById('midiDownload');
|
| 473 |
|
| 474 |
let selectedFile = null;
|
| 475 |
|
| 476 |
-
// Drag-over styling
|
| 477 |
dropZone.addEventListener('dragover', e => { e.preventDefault(); dropZone.classList.add('drag-over'); });
|
| 478 |
dropZone.addEventListener('dragleave', () => dropZone.classList.remove('drag-over'));
|
| 479 |
dropZone.addEventListener('drop', e => {
|
|
@@ -518,22 +499,16 @@
|
|
| 518 |
const res = await fetch('/upload', { method: 'POST', body: form });
|
| 519 |
const data = await res.json();
|
| 520 |
|
| 521 |
-
if (!res.ok)
|
| 522 |
-
throw new Error(data.detail || 'Something went wrong.');
|
| 523 |
-
}
|
| 524 |
|
| 525 |
hide(statusCard);
|
| 526 |
show(results);
|
| 527 |
|
|
|
|
|
|
|
|
|
|
| 528 |
midiDownload.href = data.midi_url;
|
| 529 |
|
| 530 |
-
if (data.piano_roll_url) {
|
| 531 |
-
pianoImg.src = data.piano_roll_url;
|
| 532 |
-
pianoWrap.style.display = 'block';
|
| 533 |
-
} else {
|
| 534 |
-
pianoWrap.style.display = 'none';
|
| 535 |
-
}
|
| 536 |
-
|
| 537 |
} catch (err) {
|
| 538 |
hide(statusCard);
|
| 539 |
errorCard.textContent = '⚠ ' + err.message;
|
|
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>KeyArrange</title>
|
| 7 |
+
|
| 8 |
+
<!-- MIDI player web component — handles audio synthesis + scrolling piano roll visualization -->
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/combine/npm/tone@14.7.58,npm/@magenta/music@1.23.1/es6/core.js,npm/html-midi-player@1.5.0"></script>
|
| 10 |
+
|
| 11 |
<style>
|
| 12 |
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Mono:wght@400;500&family=DM+Sans:wght@300;400;500&display=swap');
|
| 13 |
|
|
|
|
| 60 |
margin-bottom: 16px;
|
| 61 |
}
|
| 62 |
|
| 63 |
+
h1 em { font-style: italic; color: var(--accent); }
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
.subtitle {
|
| 66 |
font-size: 14px;
|
|
|
|
| 69 |
line-height: 1.7;
|
| 70 |
}
|
| 71 |
|
| 72 |
+
/* Upload */
|
| 73 |
+
.upload-section { margin-bottom: 32px; }
|
|
|
|
|
|
|
| 74 |
|
| 75 |
.drop-zone {
|
| 76 |
border: 1px dashed var(--border);
|
|
|
|
| 97 |
height: 100%;
|
| 98 |
}
|
| 99 |
|
| 100 |
+
.drop-icon { font-size: 28px; margin-bottom: 12px; color: var(--text-dim); }
|
| 101 |
+
.drop-label { font-size: 14px; color: var(--text-mid); margin-bottom: 6px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
.drop-sub {
|
| 103 |
font-family: 'DM Mono', monospace;
|
| 104 |
font-size: 11px;
|
|
|
|
| 117 |
border: 1px solid rgba(200, 240, 67, 0.2);
|
| 118 |
border-radius: 3px;
|
| 119 |
}
|
|
|
|
| 120 |
.file-selected.visible { display: flex; }
|
| 121 |
|
| 122 |
.file-name {
|
|
|
|
| 138 |
line-height: 1;
|
| 139 |
padding: 0 4px;
|
| 140 |
}
|
|
|
|
| 141 |
.file-clear:hover { color: var(--text); }
|
| 142 |
|
|
|
|
| 143 |
.btn-arrange {
|
| 144 |
width: 100%;
|
| 145 |
padding: 16px;
|
|
|
|
| 156 |
margin-top: 12px;
|
| 157 |
transition: all 0.15s;
|
| 158 |
}
|
| 159 |
+
.btn-arrange:hover:not(:disabled) { background: #d8ff55; }
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
.btn-arrange:disabled {
|
| 161 |
background: var(--border);
|
| 162 |
color: var(--text-dim);
|
|
|
|
| 172 |
border-radius: 3px;
|
| 173 |
margin-top: 20px;
|
| 174 |
}
|
|
|
|
| 175 |
.status-card.visible { display: block; }
|
| 176 |
|
| 177 |
.status-eyebrow {
|
|
|
|
| 183 |
margin-bottom: 8px;
|
| 184 |
}
|
| 185 |
|
| 186 |
+
.status-message { font-size: 14px; color: var(--text-mid); line-height: 1.6; }
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
|
| 188 |
.progress-bar-track {
|
| 189 |
height: 2px;
|
|
|
|
| 197 |
height: 100%;
|
| 198 |
background: var(--accent3);
|
| 199 |
border-radius: 2px;
|
|
|
|
|
|
|
| 200 |
animation: indeterminate 2s ease-in-out infinite;
|
| 201 |
}
|
| 202 |
|
|
|
|
| 218 |
color: #ff6b6b;
|
| 219 |
font-family: 'DM Mono', monospace;
|
| 220 |
}
|
|
|
|
| 221 |
.error-card.visible { display: block; }
|
| 222 |
|
| 223 |
/* Results */
|
| 224 |
+
.results-section { display: none; margin-top: 32px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
.results-section.visible { display: block; }
|
| 226 |
|
| 227 |
.results-header {
|
|
|
|
| 250 |
color: var(--text);
|
| 251 |
}
|
| 252 |
|
| 253 |
+
/* MIDI player container */
|
| 254 |
+
.player-wrap {
|
| 255 |
background: var(--surface);
|
| 256 |
border: 1px solid var(--border);
|
| 257 |
border-radius: 3px;
|
|
|
|
| 259 |
margin-bottom: 20px;
|
| 260 |
}
|
| 261 |
|
| 262 |
+
.player-label {
|
| 263 |
font-family: 'DM Mono', monospace;
|
| 264 |
font-size: 10px;
|
| 265 |
letter-spacing: 0.15em;
|
| 266 |
text-transform: uppercase;
|
| 267 |
color: var(--text-dim);
|
| 268 |
+
padding: 12px 16px 8px;
|
| 269 |
+
display: flex;
|
| 270 |
+
align-items: center;
|
| 271 |
+
justify-content: space-between;
|
|
|
|
|
|
|
| 272 |
}
|
| 273 |
|
| 274 |
+
.player-legend {
|
| 275 |
display: flex;
|
| 276 |
+
gap: 16px;
|
|
|
|
| 277 |
}
|
| 278 |
|
| 279 |
.legend-item {
|
| 280 |
display: flex;
|
| 281 |
align-items: center;
|
| 282 |
+
gap: 6px;
|
| 283 |
+
font-size: 11px;
|
| 284 |
+
color: var(--text-dim);
|
| 285 |
}
|
| 286 |
|
| 287 |
.legend-dot {
|
| 288 |
+
width: 9px;
|
| 289 |
+
height: 9px;
|
| 290 |
border-radius: 2px;
|
| 291 |
flex-shrink: 0;
|
| 292 |
}
|
| 293 |
|
| 294 |
+
/*
|
| 295 |
+
html-midi-player uses a shadow DOM so deep CSS overrides are limited.
|
| 296 |
+
These CSS custom properties are what the component officially exposes.
|
| 297 |
+
The visualizer background and note colors are the most impactful ones.
|
| 298 |
+
*/
|
| 299 |
+
midi-player {
|
| 300 |
+
display: block;
|
| 301 |
+
width: 100%;
|
| 302 |
+
background: var(--surface2);
|
| 303 |
+
border-top: 1px solid var(--border);
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
midi-visualizer {
|
| 307 |
+
display: block;
|
| 308 |
+
width: 100%;
|
| 309 |
+
/* Note colors per track index — track 0 = right hand, track 1 = left hand */
|
| 310 |
+
--midi-visualizer-notes-color: #4a9eff; /* fallback / right hand */
|
| 311 |
+
background: #0a0a0a;
|
| 312 |
+
min-height: 160px;
|
| 313 |
}
|
| 314 |
|
| 315 |
+
/* Download */
|
| 316 |
+
.download-row { display: flex; gap: 10px; flex-wrap: wrap; }
|
| 317 |
+
|
| 318 |
.btn-download {
|
| 319 |
padding: 12px 20px;
|
| 320 |
background: transparent;
|
|
|
|
| 332 |
align-items: center;
|
| 333 |
gap: 8px;
|
| 334 |
}
|
| 335 |
+
.btn-download:hover { border-color: var(--accent); color: var(--accent); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 336 |
.btn-download .btn-icon { font-size: 15px; }
|
| 337 |
|
| 338 |
/* Footer */
|
|
|
|
| 348 |
flex-wrap: wrap;
|
| 349 |
gap: 8px;
|
| 350 |
}
|
|
|
|
| 351 |
footer a { color: var(--text-dim); text-decoration: none; }
|
| 352 |
footer a:hover { color: var(--accent); }
|
| 353 |
</style>
|
|
|
|
| 381 |
<!-- Status -->
|
| 382 |
<div class="status-card" id="statusCard">
|
| 383 |
<div class="status-eyebrow">Processing</div>
|
| 384 |
+
<div class="status-message">
|
| 385 |
Separating stems, transcribing, arranging… this takes 1–3 minutes depending on song length.
|
| 386 |
</div>
|
| 387 |
<div class="progress-bar-track">
|
| 388 |
+
<div class="progress-bar-fill"></div>
|
| 389 |
</div>
|
| 390 |
</div>
|
| 391 |
|
|
|
|
| 399 |
<h2 class="results-title">Your arrangement</h2>
|
| 400 |
</div>
|
| 401 |
|
| 402 |
+
<div class="player-wrap">
|
| 403 |
+
<div class="player-label">
|
| 404 |
+
<span>Piano Roll · press play to hear it</span>
|
| 405 |
+
<div class="player-legend">
|
| 406 |
+
<div class="legend-item">
|
| 407 |
+
<div class="legend-dot" style="background:#ff6b6b"></div>
|
| 408 |
+
Playing now
|
| 409 |
+
</div>
|
| 410 |
+
<div class="legend-item">
|
| 411 |
+
<div class="legend-dot" style="background:#4a9eff"></div>
|
| 412 |
+
Upcoming
|
| 413 |
+
</div>
|
|
|
|
|
|
|
| 414 |
</div>
|
| 415 |
</div>
|
| 416 |
+
|
| 417 |
+
<!--
|
| 418 |
+
midi-visualizer renders the scrolling piano roll.
|
| 419 |
+
midi-player handles play/pause/seek and audio via Magenta soundfont.
|
| 420 |
+
They are linked by the visualizer="#midiVisualizer" attribute.
|
| 421 |
+
sound-font enables the Magenta piano soundfont (requires internet).
|
| 422 |
+
-->
|
| 423 |
+
<midi-visualizer type="piano-roll" id="midiVisualizer"></midi-visualizer>
|
| 424 |
+
<midi-player id="midiPlayer" sound-font visualizer="#midiVisualizer"></midi-player>
|
| 425 |
</div>
|
| 426 |
|
| 427 |
<div class="download-row">
|
|
|
|
| 448 |
const fileClear = document.getElementById('fileClear');
|
| 449 |
const arrangeBtn = document.getElementById('arrangeBtn');
|
| 450 |
const statusCard = document.getElementById('statusCard');
|
|
|
|
| 451 |
const errorCard = document.getElementById('errorCard');
|
| 452 |
const results = document.getElementById('resultsSection');
|
| 453 |
+
const midiPlayer = document.getElementById('midiPlayer');
|
|
|
|
| 454 |
const midiDownload = document.getElementById('midiDownload');
|
| 455 |
|
| 456 |
let selectedFile = null;
|
| 457 |
|
|
|
|
| 458 |
dropZone.addEventListener('dragover', e => { e.preventDefault(); dropZone.classList.add('drag-over'); });
|
| 459 |
dropZone.addEventListener('dragleave', () => dropZone.classList.remove('drag-over'));
|
| 460 |
dropZone.addEventListener('drop', e => {
|
|
|
|
| 499 |
const res = await fetch('/upload', { method: 'POST', body: form });
|
| 500 |
const data = await res.json();
|
| 501 |
|
| 502 |
+
if (!res.ok) throw new Error(data.detail || 'Something went wrong.');
|
|
|
|
|
|
|
| 503 |
|
| 504 |
hide(statusCard);
|
| 505 |
show(results);
|
| 506 |
|
| 507 |
+
// Setting src on midi-player triggers it to fetch the MIDI and load it
|
| 508 |
+
// into both the player controls and the linked visualizer automatically.
|
| 509 |
+
midiPlayer.setAttribute('src', data.midi_url);
|
| 510 |
midiDownload.href = data.midi_url;
|
| 511 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 512 |
} catch (err) {
|
| 513 |
hide(statusCard);
|
| 514 |
errorCard.textContent = '⚠ ' + err.message;
|