Files
motif/index.html
T
b1rdmania 177e8fbed3 Implement complete search results + dual player UI
Backend Enhancements:
- Add ParsedMIDIInfo with track analysis and quality issues
- New /api/midi/parse endpoint for MIDI metadata extraction
- Enhanced MIDIService with parseMIDI method

MIDI Preview Player:
- Complete MIDIPlayer class with polyphonic playback
- Basic oscillator mapping (bass=square, mid=triangle, high=sine)
- Lookahead scheduling with proper cleanup
- Automatic stopping when MIDI ends

New UI Flow:
1. Search → Results table with metadata
2. Select MIDI → Shows parsed info (duration, tracks, tempo)
3. Dual transport: Preview Original vs Generate Motif
4. Try Next Result button for easy A/B testing

Search Results Table:
- Title, source, confidence bar, duration, track count
- Quality issues display (short duration, few notes, etc.)
- Auto-select best result, manual selection available
- Visual confidence bars and issue warnings

This makes the project feel "real" - you can now:
- See exactly what MIDI was found
- Verify it's the right song via preview
- Compare original vs procedural synthesis
- Easily try different results

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-17 21:04:29 +00:00

196 lines
5.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Motif - Procedural Music Synthesis</title>
<style>
body {
font-family: 'Monaco', 'Consolas', monospace;
background: #0a0a0a;
color: #e0e0e0;
margin: 0;
padding: 20px;
line-height: 1.5;
}
.container {
max-width: 800px;
margin: 0 auto;
}
h1 {
color: #00ff88;
text-align: center;
margin-bottom: 30px;
}
.controls {
margin: 20px 0;
text-align: center;
}
button {
background: #333;
color: #e0e0e0;
border: 1px solid #555;
padding: 10px 20px;
margin: 0 10px;
cursor: pointer;
font-family: inherit;
}
button:hover {
background: #444;
}
button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
button.primary {
background: #00ff88;
color: #000;
}
button.primary:hover {
background: #00cc6a;
}
#status {
margin: 20px 0;
padding: 10px;
background: #1a1a1a;
border-left: 3px solid #00ff88;
min-height: 20px;
}
input {
background: #333;
color: #e0e0e0;
border: 1px solid #555;
padding: 8px 12px;
margin: 0 10px;
font-family: inherit;
}
.results-section {
margin: 30px 0;
display: none;
}
.results-section.visible {
display: block;
}
.results-table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
}
.results-table th,
.results-table td {
padding: 8px 12px;
text-align: left;
border-bottom: 1px solid #333;
}
.results-table th {
background: #222;
color: #00ff88;
}
.results-table tr:hover {
background: #1a1a1a;
}
.results-table tr.selected {
background: #2a2a2a;
}
.confidence-bar {
width: 60px;
height: 4px;
background: #333;
border-radius: 2px;
overflow: hidden;
}
.confidence-fill {
height: 100%;
background: linear-gradient(90deg, #ff4444, #ffaa44, #00ff88);
transition: width 0.2s;
}
.player-section {
margin: 30px 0;
display: none;
}
.player-section.visible {
display: block;
}
.player-controls {
display: flex;
gap: 20px;
margin: 20px 0;
}
.player-info {
background: #1a1a1a;
padding: 15px;
margin: 15px 0;
border-left: 3px solid #555;
}
.issues {
color: #ffaa44;
font-size: 0.9em;
}
</style>
</head>
<body>
<div class="container">
<h1>MOTIF</h1>
<p>Procedural Music Synthesis from MIDI Structure</p>
<div class="controls">
<input type="text" id="songInput" placeholder="Enter song name..." />
<button id="searchBtn">Search</button>
</div>
<div id="status">Ready. Enter a song name to search for MIDI files.</div>
<div id="resultsSection" class="results-section">
<h3>Search Results</h3>
<table id="resultsTable" class="results-table">
<thead>
<tr>
<th>Title</th>
<th>Source</th>
<th>Confidence</th>
<th>Duration</th>
<th>Tracks</th>
<th>Issues</th>
<th></th>
</tr>
</thead>
<tbody id="resultsBody">
</tbody>
</table>
</div>
<div id="playerSection" class="player-section">
<div id="selectedInfo" class="player-info">
<h4 id="selectedTitle">No MIDI selected</h4>
<p id="selectedMeta">Select a MIDI file from search results to enable playback</p>
</div>
<div class="player-controls">
<div>
<h4>MIDI Preview</h4>
<p>Plays original MIDI as-is</p>
<button id="previewBtn" disabled>Play Original</button>
<button id="previewStopBtn" disabled>Stop</button>
</div>
<div>
<h4>Motif Generation</h4>
<p>Procedural synthesis from structure</p>
<button id="motifBtn" disabled>Generate & Play</button>
<button id="motifStopBtn" disabled>Stop</button>
</div>
</div>
<button id="nextResultBtn" disabled>Try Next Result</button>
</div>
</div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>