Repository navigation
Expand file tree
/
Copy pathscreen.html
More file actions
228 lines (213 loc) · 14.9 KB
/
Copy pathscreen.html
File metadata and controls
228 lines (213 loc) · 14.9 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<div class="max-w-4xl mx-auto px-6 pt-24 pb-16">
<button onclick="showScreen('home')" class="text-gray-500 hover:text-white text-sm mb-6 flex items-center gap-1">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/></svg> Back
</button>
<h2 class="text-3xl font-bold text-white mb-2">Lyrics Sync</h2>
<p class="text-gray-500 mb-8">Author and time-align song lyrics — generate synced timing with AI forced alignment, or hand-edit with tap-to-time and waveform drag-editing.</p>
<!-- Status -->
<div id="ls-status" class="mb-6"></div>
<!-- Song picker -->
<div class="mb-6">
<label class="text-sm font-semibold text-gray-300 mb-2 block">1. Select a song with stems</label>
<div class="flex gap-3">
<input type="text" id="ls-search" placeholder="Search sloppak songs with stems..."
onkeydown="if(event.key==='Enter')lsSearchSongs()"
class="flex-1 bg-dark-700 border border-gray-800 rounded-xl px-4 py-2.5 text-sm text-gray-300 placeholder-gray-600 focus:border-accent/50 outline-none">
<button onclick="lsSearchSongs()" class="bg-dark-600 hover:bg-dark-500 px-5 py-2.5 rounded-xl text-sm text-gray-300 transition">Search</button>
</div>
<div id="ls-search-results" class="space-y-1 mt-2"></div>
<div id="ls-selected-song" class="hidden mt-3 bg-dark-700/50 border border-accent/30 rounded-xl p-3 flex items-center gap-3">
<span class="text-accent text-sm font-semibold" id="ls-selected-label"></span>
<button onclick="lsClearSong()" class="ml-auto text-gray-500 hover:text-red-400 text-xs transition">Clear</button>
</div>
</div>
<!-- Lyrics input -->
<div class="mb-6">
<label class="text-sm font-semibold text-gray-300 mb-2 block">2. Paste or upload lyrics</label>
<textarea id="ls-lyrics" rows="10" placeholder="Paste plain text lyrics here, one line per line..."
class="w-full bg-dark-700 border border-gray-800 rounded-xl px-4 py-3 text-sm text-gray-300 placeholder-gray-600 focus:border-accent/50 outline-none resize-y font-mono"></textarea>
<div class="flex items-center gap-3 mt-2">
<label class="cursor-pointer bg-dark-600 hover:bg-dark-500 px-4 py-2 rounded-lg text-xs text-gray-300 transition">
Upload .txt
<input type="file" accept=".txt,.lrc" id="ls-file-upload" class="hidden" onchange="lsFileUpload(this)">
</label>
<span class="text-xs text-gray-600" id="ls-lyrics-count">0 lines</span>
</div>
</div>
<!-- Options -->
<div class="mb-6 flex flex-wrap items-center gap-5">
<label class="text-sm text-gray-400">
Language hint:
<input type="text" id="ls-language" placeholder="auto" maxlength="5"
class="ml-2 w-20 bg-dark-700 border border-gray-800 rounded-lg px-3 py-1.5 text-sm text-gray-300 placeholder-gray-600 focus:border-accent/50 outline-none">
</label>
<div class="flex items-center gap-3 text-sm text-gray-400">
<span>Granularity:</span>
<label class="flex items-center gap-1.5 cursor-pointer">
<input type="radio" name="ls-granularity" value="line" checked class="accent-accent"> Line
</label>
<label class="flex items-center gap-1.5 cursor-pointer">
<input type="radio" name="ls-granularity" value="word" class="accent-accent"> Word
</label>
<label class="flex items-center gap-1.5 cursor-pointer">
<input type="radio" name="ls-granularity" value="syllable" class="accent-accent"> Syllable
</label>
</div>
</div>
<!-- Align button -->
<button onclick="lsAlign()" id="ls-align-btn"
class="bg-accent hover:bg-accent-light px-6 py-2.5 rounded-xl text-sm text-white font-semibold transition disabled:opacity-40 disabled:cursor-not-allowed mb-8"
disabled>
Align Lyrics
</button>
<!-- Progress -->
<div id="ls-progress" class="hidden mb-6">
<div class="bg-dark-700 border border-gray-800 rounded-xl p-5">
<p class="text-sm text-gray-300 mb-3">Aligning lyrics with Whisper...</p>
<div class="progress-bar"><div class="fill animate-pulse" style="width:100%"></div></div>
<p class="text-xs text-gray-500 mt-2">This may take a minute for longer songs.</p>
</div>
</div>
<!-- Preview -->
<div id="ls-preview" class="hidden mb-8">
<h3 class="text-sm font-semibold text-gray-300 mb-3">Preview</h3>
<div id="ls-preview-lines" class="bg-dark-800 border border-gray-800 rounded-xl p-4 max-h-96 overflow-y-auto space-y-1 font-mono text-sm"></div>
<div class="flex flex-wrap items-center gap-3 mt-4">
<div class="flex items-center gap-3 text-sm text-gray-400">
<span>Granularity:</span>
<label class="flex items-center gap-1.5 cursor-pointer">
<input type="radio" name="ls-preview-granularity" value="line" checked class="accent-accent"> Line
</label>
<label class="flex items-center gap-1.5 cursor-pointer">
<input type="radio" name="ls-preview-granularity" value="word" class="accent-accent"> Word
</label>
<label class="flex items-center gap-1.5 cursor-pointer">
<input type="radio" name="ls-preview-granularity" value="syllable" class="accent-accent"> Syllable
</label>
</div>
<div class="flex items-center gap-3 ml-auto">
<button onclick="lsExport()" class="bg-accent hover:bg-accent-light px-5 py-2 rounded-lg text-sm text-white font-semibold transition">
Download .lrc
</button>
<button onclick="lsSave()" id="ls-save-btn" class="bg-dark-600 hover:bg-dark-500 px-5 py-2 rounded-lg text-sm text-gray-300 transition">
Save to Song
</button>
<button onclick="lsEditInEditor()" class="bg-dark-600 hover:bg-dark-500 px-5 py-2 rounded-lg text-sm text-gray-300 transition">
Edit Manually
</button>
</div>
</div>
<p id="ls-save-status" class="text-xs text-gray-500 mt-2 hidden"></p>
</div>
<!-- ── Manual editor ─────────────────────────────────────────────── -->
<div class="mb-4 flex items-center justify-between">
<div>
<label class="text-sm font-semibold text-gray-300 block">3. Hand-edit lyrics</label>
<p class="text-xs text-gray-600 mt-1">Load the selected song's existing lyrics, tap along to time a song from
scratch, or drag syllable blocks on the waveform to fix timings.</p>
</div>
<button onclick="lsOpenEditor()" id="ls-open-editor-btn"
class="bg-dark-600 hover:bg-dark-500 px-4 py-2 rounded-xl text-sm text-gray-300 transition disabled:opacity-40 disabled:cursor-not-allowed shrink-0 ml-4"
disabled>
Open Editor
</button>
</div>
<div id="ls-editor" class="hidden mb-8 bg-dark-800 border border-gray-800 rounded-xl p-4">
<div class="flex items-center justify-between mb-3">
<div class="flex items-center gap-2">
<h3 class="text-sm font-semibold text-gray-300">Editor</h3>
<span id="ls-editor-badge" class="hidden text-[10px] uppercase tracking-wide px-2 py-0.5 rounded bg-yellow-900/30 text-yellow-400"></span>
</div>
<div class="flex items-center gap-2">
<button onclick="lsEditorUndo()" id="ls-editor-undo-btn"
class="text-xs text-gray-400 hover:text-white px-2 py-1 rounded disabled:opacity-30 disabled:cursor-not-allowed" disabled>Undo</button>
<button onclick="lsEditorRedo()" id="ls-editor-redo-btn"
class="text-xs text-gray-400 hover:text-white px-2 py-1 rounded disabled:opacity-30 disabled:cursor-not-allowed" disabled>Redo</button>
<button onclick="lsCloseEditor()" class="text-xs text-gray-500 hover:text-red-400 px-2 py-1">Close</button>
</div>
</div>
<!-- Transport -->
<div class="flex flex-wrap items-center gap-3 mb-3">
<button onclick="lsEditorTogglePlay()" id="ls-editor-play-btn"
class="bg-accent hover:bg-accent-light w-9 h-9 rounded-full flex items-center justify-center text-white transition shrink-0">▶</button>
<span id="ls-editor-time" class="text-xs text-gray-400 font-mono whitespace-nowrap">0:00 / 0:00</span>
<select id="ls-editor-stem-select" onchange="lsEditorChangeStem()"
class="bg-dark-700 border border-gray-800 rounded-lg px-2 py-1 text-xs text-gray-300 outline-none"></select>
<div class="flex items-center gap-1 text-xs text-gray-400">
Speed:
<button onclick="lsEditorSetRate(0.5)" data-rate="0.5" class="ls-rate-btn px-2 py-1 rounded bg-dark-700 hover:bg-dark-600">0.5×</button>
<button onclick="lsEditorSetRate(0.75)" data-rate="0.75" class="ls-rate-btn px-2 py-1 rounded bg-dark-700 hover:bg-dark-600">0.75×</button>
<button onclick="lsEditorSetRate(1)" data-rate="1" class="ls-rate-btn px-2 py-1 rounded bg-accent/30 text-accent">1×</button>
</div>
<button onclick="lsEditorSetLoopA()" id="ls-editor-loop-a-btn" class="text-xs text-gray-400 hover:text-white px-2 py-1 rounded bg-dark-700">Set A</button>
<button onclick="lsEditorSetLoopB()" id="ls-editor-loop-b-btn" class="text-xs text-gray-400 hover:text-white px-2 py-1 rounded bg-dark-700">Set B</button>
<button onclick="lsEditorToggleLoop()" id="ls-editor-loop-toggle-btn" class="text-xs text-gray-400 hover:text-white px-2 py-1 rounded bg-dark-700">Loop: Off</button>
<button onclick="lsEditorToggleTapMode()" id="ls-editor-tap-btn"
class="text-xs px-3 py-1.5 rounded-lg bg-dark-700 hover:bg-dark-600 text-gray-300 ml-auto whitespace-nowrap">
Tap-to-Time (T)
</button>
</div>
<audio id="ls-editor-audio" preload="metadata" class="hidden"></audio>
<!-- Waveform / timeline -->
<div class="mb-3">
<div class="flex items-center justify-between mb-1">
<span class="text-xs text-gray-500">Drag a block to move it, drag its edges to resize, click a block to select it, click empty space to seek.</span>
<div class="flex items-center gap-1 shrink-0 ml-2">
<button onclick="lsEditorZoom(0.5)" class="text-xs text-gray-400 hover:text-white w-6 h-6 rounded bg-dark-700">−</button>
<button onclick="lsEditorZoom(2)" class="text-xs text-gray-400 hover:text-white w-6 h-6 rounded bg-dark-700">+</button>
</div>
</div>
<div id="ls-editor-timeline-wrap" class="relative w-full h-32 bg-dark-900 border border-gray-800 rounded-lg overflow-x-auto overflow-y-hidden">
<canvas id="ls-editor-canvas" class="block"></canvas>
</div>
</div>
<!-- Seed from text -->
<div class="mb-3">
<span class="text-xs text-gray-500 block mb-1">Seed untimed syllables from text — one lyric line per line; use <code>/</code> to mark syllable splits within a word (e.g. <code>won/der/ful</code>):</span>
<div class="flex gap-2">
<textarea id="ls-editor-seed-text" rows="3" placeholder="Won/der/ful to-night How I won-der..."
class="flex-1 bg-dark-700 border border-gray-800 rounded-lg px-3 py-2 text-xs text-gray-300 placeholder-gray-600 outline-none font-mono resize-y"></textarea>
<button onclick="lsEditorSeedFromText()" class="bg-dark-600 hover:bg-dark-500 px-3 py-2 rounded-lg text-xs text-gray-300 transition self-start shrink-0">Add</button>
</div>
</div>
<!-- Syllable list -->
<div class="mb-3">
<div class="flex items-center justify-between gap-3 mb-1">
<div class="text-xs text-gray-500"><span id="ls-editor-count">0</span> <span id="ls-editor-count-label">syllables</span></div>
<div class="flex items-center gap-1 text-xs text-gray-400">
View:
<button onclick="lsEditorSetListGrouping('word')" id="ls-editor-view-word-btn"
class="px-2 py-1 rounded bg-accent/30 text-accent">Words</button>
<button onclick="lsEditorSetListGrouping('line')" id="ls-editor-view-line-btn"
class="px-2 py-1 rounded bg-dark-700 hover:bg-dark-600">Lines</button>
</div>
</div>
<div id="ls-editor-list" class="bg-dark-900 border border-gray-800 rounded-lg max-h-64 overflow-y-auto divide-y divide-gray-800/60"></div>
</div>
<!-- Selected syllable inspector -->
<div id="ls-editor-inspector" class="hidden mb-3 flex flex-wrap items-center gap-3 bg-dark-700/50 border border-accent/30 rounded-lg p-3">
<input type="text" id="ls-editor-insp-text" class="w-32 bg-dark-800 border border-gray-800 rounded px-2 py-1 text-xs text-gray-200 outline-none">
<label class="text-xs text-gray-400 flex items-center gap-1">t
<input type="number" step="0.01" id="ls-editor-insp-t" class="w-20 bg-dark-800 border border-gray-800 rounded px-2 py-1 text-xs text-gray-200 outline-none">
</label>
<label class="text-xs text-gray-400 flex items-center gap-1">d
<input type="number" step="0.01" id="ls-editor-insp-d" class="w-20 bg-dark-800 border border-gray-800 rounded px-2 py-1 text-xs text-gray-200 outline-none">
</label>
<label class="flex items-center gap-1 text-xs text-gray-400 cursor-pointer">
<input type="checkbox" id="ls-editor-insp-join" class="accent-accent"> joins next (-)
</label>
<label class="flex items-center gap-1 text-xs text-gray-400 cursor-pointer">
<input type="checkbox" id="ls-editor-insp-brk" class="accent-accent"> line break (+)
</label>
<button onclick="lsEditorDeleteSelected()" class="text-xs text-red-400 hover:text-red-300 ml-auto">Delete</button>
</div>
<!-- Save -->
<div class="flex items-center gap-3">
<button onclick="lsEditorSave()" id="ls-editor-save-btn"
class="bg-accent hover:bg-accent-light px-5 py-2 rounded-lg text-sm text-white font-semibold transition">
Save to Song
</button>
<p id="ls-editor-save-status" class="text-xs text-gray-500 hidden"></p>
</div>
</div>
</div>