- protocol.yaml: SSoT for the binary framing protocol (12 record types) - codegen/gen.mjs: generates C header/source and Node ESM from protocol.yaml - c-backend: ALSA sequencer with drift-free clock_nanosleep tick thread, pattern store (hierarchical sub-patterns), Unix socket server - node-server: Express 5 web app — REST API, SSE for real-time beat events, step-sequencer frontend with pending-edit / explicit-save flow Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
238 lines
6.2 KiB
HTML
238 lines
6.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>MIDI Sequencer</title>
|
|
<style>
|
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
|
|
:root {
|
|
--bg: #1a1a2e;
|
|
--surface: #16213e;
|
|
--surface2: #0f3460;
|
|
--accent: #e94560;
|
|
--accent2: #533483;
|
|
--text: #eaeaea;
|
|
--text-dim: #888;
|
|
--step-off: #1e2a42;
|
|
--step-on: #e94560;
|
|
--step-pend: #7a2233;
|
|
--step-active: #f0a500;
|
|
--border: #2a3a5e;
|
|
--radius: 6px;
|
|
}
|
|
|
|
body {
|
|
background: var(--bg);
|
|
color: var(--text);
|
|
font-family: 'Courier New', monospace;
|
|
font-size: 14px;
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
header {
|
|
background: var(--surface);
|
|
border-bottom: 1px solid var(--border);
|
|
padding: 12px 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 16px;
|
|
}
|
|
|
|
header h1 { font-size: 18px; letter-spacing: 2px; color: var(--accent); }
|
|
|
|
.status-dot {
|
|
width: 8px; height: 8px; border-radius: 50%;
|
|
background: #444;
|
|
transition: background 0.3s;
|
|
}
|
|
.status-dot.connected { background: #2ecc71; }
|
|
.status-dot.playing { background: var(--accent); animation: pulse 0.5s infinite alternate; }
|
|
|
|
@keyframes pulse { from { opacity: 1; } to { opacity: 0.4; } }
|
|
|
|
main { flex: 1; display: flex; gap: 0; }
|
|
|
|
/* Sidebar */
|
|
.sidebar {
|
|
width: 240px;
|
|
background: var(--surface);
|
|
border-right: 1px solid var(--border);
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding: 12px;
|
|
gap: 12px;
|
|
}
|
|
|
|
.sidebar h2 { font-size: 11px; letter-spacing: 2px; color: var(--text-dim); text-transform: uppercase; }
|
|
|
|
.pattern-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
|
|
|
|
.pattern-item {
|
|
padding: 8px 10px;
|
|
border-radius: var(--radius);
|
|
cursor: pointer;
|
|
border: 1px solid transparent;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
.pattern-item:hover { background: var(--surface2); }
|
|
.pattern-item.active { border-color: var(--accent); background: var(--surface2); }
|
|
.pattern-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
.pattern-item .steps { font-size: 11px; color: var(--text-dim); }
|
|
|
|
/* Transport */
|
|
.transport {
|
|
display: flex; gap: 8px; flex-wrap: wrap;
|
|
}
|
|
|
|
/* Content area */
|
|
.content {
|
|
flex: 1;
|
|
padding: 20px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 16px;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.panel {
|
|
background: var(--surface);
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
padding: 16px;
|
|
}
|
|
|
|
.panel-header {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
margin-bottom: 14px;
|
|
}
|
|
|
|
.panel-header h2 { font-size: 12px; letter-spacing: 2px; color: var(--text-dim); text-transform: uppercase; }
|
|
|
|
/* Buttons */
|
|
button {
|
|
background: var(--surface2);
|
|
color: var(--text);
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
padding: 6px 14px;
|
|
cursor: pointer;
|
|
font-family: inherit;
|
|
font-size: 13px;
|
|
transition: background 0.15s;
|
|
}
|
|
button:hover { background: var(--accent2); border-color: var(--accent2); }
|
|
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
|
|
button.primary:hover { background: #c73452; }
|
|
button.danger { background: #7a1a2e; border-color: #9b2a3e; }
|
|
button.danger:hover { background: #9b2a3e; }
|
|
button:disabled { opacity: 0.4; cursor: not-allowed; }
|
|
|
|
/* Inputs */
|
|
input, select {
|
|
background: var(--bg);
|
|
color: var(--text);
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
padding: 5px 10px;
|
|
font-family: inherit;
|
|
font-size: 13px;
|
|
}
|
|
input:focus, select:focus { outline: none; border-color: var(--accent); }
|
|
input[type="number"] { width: 80px; }
|
|
label { font-size: 12px; color: var(--text-dim); }
|
|
|
|
.field-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
|
|
|
|
/* Step grid */
|
|
.step-grid {
|
|
display: grid;
|
|
gap: 4px;
|
|
}
|
|
|
|
.note-row {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
}
|
|
|
|
.note-label {
|
|
width: 36px;
|
|
text-align: right;
|
|
font-size: 11px;
|
|
color: var(--text-dim);
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.step-btn {
|
|
width: 28px;
|
|
height: 28px;
|
|
border-radius: 3px;
|
|
background: var(--step-off);
|
|
border: 1px solid var(--border);
|
|
cursor: pointer;
|
|
padding: 0;
|
|
position: relative;
|
|
transition: background 0.05s;
|
|
flex-shrink: 0;
|
|
}
|
|
.step-btn.on { background: var(--step-on); border-color: var(--accent); }
|
|
.step-btn.pending { background: var(--step-pend); border-color: #7a2233; }
|
|
.step-btn.current { box-shadow: 0 0 0 2px var(--step-active); }
|
|
|
|
/* Velocity bar inside step button */
|
|
.step-btn .vel-bar {
|
|
position: absolute;
|
|
bottom: 0; left: 0; right: 0;
|
|
height: 3px;
|
|
background: rgba(255,255,255,0.4);
|
|
border-radius: 0 0 3px 3px;
|
|
}
|
|
|
|
.empty-state { color: var(--text-dim); text-align: center; padding: 40px; }
|
|
|
|
.sub-ref-list { display: flex; flex-direction: column; gap: 4px; }
|
|
.sub-ref-item {
|
|
display: flex; align-items: center; gap: 8px;
|
|
background: var(--surface2); border-radius: var(--radius); padding: 6px 10px;
|
|
font-size: 12px;
|
|
}
|
|
.sub-ref-item .label { flex: 1; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<h1>MIDI SEQUENCER</h1>
|
|
<div class="status-dot" id="backend-dot" title="Backend connection"></div>
|
|
<div class="status-dot" id="play-dot" title="Playing"></div>
|
|
<span id="status-label" style="font-size:12px;color:var(--text-dim)">disconnected</span>
|
|
<div style="flex:1"></div>
|
|
<label>BPM</label>
|
|
<input type="number" id="bpm-input" value="120" min="1" max="300" step="0.1" style="width:70px">
|
|
<button id="set-tempo-btn">Set Tempo</button>
|
|
</header>
|
|
<main>
|
|
<aside class="sidebar">
|
|
<h2>Patterns</h2>
|
|
<div class="transport">
|
|
<button id="play-btn" class="primary">▶ Play</button>
|
|
<button id="stop-btn">■ Stop</button>
|
|
</div>
|
|
<div class="pattern-list" id="pattern-list"></div>
|
|
<button id="new-pattern-btn">+ New Pattern</button>
|
|
</aside>
|
|
<div class="content" id="content">
|
|
<div class="empty-state">Select or create a pattern to get started.</div>
|
|
</div>
|
|
</main>
|
|
<script type="module" src="app.mjs"></script>
|
|
</body>
|
|
</html>
|