mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-20 13:07:57 +09:00
Vocals waveform in the timeline editor (finishes @netux's #895): backend stem-selection fix (vocals_clean), downsampled peak-envelope perf, edit-modal space reclaim, full i18n (33 locales), CodeRabbit fixes, and ReviewServer.vocals_filepath made optional. Reviewed + visually QA'd on a real job.
This commit is contained in:
1 parent
0497168dda
commit
d7482ee85a
46 files changed
+1165
-450
No files matched your search
@@ -19,7 +19,7 @@ import json
|
||||
import os
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from typing import Dict, Any, List, Optional, Set, Tuple
|
||||
from typing import Dict, Any, List, Literal, Optional, Set, Tuple
|
||||
|
||||
from fastapi import APIRouter, HTTPException, Request, Depends, Form, File, UploadFile
|
||||
from fastapi.responses import RedirectResponse
|
||||
@@ -372,6 +372,15 @@ async def get_correction_data(
|
||||
raise HTTPException(status_code=500, detail=t("en", "review.correctionsLoadFailed", error=str(e)))
|
||||
|
||||
|
||||
@router.get("/{job_id}/audio/vocals")
|
||||
async def get_vocals_audio(
|
||||
job_id: str,
|
||||
auth_info: Tuple[str, str] = Depends(require_review_auth)
|
||||
):
|
||||
"""Stream the vocals audio file for playback."""
|
||||
return await _stream_audio(job_id, stem="vocals")
|
||||
|
||||
|
||||
@router.get("/{job_id}/audio/{audio_hash}")
|
||||
async def get_audio_with_hash(
|
||||
job_id: str,
|
||||
@@ -392,7 +401,7 @@ async def get_audio_no_hash(
|
||||
return await _stream_audio(job_id)
|
||||
|
||||
|
||||
async def _stream_audio(job_id: str):
|
||||
async def _stream_audio(job_id: str, stem: Literal["input"] | Literal["vocals"] = "input"):
|
||||
"""
|
||||
Redirect to a signed GCS URL for audio playback in the review interface.
|
||||
|
||||
@@ -407,7 +416,22 @@ async def _stream_audio(job_id: str):
|
||||
if not job:
|
||||
raise HTTPException(status_code=404, detail=t("en", "review.jobNotFound"))
|
||||
|
||||
audio_gcs_path = job.input_media_gcs_path
|
||||
audio_gcs_path = None
|
||||
if stem == "input":
|
||||
audio_gcs_path = job.input_media_gcs_path
|
||||
elif stem == "vocals":
|
||||
stems = job.file_urls.get("stems", {}) if job.file_urls else {}
|
||||
# Stem keys vary by separation model. We want the full vocal mix
|
||||
# (lead + backing) so every word can be lined up against the waveform:
|
||||
# - "vocals" : full vocal from a 2-stem split (rare)
|
||||
# - "vocals_clean" : full vocal from the primary vocal/instrumental
|
||||
# split (present on essentially all cloud jobs)
|
||||
# - "lead_vocals" : last-resort fallback (misses backing lines)
|
||||
# Use .get() so a missing key yields a clean 404 below, not a KeyError/500.
|
||||
for key in ("vocals", "vocals_clean", "lead_vocals"):
|
||||
if stems.get(key):
|
||||
audio_gcs_path = stems[key]
|
||||
break
|
||||
if not audio_gcs_path:
|
||||
raise HTTPException(status_code=404, detail=t("en", "review.audioNotFound"))
|
||||
|
||||
|
||||
@@ -1132,3 +1132,71 @@ class TestGetPreviewVideoRedirect:
|
||||
self._call(mock_storage)
|
||||
assert exc_info.value.status_code == 404
|
||||
mock_storage.generate_signed_url.assert_not_called()
|
||||
|
||||
|
||||
class TestGetVocalsAudio:
|
||||
"""The vocals waveform endpoint streams the full vocal stem for the timeline.
|
||||
|
||||
Real jobs never store a plain 'vocals' key — separation writes
|
||||
'vocals_clean' / 'lead_vocals' / 'backing_vocals'. The endpoint must select
|
||||
the fullest vocal mix (vocals_clean) rather than KeyError on 'vocals'.
|
||||
"""
|
||||
|
||||
def _call(self, stems):
|
||||
import asyncio
|
||||
from backend.api.routes.review import _stream_audio
|
||||
|
||||
job = MagicMock()
|
||||
job.input_media_gcs_path = "jobs/j/input.flac"
|
||||
job.file_urls = {"stems": stems}
|
||||
|
||||
job_manager = MagicMock()
|
||||
job_manager.get_job.return_value = job
|
||||
|
||||
transcoding = MagicMock()
|
||||
transcoding.get_review_audio_url_async = AsyncMock(
|
||||
return_value="https://signed.example/vocals.ogg?sig=xyz"
|
||||
)
|
||||
|
||||
with patch("backend.api.routes.review.JobManager", return_value=job_manager), patch(
|
||||
"backend.services.audio_transcoding_service.AudioTranscodingService",
|
||||
return_value=transcoding,
|
||||
):
|
||||
resp = asyncio.run(
|
||||
_stream_audio(job_id="j", stem="vocals")
|
||||
)
|
||||
return resp, transcoding
|
||||
|
||||
def test_selects_vocals_clean_when_no_plain_vocals_key(self):
|
||||
from starlette.responses import RedirectResponse
|
||||
|
||||
# The shape produced by real cloud jobs (no plain "vocals").
|
||||
resp, transcoding = self._call(
|
||||
{
|
||||
"instrumental_clean": "jobs/j/stems/instrumental_clean.flac",
|
||||
"vocals_clean": "jobs/j/stems/vocals_clean.flac",
|
||||
"lead_vocals": "jobs/j/stems/lead_vocals.flac",
|
||||
"backing_vocals": "jobs/j/stems/backing_vocals.flac",
|
||||
}
|
||||
)
|
||||
|
||||
assert isinstance(resp, RedirectResponse)
|
||||
assert resp.status_code == 302
|
||||
# Must pick the full vocal mix (vocals_clean), not lead_vocals or KeyError.
|
||||
assert transcoding.get_review_audio_url_async.call_args[0][0] == "jobs/j/stems/vocals_clean.flac"
|
||||
|
||||
def test_prefers_plain_vocals_then_falls_back_to_lead(self):
|
||||
# 2-stem split exposes a plain "vocals" — preferred.
|
||||
_, transcoding = self._call({"vocals": "jobs/j/stems/vocals.flac"})
|
||||
assert transcoding.get_review_audio_url_async.call_args[0][0] == "jobs/j/stems/vocals.flac"
|
||||
|
||||
# Only lead_vocals available — last-resort fallback.
|
||||
_, transcoding = self._call({"lead_vocals": "jobs/j/stems/lead_vocals.flac"})
|
||||
assert transcoding.get_review_audio_url_async.call_args[0][0] == "jobs/j/stems/lead_vocals.flac"
|
||||
|
||||
def test_404_when_no_vocal_stem_present(self):
|
||||
from fastapi import HTTPException
|
||||
|
||||
with pytest.raises(HTTPException) as exc_info:
|
||||
self._call({"instrumental_clean": "jobs/j/stems/instrumental_clean.flac"})
|
||||
assert exc_info.value.status_code == 404
|
||||
@@ -1,8 +1,9 @@
|
||||
'use client'
|
||||
|
||||
import { memo, useRef, useCallback } from 'react'
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Play, XCircle, Hand } from 'lucide-react'
|
||||
import { Hand } from 'lucide-react'
|
||||
import { Word } from '@/lib/lyrics-review/types'
|
||||
import TimelineEditor from './TimelineEditor'
|
||||
import { cn } from '@/lib/utils'
|
||||
@@ -17,6 +18,7 @@ const TapButton = memo(function TapButton({
|
||||
onTapStart: () => void
|
||||
onTapEnd: () => void
|
||||
}) {
|
||||
const t = useTranslations('lyricsReview.editTimeline')
|
||||
const isPressedRef = useRef(false)
|
||||
|
||||
const handleTapStart = useCallback(() => {
|
||||
@@ -51,7 +53,7 @@ const TapButton = memo(function TapButton({
|
||||
)}
|
||||
>
|
||||
<Hand className="h-5 w-5 mr-2" />
|
||||
{isSpacebarPressed ? 'HOLD...' : 'TAP'}
|
||||
{isSpacebarPressed ? t('hold') : t('tap')}
|
||||
</Button>
|
||||
)
|
||||
})
|
||||
@@ -60,17 +62,12 @@ interface EditTimelineSectionProps {
|
||||
words: Word[]
|
||||
startTime: number
|
||||
endTime: number
|
||||
originalStartTime: number | null
|
||||
originalEndTime: number | null
|
||||
currentStartTime: number | null
|
||||
currentEndTime: number | null
|
||||
currentTime?: number
|
||||
isManualSyncing: boolean
|
||||
syncWordIndex: number
|
||||
isSpacebarPressed: boolean
|
||||
onWordUpdate: (index: number, updates: Partial<Word>) => void
|
||||
onPlaySegment?: (time: number) => void
|
||||
startManualSync: () => void
|
||||
isGlobal?: boolean
|
||||
onTapStart?: () => void
|
||||
onTapEnd?: () => void
|
||||
@@ -80,21 +77,17 @@ export default function EditTimelineSection({
|
||||
words,
|
||||
startTime,
|
||||
endTime,
|
||||
originalStartTime,
|
||||
originalEndTime,
|
||||
currentStartTime,
|
||||
currentEndTime,
|
||||
currentTime,
|
||||
isManualSyncing,
|
||||
syncWordIndex,
|
||||
isSpacebarPressed,
|
||||
onWordUpdate,
|
||||
onPlaySegment,
|
||||
startManualSync,
|
||||
isGlobal = false,
|
||||
onTapStart,
|
||||
onTapEnd,
|
||||
}: EditTimelineSectionProps) {
|
||||
const t = useTranslations('lyricsReview.editTimeline')
|
||||
// Simple mobile detection
|
||||
const isMobile = typeof window !== 'undefined' && window.innerWidth < 640
|
||||
|
||||
@@ -110,8 +103,9 @@ export default function EditTimelineSection({
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Timeline Editor */}
|
||||
<div className={cn('mb-0', isMobile ? 'h-20' : 'h-[120px]')}>
|
||||
{/* Timeline Editor — height hugs its content (ruler + word bars + waveform)
|
||||
instead of a fixed min-height, to avoid dead vertical space. */}
|
||||
<div>
|
||||
<TimelineEditor
|
||||
words={words}
|
||||
startTime={startTime}
|
||||
@@ -122,70 +116,32 @@ export default function EditTimelineSection({
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Time range info and controls */}
|
||||
<div
|
||||
className={cn(
|
||||
'flex items-center justify-between gap-2',
|
||||
isMobile ? 'flex-col items-stretch mt-2 mb-3' : 'flex-row mt-0 mb-0'
|
||||
)}
|
||||
>
|
||||
{/* Time range info - hidden on mobile to save space */}
|
||||
{!isMobile && (
|
||||
<div className="text-xs text-muted-foreground">
|
||||
<div>
|
||||
Original Time Range: {originalStartTime?.toFixed(2) ?? 'N/A'} -{' '}
|
||||
{originalEndTime?.toFixed(2) ?? 'N/A'}
|
||||
</div>
|
||||
<div>
|
||||
Current Time Range: {currentStartTime?.toFixed(2) ?? 'N/A'} -{' '}
|
||||
{currentEndTime?.toFixed(2) ?? 'N/A'}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Controls */}
|
||||
{/* Sync helper — only visible while manually syncing. The Tap To Sync
|
||||
toggle and the time-range readout now live in the modal header to
|
||||
reclaim the vertical space above the word list. */}
|
||||
{(currentWordInfo || (isMobile && isManualSyncing)) && (
|
||||
<div
|
||||
className={cn(
|
||||
'flex items-center gap-2',
|
||||
isMobile ? 'flex-col items-stretch' : 'flex-row'
|
||||
isMobile ? 'flex-col items-stretch mt-2 mb-3' : 'flex-row mt-0 mb-0'
|
||||
)}
|
||||
>
|
||||
{/* Tap To Sync button */}
|
||||
<Button
|
||||
variant={isManualSyncing ? 'outline' : 'default'}
|
||||
onClick={startManualSync}
|
||||
className={cn(
|
||||
isManualSyncing
|
||||
? 'border-destructive text-destructive hover:bg-destructive/10'
|
||||
: 'bg-primary'
|
||||
)}
|
||||
>
|
||||
{isManualSyncing ? (
|
||||
<>
|
||||
<XCircle className="h-4 w-4 mr-1" />
|
||||
Cancel
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Play className="h-4 w-4 mr-1" />
|
||||
Tap To Sync
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
|
||||
{/* Current word info during sync */}
|
||||
{currentWordInfo && (
|
||||
<div className={cn('text-center', isMobile ? '' : 'text-left')}>
|
||||
<div className="text-sm">
|
||||
Word {currentWordInfo.index} of {currentWordInfo.total}:{' '}
|
||||
{t('wordProgress', {
|
||||
index: currentWordInfo.index,
|
||||
total: currentWordInfo.total,
|
||||
})}{' '}
|
||||
<strong>{currentWordInfo.text}</strong>
|
||||
</div>
|
||||
<div className="text-xs text-muted-foreground">
|
||||
{isSpacebarPressed
|
||||
? 'Holding... Release when word ends'
|
||||
? t('holdingRelease')
|
||||
: isMobile
|
||||
? 'Tap the button when word starts'
|
||||
: 'Press spacebar when word starts (tap for short words, hold for long words)'}
|
||||
? t('tapWhenStarts')
|
||||
: t('pressSpacebarHint')}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -199,7 +155,7 @@ export default function EditTimelineSection({
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -62,6 +62,7 @@ import AutoCorrectPanel from './AutoCorrectPanel'
|
||||
import { useAutoCorrect } from '@/hooks/useAutoCorrect'
|
||||
import { getWordsFromIds } from '@/lib/lyrics-review/utils/wordUtils'
|
||||
import { applyOffsetToCorrectionData, applyOffsetToSegment } from '@/lib/lyrics-review/utils/timingUtils'
|
||||
import { VocalsAudioDataLoader } from './VocalsAudioDataLoader'
|
||||
|
||||
// Add type for window augmentation
|
||||
declare global {
|
||||
@@ -81,6 +82,7 @@ interface ApiClient {
|
||||
addLyrics: (source: string, lyrics: string) => Promise<CorrectionData>
|
||||
searchLyrics?: (artist: string, title: string, forceSources?: string[]) => Promise<SearchLyricsResponse>
|
||||
getAudioUrl: (hash: string) => string
|
||||
getVocalsAudioUrl: () => string
|
||||
generatePreviewVideo: (data: CorrectionData, isDuet?: boolean) => Promise<{
|
||||
status: string
|
||||
message?: string
|
||||
@@ -154,6 +156,8 @@ export default function LyricsAnalyzer({
|
||||
const [reviewMode, setReviewMode] = useState(false)
|
||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||
|
||||
const [vocalsAudioUrl, setVocalsAudioUrl] = useState<string | null>(null)
|
||||
|
||||
// Success screen state (for auto-close after submission)
|
||||
const [showSuccess, setShowSuccess] = useState(false)
|
||||
const [countdown, setCountdown] = useState(2)
|
||||
@@ -570,6 +574,12 @@ export default function LyricsAnalyzer({
|
||||
}
|
||||
}, [showInstrumentalReview, isLocalMode])
|
||||
|
||||
useEffect(() => {
|
||||
if (!apiClient) return
|
||||
|
||||
setVocalsAudioUrl(apiClient.getVocalsAudioUrl())
|
||||
}, [apiClient])
|
||||
|
||||
// Countdown effect for success screen (auto-close/redirect after submission)
|
||||
useEffect(() => {
|
||||
if (!showSuccess) return
|
||||
@@ -1352,330 +1362,332 @@ export default function LyricsAnalyzer({
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="max-w-full overflow-x-hidden">
|
||||
<Header
|
||||
isReadOnly={isReadOnly}
|
||||
onFileLoad={onFileLoad}
|
||||
data={data}
|
||||
onMetricClick={metricClickHandlers}
|
||||
effectiveMode={effectiveMode}
|
||||
onModeChange={setInteractionMode}
|
||||
apiClient={apiClient}
|
||||
audioHash={audioHash}
|
||||
onTimeUpdate={setCurrentAudioTime}
|
||||
onHandlerToggle={handleHandlerToggle}
|
||||
isUpdatingHandlers={isUpdatingHandlers}
|
||||
onHandlerClick={handleHandlerClick}
|
||||
onFindReplace={() => setIsFindReplaceModalOpen(true)}
|
||||
onEditAll={handleReplaceAllLyrics}
|
||||
onTimingOffset={handleOpenTimingOffsetModal}
|
||||
timingOffsetMs={timingOffsetMs}
|
||||
onUndo={handleUndo}
|
||||
onRedo={handleRedo}
|
||||
canUndo={canUndo}
|
||||
canRedo={canRedo}
|
||||
onResetCorrections={handleResetCorrections}
|
||||
statsVisible={statsVisible}
|
||||
onStatsToggle={() => setStatsVisible((v) => !v)}
|
||||
reviewMode={reviewMode}
|
||||
onReviewModeToggle={setReviewMode}
|
||||
onAcceptAllCorrections={handleAcceptAllCorrections}
|
||||
onAcceptHighConfidenceCorrections={handleAcceptHighConfidenceCorrections}
|
||||
onRevertAllCorrections={handleRevertAllCorrections}
|
||||
isDuet={isDuet}
|
||||
onToggleDuet={() => setIsDuet(d => !d)}
|
||||
onAutoCorrect={
|
||||
!isLocalMode && jobId
|
||||
? () =>
|
||||
autoCorrect.acceptedCount > 0
|
||||
? setAutoCorrectDetailsOpen((o) => !o)
|
||||
: setIsAutoCorrectModalOpen(true)
|
||||
: undefined
|
||||
}
|
||||
autoCorrectedCount={autoCorrect.acceptedCount}
|
||||
/>
|
||||
|
||||
<AutoCorrectPanel
|
||||
controller={autoCorrect}
|
||||
isReadOnly={isReadOnly}
|
||||
open={autoCorrectDetailsOpen}
|
||||
onClose={() => setAutoCorrectDetailsOpen(false)}
|
||||
onRerun={() => {
|
||||
setAutoCorrectDetailsOpen(false)
|
||||
setIsAutoCorrectModalOpen(true)
|
||||
}}
|
||||
/>
|
||||
|
||||
<div className={cn('grid gap-2', isMobile ? 'grid-cols-1' : 'grid-cols-2')}>
|
||||
<TranscriptionView
|
||||
data={displayData}
|
||||
mode={effectiveMode}
|
||||
onElementClick={setModalContent}
|
||||
onWordClick={handleWordClick}
|
||||
flashingType={flashingType}
|
||||
flashingHandler={flashingHandler}
|
||||
highlightInfo={highlightInfo}
|
||||
onPlaySegment={handlePlaySegment}
|
||||
currentTime={isAnyModalOpen ? undefined : currentAudioTime}
|
||||
anchors={data.anchor_sequences}
|
||||
onDataChange={(updatedData) => {
|
||||
updateDataWithHistory(updatedData, 'direct data change')
|
||||
}}
|
||||
<VocalsAudioDataLoader audioUrl={vocalsAudioUrl}>
|
||||
<div className="max-w-full overflow-x-hidden">
|
||||
<Header
|
||||
isReadOnly={isReadOnly}
|
||||
onFileLoad={onFileLoad}
|
||||
data={data}
|
||||
onMetricClick={metricClickHandlers}
|
||||
effectiveMode={effectiveMode}
|
||||
onModeChange={setInteractionMode}
|
||||
apiClient={apiClient}
|
||||
audioHash={audioHash}
|
||||
onTimeUpdate={setCurrentAudioTime}
|
||||
onHandlerToggle={handleHandlerToggle}
|
||||
isUpdatingHandlers={isUpdatingHandlers}
|
||||
onHandlerClick={handleHandlerClick}
|
||||
onFindReplace={() => setIsFindReplaceModalOpen(true)}
|
||||
onEditAll={handleReplaceAllLyrics}
|
||||
onTimingOffset={handleOpenTimingOffsetModal}
|
||||
timingOffsetMs={timingOffsetMs}
|
||||
onUndo={handleUndo}
|
||||
onRedo={handleRedo}
|
||||
canUndo={canUndo}
|
||||
canRedo={canRedo}
|
||||
onResetCorrections={handleResetCorrections}
|
||||
statsVisible={statsVisible}
|
||||
onStatsToggle={() => setStatsVisible((v) => !v)}
|
||||
reviewMode={reviewMode}
|
||||
onRevertCorrection={handleRevertCorrection}
|
||||
onEditCorrection={handleEditCorrection}
|
||||
onAcceptCorrection={handleAcceptCorrection}
|
||||
onShowCorrectionDetail={handleShowCorrectionDetail}
|
||||
activeGapWordIds={activeGapWordIds}
|
||||
advancedMode={advancedMode}
|
||||
onAdvancedModeToggle={handleAdvancedModeToggle}
|
||||
editedWordIds={editedWordIds}
|
||||
aiCorrectedWordIds={aiCorrectedWordIds}
|
||||
aiOriginalTextByWordId={aiOriginalTextByWordId}
|
||||
aiEstimatedWordIds={aiEstimatedWordIds}
|
||||
onReviewModeToggle={setReviewMode}
|
||||
onAcceptAllCorrections={handleAcceptAllCorrections}
|
||||
onAcceptHighConfidenceCorrections={handleAcceptHighConfidenceCorrections}
|
||||
onRevertAllCorrections={handleRevertAllCorrections}
|
||||
isDuet={isDuet}
|
||||
onSegmentSingerChange={(segmentIdx, next) => {
|
||||
const segments = [...data.corrected_segments]
|
||||
segments[segmentIdx] = { ...segments[segmentIdx], singer: next }
|
||||
updateDataWithHistory({ ...data, corrected_segments: segments }, 'singer change')
|
||||
}}
|
||||
onSegmentFocus={setFocusedSegmentIndex}
|
||||
onToggleDuet={() => setIsDuet(d => !d)}
|
||||
onAutoCorrect={
|
||||
!isLocalMode && jobId
|
||||
? () =>
|
||||
autoCorrect.acceptedCount > 0
|
||||
? setAutoCorrectDetailsOpen((o) => !o)
|
||||
: setIsAutoCorrectModalOpen(true)
|
||||
: undefined
|
||||
}
|
||||
autoCorrectedCount={autoCorrect.acceptedCount}
|
||||
/>
|
||||
<ReferenceView
|
||||
referenceSources={data.reference_lyrics}
|
||||
anchors={data.anchor_sequences}
|
||||
gaps={data.gap_sequences}
|
||||
mode={effectiveMode}
|
||||
onElementClick={setModalContent}
|
||||
onWordClick={handleWordClick}
|
||||
flashingType={flashingType}
|
||||
highlightInfo={highlightInfo}
|
||||
currentSource={currentSource}
|
||||
onSourceChange={setCurrentSource}
|
||||
corrected_segments={data.corrected_segments}
|
||||
corrections={data.corrections}
|
||||
onAddLyrics={() => setIsAddLyricsModalOpen(true)}
|
||||
onAddLyricsInline={handleAddLyrics}
|
||||
onSearchLyrics={handleSearchLyrics}
|
||||
|
||||
<AutoCorrectPanel
|
||||
controller={autoCorrect}
|
||||
isReadOnly={isReadOnly}
|
||||
open={autoCorrectDetailsOpen}
|
||||
onClose={() => setAutoCorrectDetailsOpen(false)}
|
||||
onRerun={() => {
|
||||
setAutoCorrectDetailsOpen(false)
|
||||
setIsAutoCorrectModalOpen(true)
|
||||
}}
|
||||
/>
|
||||
|
||||
<div className={cn('grid gap-2', isMobile ? 'grid-cols-1' : 'grid-cols-2')}>
|
||||
<TranscriptionView
|
||||
data={displayData}
|
||||
mode={effectiveMode}
|
||||
onElementClick={setModalContent}
|
||||
onWordClick={handleWordClick}
|
||||
flashingType={flashingType}
|
||||
flashingHandler={flashingHandler}
|
||||
highlightInfo={highlightInfo}
|
||||
onPlaySegment={handlePlaySegment}
|
||||
currentTime={isAnyModalOpen ? undefined : currentAudioTime}
|
||||
anchors={data.anchor_sequences}
|
||||
onDataChange={(updatedData) => {
|
||||
updateDataWithHistory(updatedData, 'direct data change')
|
||||
}}
|
||||
reviewMode={reviewMode}
|
||||
onRevertCorrection={handleRevertCorrection}
|
||||
onEditCorrection={handleEditCorrection}
|
||||
onAcceptCorrection={handleAcceptCorrection}
|
||||
onShowCorrectionDetail={handleShowCorrectionDetail}
|
||||
activeGapWordIds={activeGapWordIds}
|
||||
advancedMode={advancedMode}
|
||||
onAdvancedModeToggle={handleAdvancedModeToggle}
|
||||
editedWordIds={editedWordIds}
|
||||
aiCorrectedWordIds={aiCorrectedWordIds}
|
||||
aiOriginalTextByWordId={aiOriginalTextByWordId}
|
||||
aiEstimatedWordIds={aiEstimatedWordIds}
|
||||
isDuet={isDuet}
|
||||
onSegmentSingerChange={(segmentIdx, next) => {
|
||||
const segments = [...data.corrected_segments]
|
||||
segments[segmentIdx] = { ...segments[segmentIdx], singer: next }
|
||||
updateDataWithHistory({ ...data, corrected_segments: segments }, 'singer change')
|
||||
}}
|
||||
onSegmentFocus={setFocusedSegmentIndex}
|
||||
/>
|
||||
<ReferenceView
|
||||
referenceSources={data.reference_lyrics}
|
||||
anchors={data.anchor_sequences}
|
||||
gaps={data.gap_sequences}
|
||||
mode={effectiveMode}
|
||||
onElementClick={setModalContent}
|
||||
onWordClick={handleWordClick}
|
||||
flashingType={flashingType}
|
||||
highlightInfo={highlightInfo}
|
||||
currentSource={currentSource}
|
||||
onSourceChange={setCurrentSource}
|
||||
corrected_segments={data.corrected_segments}
|
||||
corrections={data.corrections}
|
||||
onAddLyrics={() => setIsAddLyricsModalOpen(true)}
|
||||
onAddLyricsInline={handleAddLyrics}
|
||||
onSearchLyrics={handleSearchLyrics}
|
||||
defaultArtist={data.metadata?.artist || ''}
|
||||
defaultTitle={data.metadata?.title || ''}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Spacer for sticky footer */}
|
||||
{!isReadOnly && apiClient && <div className="h-16" />}
|
||||
|
||||
{/* Sticky footer bar */}
|
||||
{!isReadOnly && apiClient && (
|
||||
<div className="fixed bottom-0 left-0 right-0 bg-background border-t shadow-lg py-3 px-4 z-50 flex justify-center items-center gap-4 flex-wrap">
|
||||
<GapNavigator
|
||||
currentGapIndex={currentGapIndex}
|
||||
totalGaps={uncorrectedGaps.length}
|
||||
onPrevGap={handlePrevGap}
|
||||
onNextGap={handleNextGap}
|
||||
/>
|
||||
{data.gap_sequences.length > 0 && (
|
||||
<div className="flex items-center gap-1.5">
|
||||
<div className="w-16 h-1.5 bg-muted rounded-full overflow-hidden">
|
||||
<div
|
||||
className="h-full bg-green-500 rounded-full transition-all"
|
||||
style={{
|
||||
width: `${data.gap_sequences.length > 0 ? ((data.gap_sequences.length - uncorrectedGaps.length) / data.gap_sequences.length) * 100 : 0}%`,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{uncorrectedGaps.length === 0 ? (
|
||||
<span className="text-xs text-green-500 flex items-center gap-0.5">
|
||||
<CheckCircle2 className="h-3.5 w-3.5" />
|
||||
All gaps reviewed
|
||||
</span>
|
||||
) : (
|
||||
<span className="text-xs text-muted-foreground whitespace-nowrap">
|
||||
{data.gap_sequences.length - uncorrectedGaps.length}/{data.gap_sequences.length} gaps reviewed
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{apiClient?.saveReviewSession && (
|
||||
<>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => saveSession('manual')}
|
||||
disabled={history.length <= 1}
|
||||
>
|
||||
Save Progress
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={handleOpenSessionBrowser}
|
||||
>
|
||||
Session History
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
<span className="text-sm text-muted-foreground">Lyrics look good?</span>
|
||||
<Button onClick={handleFinishReview} disabled={isReviewComplete}>
|
||||
{isReviewComplete ? 'Review Complete' : 'Preview Video'}
|
||||
<Video className="ml-2 h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Modals */}
|
||||
<EditModal
|
||||
open={Boolean(editModalSegment)}
|
||||
onClose={() => {
|
||||
setEditModalSegment(null)
|
||||
handleSetModalSpacebarHandler(undefined)
|
||||
}}
|
||||
segment={
|
||||
editModalSegment?.segment
|
||||
? timingOffsetMs !== 0
|
||||
? applyOffsetToSegment(editModalSegment.segment, timingOffsetMs)
|
||||
: editModalSegment.segment
|
||||
: null
|
||||
}
|
||||
segmentIndex={editModalSegment?.index ?? null}
|
||||
originalSegment={
|
||||
editModalSegment?.originalSegment
|
||||
? timingOffsetMs !== 0
|
||||
? applyOffsetToSegment(editModalSegment.originalSegment, timingOffsetMs)
|
||||
: editModalSegment.originalSegment
|
||||
: null
|
||||
}
|
||||
onSave={handleUpdateSegment}
|
||||
onDelete={handleDeleteSegment}
|
||||
onAddSegment={handleAddSegment}
|
||||
onSplitSegment={handleSplitSegment}
|
||||
onMergeSegment={handleMergeSegment}
|
||||
onPlaySegment={handlePlaySegment}
|
||||
currentTime={currentAudioTime}
|
||||
originalTranscribedSegment={
|
||||
editModalSegment?.segment &&
|
||||
editModalSegment?.index !== null &&
|
||||
originalData.original_segments
|
||||
? (() => {
|
||||
const origSegment =
|
||||
originalData.original_segments.find(
|
||||
(s: LyricsSegment) => s.id === editModalSegment.segment.id
|
||||
) || null
|
||||
return origSegment && timingOffsetMs !== 0
|
||||
? applyOffsetToSegment(origSegment, timingOffsetMs)
|
||||
: origSegment
|
||||
})()
|
||||
: null
|
||||
}
|
||||
/>
|
||||
|
||||
<ReviewChangesModal
|
||||
open={isReviewModalOpen}
|
||||
onClose={() => setIsReviewModalOpen(false)}
|
||||
data={data}
|
||||
onSubmit={handleSubmitToServer}
|
||||
isSubmitting={isSubmitting}
|
||||
apiClient={apiClient}
|
||||
timingOffsetMs={timingOffsetMs}
|
||||
isDuet={isDuet}
|
||||
/>
|
||||
|
||||
<AddLyricsModal
|
||||
open={isAddLyricsModalOpen}
|
||||
onClose={() => setIsAddLyricsModalOpen(false)}
|
||||
onAdd={handleAddLyrics}
|
||||
onSearch={handleSearchLyrics}
|
||||
defaultArtist={data.metadata?.artist || ''}
|
||||
defaultTitle={data.metadata?.title || ''}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Spacer for sticky footer */}
|
||||
{!isReadOnly && apiClient && <div className="h-16" />}
|
||||
<FindReplaceModal
|
||||
open={isFindReplaceModalOpen}
|
||||
onClose={() => setIsFindReplaceModalOpen(false)}
|
||||
onReplace={handleFindReplace}
|
||||
data={data}
|
||||
/>
|
||||
|
||||
{/* Sticky footer bar */}
|
||||
{!isReadOnly && apiClient && (
|
||||
<div className="fixed bottom-0 left-0 right-0 bg-background border-t shadow-lg py-3 px-4 z-50 flex justify-center items-center gap-4 flex-wrap">
|
||||
<GapNavigator
|
||||
currentGapIndex={currentGapIndex}
|
||||
totalGaps={uncorrectedGaps.length}
|
||||
onPrevGap={handlePrevGap}
|
||||
onNextGap={handleNextGap}
|
||||
<TimingOffsetModal
|
||||
open={isTimingOffsetModalOpen}
|
||||
onClose={() => setIsTimingOffsetModalOpen(false)}
|
||||
currentOffset={timingOffsetMs}
|
||||
onApply={handleApplyTimingOffset}
|
||||
/>
|
||||
|
||||
<ReplaceAllLyricsModal
|
||||
open={isReplaceAllLyricsModalOpen}
|
||||
onClose={() => setIsReplaceAllLyricsModalOpen(false)}
|
||||
onSave={handleSaveReplaceAllLyrics}
|
||||
onPlaySegment={handlePlaySegment}
|
||||
currentTime={currentAudioTime}
|
||||
setModalSpacebarHandler={handleSetModalSpacebarHandler}
|
||||
existingSegments={data.corrected_segments}
|
||||
jobId={jobId ?? ''}
|
||||
artist={data.metadata?.artist}
|
||||
title={data.metadata?.title}
|
||||
authToken={getAccessToken() ?? undefined}
|
||||
/>
|
||||
|
||||
<AutoCorrectModal
|
||||
open={isAutoCorrectModalOpen}
|
||||
onClose={() => setIsAutoCorrectModalOpen(false)}
|
||||
onRun={(settings) => void autoCorrect.run(settings)}
|
||||
onCancelRun={autoCorrect.cancel}
|
||||
status={autoCorrect.status}
|
||||
error={autoCorrect.error}
|
||||
hasReferences={autoCorrect.hasReferences}
|
||||
/>
|
||||
|
||||
<EditFeedbackBar
|
||||
entry={lastEditEntry}
|
||||
visible={showFeedbackBar}
|
||||
onFeedback={handleEditFeedback}
|
||||
onDismiss={() => setShowFeedbackBar(false)}
|
||||
/>
|
||||
|
||||
{selectedCorrection && (
|
||||
<CorrectionDetailCard
|
||||
open={correctionDetailOpen}
|
||||
onClose={() => {
|
||||
setCorrectionDetailOpen(false)
|
||||
setSelectedCorrection(null)
|
||||
}}
|
||||
originalWord={selectedCorrection.originalWord}
|
||||
correctedWord={selectedCorrection.correctedWord}
|
||||
category={selectedCorrection.category}
|
||||
confidence={selectedCorrection.confidence}
|
||||
reason={selectedCorrection.reason}
|
||||
handler={selectedCorrection.handler}
|
||||
source={selectedCorrection.source}
|
||||
onRevert={() => {
|
||||
handleRevertCorrection(selectedCorrection.wordId)
|
||||
setCorrectionDetailOpen(false)
|
||||
setSelectedCorrection(null)
|
||||
}}
|
||||
onEdit={() => {
|
||||
handleEditCorrection(selectedCorrection.wordId)
|
||||
setCorrectionDetailOpen(false)
|
||||
setSelectedCorrection(null)
|
||||
}}
|
||||
onAccept={() => {
|
||||
handleAcceptCorrection(selectedCorrection.wordId)
|
||||
setCorrectionDetailOpen(false)
|
||||
setSelectedCorrection(null)
|
||||
}}
|
||||
/>
|
||||
{data.gap_sequences.length > 0 && (
|
||||
<div className="flex items-center gap-1.5">
|
||||
<div className="w-16 h-1.5 bg-muted rounded-full overflow-hidden">
|
||||
<div
|
||||
className="h-full bg-green-500 rounded-full transition-all"
|
||||
style={{
|
||||
width: `${data.gap_sequences.length > 0 ? ((data.gap_sequences.length - uncorrectedGaps.length) / data.gap_sequences.length) * 100 : 0}%`,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{uncorrectedGaps.length === 0 ? (
|
||||
<span className="text-xs text-green-500 flex items-center gap-0.5">
|
||||
<CheckCircle2 className="h-3.5 w-3.5" />
|
||||
All gaps reviewed
|
||||
</span>
|
||||
) : (
|
||||
<span className="text-xs text-muted-foreground whitespace-nowrap">
|
||||
{data.gap_sequences.length - uncorrectedGaps.length}/{data.gap_sequences.length} gaps reviewed
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{apiClient?.saveReviewSession && (
|
||||
<>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => saveSession('manual')}
|
||||
disabled={history.length <= 1}
|
||||
>
|
||||
Save Progress
|
||||
</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={handleOpenSessionBrowser}
|
||||
>
|
||||
Session History
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
<span className="text-sm text-muted-foreground">Lyrics look good?</span>
|
||||
<Button onClick={handleFinishReview} disabled={isReviewComplete}>
|
||||
{isReviewComplete ? 'Review Complete' : 'Preview Video'}
|
||||
<Video className="ml-2 h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
)}
|
||||
|
||||
{/* Modals */}
|
||||
<EditModal
|
||||
open={Boolean(editModalSegment)}
|
||||
onClose={() => {
|
||||
setEditModalSegment(null)
|
||||
handleSetModalSpacebarHandler(undefined)
|
||||
}}
|
||||
segment={
|
||||
editModalSegment?.segment
|
||||
? timingOffsetMs !== 0
|
||||
? applyOffsetToSegment(editModalSegment.segment, timingOffsetMs)
|
||||
: editModalSegment.segment
|
||||
: null
|
||||
}
|
||||
segmentIndex={editModalSegment?.index ?? null}
|
||||
originalSegment={
|
||||
editModalSegment?.originalSegment
|
||||
? timingOffsetMs !== 0
|
||||
? applyOffsetToSegment(editModalSegment.originalSegment, timingOffsetMs)
|
||||
: editModalSegment.originalSegment
|
||||
: null
|
||||
}
|
||||
onSave={handleUpdateSegment}
|
||||
onDelete={handleDeleteSegment}
|
||||
onAddSegment={handleAddSegment}
|
||||
onSplitSegment={handleSplitSegment}
|
||||
onMergeSegment={handleMergeSegment}
|
||||
onPlaySegment={handlePlaySegment}
|
||||
currentTime={currentAudioTime}
|
||||
originalTranscribedSegment={
|
||||
editModalSegment?.segment &&
|
||||
editModalSegment?.index !== null &&
|
||||
originalData.original_segments
|
||||
? (() => {
|
||||
const origSegment =
|
||||
originalData.original_segments.find(
|
||||
(s: LyricsSegment) => s.id === editModalSegment.segment.id
|
||||
) || null
|
||||
return origSegment && timingOffsetMs !== 0
|
||||
? applyOffsetToSegment(origSegment, timingOffsetMs)
|
||||
: origSegment
|
||||
})()
|
||||
: null
|
||||
}
|
||||
/>
|
||||
|
||||
<ReviewChangesModal
|
||||
open={isReviewModalOpen}
|
||||
onClose={() => setIsReviewModalOpen(false)}
|
||||
data={data}
|
||||
onSubmit={handleSubmitToServer}
|
||||
isSubmitting={isSubmitting}
|
||||
apiClient={apiClient}
|
||||
timingOffsetMs={timingOffsetMs}
|
||||
isDuet={isDuet}
|
||||
/>
|
||||
|
||||
<AddLyricsModal
|
||||
open={isAddLyricsModalOpen}
|
||||
onClose={() => setIsAddLyricsModalOpen(false)}
|
||||
onAdd={handleAddLyrics}
|
||||
onSearch={handleSearchLyrics}
|
||||
defaultArtist={data.metadata?.artist || ''}
|
||||
defaultTitle={data.metadata?.title || ''}
|
||||
/>
|
||||
|
||||
<FindReplaceModal
|
||||
open={isFindReplaceModalOpen}
|
||||
onClose={() => setIsFindReplaceModalOpen(false)}
|
||||
onReplace={handleFindReplace}
|
||||
data={data}
|
||||
/>
|
||||
|
||||
<TimingOffsetModal
|
||||
open={isTimingOffsetModalOpen}
|
||||
onClose={() => setIsTimingOffsetModalOpen(false)}
|
||||
currentOffset={timingOffsetMs}
|
||||
onApply={handleApplyTimingOffset}
|
||||
/>
|
||||
|
||||
<ReplaceAllLyricsModal
|
||||
open={isReplaceAllLyricsModalOpen}
|
||||
onClose={() => setIsReplaceAllLyricsModalOpen(false)}
|
||||
onSave={handleSaveReplaceAllLyrics}
|
||||
onPlaySegment={handlePlaySegment}
|
||||
currentTime={currentAudioTime}
|
||||
setModalSpacebarHandler={handleSetModalSpacebarHandler}
|
||||
existingSegments={data.corrected_segments}
|
||||
jobId={jobId ?? ''}
|
||||
artist={data.metadata?.artist}
|
||||
title={data.metadata?.title}
|
||||
authToken={getAccessToken() ?? undefined}
|
||||
/>
|
||||
|
||||
<AutoCorrectModal
|
||||
open={isAutoCorrectModalOpen}
|
||||
onClose={() => setIsAutoCorrectModalOpen(false)}
|
||||
onRun={(settings) => void autoCorrect.run(settings)}
|
||||
onCancelRun={autoCorrect.cancel}
|
||||
status={autoCorrect.status}
|
||||
error={autoCorrect.error}
|
||||
hasReferences={autoCorrect.hasReferences}
|
||||
/>
|
||||
|
||||
<EditFeedbackBar
|
||||
entry={lastEditEntry}
|
||||
visible={showFeedbackBar}
|
||||
onFeedback={handleEditFeedback}
|
||||
onDismiss={() => setShowFeedbackBar(false)}
|
||||
/>
|
||||
|
||||
{selectedCorrection && (
|
||||
<CorrectionDetailCard
|
||||
open={correctionDetailOpen}
|
||||
onClose={() => {
|
||||
setCorrectionDetailOpen(false)
|
||||
setSelectedCorrection(null)
|
||||
}}
|
||||
originalWord={selectedCorrection.originalWord}
|
||||
correctedWord={selectedCorrection.correctedWord}
|
||||
category={selectedCorrection.category}
|
||||
confidence={selectedCorrection.confidence}
|
||||
reason={selectedCorrection.reason}
|
||||
handler={selectedCorrection.handler}
|
||||
source={selectedCorrection.source}
|
||||
onRevert={() => {
|
||||
handleRevertCorrection(selectedCorrection.wordId)
|
||||
setCorrectionDetailOpen(false)
|
||||
setSelectedCorrection(null)
|
||||
}}
|
||||
onEdit={() => {
|
||||
handleEditCorrection(selectedCorrection.wordId)
|
||||
setCorrectionDetailOpen(false)
|
||||
setSelectedCorrection(null)
|
||||
}}
|
||||
onAccept={() => {
|
||||
handleAcceptCorrection(selectedCorrection.wordId)
|
||||
setCorrectionDetailOpen(false)
|
||||
setSelectedCorrection(null)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!isReadOnly && (
|
||||
<SessionRestoreDialog
|
||||
open={sessionRestoreOpen}
|
||||
onClose={() => setSessionRestoreOpen(false)}
|
||||
onRestore={handleSessionRestore}
|
||||
sessions={savedSessions}
|
||||
apiClient={sessionClient as LyricsReviewApiClient}
|
||||
isLoading={sessionsLoading}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{!isReadOnly && (
|
||||
<SessionRestoreDialog
|
||||
open={sessionRestoreOpen}
|
||||
onClose={() => setSessionRestoreOpen(false)}
|
||||
onRestore={handleSessionRestore}
|
||||
sessions={savedSessions}
|
||||
apiClient={sessionClient as LyricsReviewApiClient}
|
||||
isLoading={sessionsLoading}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</VocalsAudioDataLoader>
|
||||
)
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
import { useRef, useState } from 'react'
|
||||
import { Word } from '@/lib/lyrics-review/types'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { WaveformVisualizer } from './WaveformVisualizer'
|
||||
import { VocalsAudioDataLoaderContext } from './VocalsAudioDataLoader'
|
||||
|
||||
interface TimelineEditorProps {
|
||||
words: Word[]
|
||||
@@ -241,14 +243,14 @@ export default function TimelineEditor({
|
||||
return (
|
||||
<div
|
||||
ref={containerRef}
|
||||
className="relative h-[75px] bg-card rounded my-2 px-2 border border-border"
|
||||
className="relative bg-card rounded border border-border"
|
||||
onMouseMove={handleMouseMove}
|
||||
onMouseUp={handleMouseUp}
|
||||
onMouseLeave={handleMouseUp}
|
||||
>
|
||||
{/* Timeline ruler */}
|
||||
<div
|
||||
className="absolute top-0 left-0 right-0 h-10 border-b border-border cursor-pointer"
|
||||
className="h-10 border-b border-border cursor-pointer"
|
||||
onClick={handleTimelineClick}
|
||||
>
|
||||
{generateTimelineMarks()}
|
||||
@@ -263,52 +265,65 @@ export default function TimelineEditor({
|
||||
)}
|
||||
|
||||
{/* Word blocks */}
|
||||
{words.map((word, index) => {
|
||||
if (word.start_time === null || word.end_time === null) return null
|
||||
<div className="relative h-[30px]">
|
||||
{words.map((word, index) => {
|
||||
if (word.start_time === null || word.end_time === null) return null
|
||||
|
||||
const leftPosition = timeToPosition(word.start_time)
|
||||
const rightPosition = timeToPosition(word.end_time)
|
||||
const width = rightPosition - leftPosition
|
||||
const leftPosition = timeToPosition(word.start_time)
|
||||
const rightPosition = timeToPosition(word.end_time)
|
||||
const width = rightPosition - leftPosition
|
||||
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
className={cn(
|
||||
'absolute h-[30px] top-10 bg-primary rounded text-primary-foreground px-2 py-1',
|
||||
'cursor-move select-none flex items-center text-sm font-sans transition-colors',
|
||||
isWordHighlighted(word) && 'bg-purple-500 dark:bg-purple-600'
|
||||
)}
|
||||
style={{
|
||||
left: `${leftPosition}%`,
|
||||
width: `${width}%`,
|
||||
maxWidth: `calc(${100 - leftPosition}%)`,
|
||||
}}
|
||||
onMouseDown={(e) => {
|
||||
e.stopPropagation()
|
||||
handleMouseDown(e, index, 'move')
|
||||
}}
|
||||
onContextMenu={(e) => handleContextMenu(e, index)}
|
||||
>
|
||||
{/* Left resize handle */}
|
||||
return (
|
||||
<div
|
||||
className="absolute top-0 left-0 w-2.5 h-full cursor-col-resize hover:bg-primary-foreground/20 rounded-l"
|
||||
key={index}
|
||||
className={cn(
|
||||
'absolute bg-primary rounded text-primary-foreground px-2 py-1',
|
||||
'cursor-move select-none flex items-center text-sm font-sans transition-colors',
|
||||
isWordHighlighted(word) && 'bg-purple-500 dark:bg-purple-600'
|
||||
)}
|
||||
style={{
|
||||
left: `${leftPosition}%`,
|
||||
width: `${width}%`,
|
||||
maxWidth: `calc(${100 - leftPosition}%)`,
|
||||
}}
|
||||
onMouseDown={(e) => {
|
||||
e.stopPropagation()
|
||||
handleMouseDown(e, index, 'resize-left')
|
||||
handleMouseDown(e, index, 'move')
|
||||
}}
|
||||
/>
|
||||
{word.text}
|
||||
{/* Right resize handle */}
|
||||
<div
|
||||
className="absolute top-0 right-0 w-2.5 h-full cursor-col-resize hover:bg-primary-foreground/20 rounded-r"
|
||||
onMouseDown={(e) => {
|
||||
e.stopPropagation()
|
||||
handleMouseDown(e, index, 'resize-right')
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
onContextMenu={(e) => handleContextMenu(e, index)}
|
||||
>
|
||||
{/* Left resize handle */}
|
||||
<div
|
||||
className="absolute top-0 left-0 w-2.5 h-full cursor-col-resize hover:bg-primary-foreground/20 rounded-l"
|
||||
onMouseDown={(e) => {
|
||||
e.stopPropagation()
|
||||
handleMouseDown(e, index, 'resize-left')
|
||||
}}
|
||||
/>
|
||||
{word.text}
|
||||
{/* Right resize handle */}
|
||||
<div
|
||||
className="absolute top-0 right-0 w-2.5 h-full cursor-col-resize hover:bg-primary-foreground/20 rounded-r"
|
||||
onMouseDown={(e) => {
|
||||
e.stopPropagation()
|
||||
handleMouseDown(e, index, 'resize-right')
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
|
||||
<VocalsAudioDataLoaderContext.Consumer>
|
||||
{({ audioData: vocalsAudioData }) => (
|
||||
vocalsAudioData && <WaveformVisualizer
|
||||
startTime={startTime}
|
||||
endTime={endTime}
|
||||
audioData={vocalsAudioData}
|
||||
className="w-[100%] h-[35px]"
|
||||
/>
|
||||
)}
|
||||
</VocalsAudioDataLoaderContext.Consumer>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { AudioData, fetchAudioData } from '@/lib/audio-data'
|
||||
import { createContext, PropsWithChildren, useEffect, useState } from 'react'
|
||||
|
||||
export const VocalsAudioDataLoaderContext = createContext<{ audioData: AudioData | null }>({ audioData: null })
|
||||
|
||||
export interface AudioDataLoaderProps extends PropsWithChildren {
|
||||
audioUrl: string | null
|
||||
}
|
||||
|
||||
export const VocalsAudioDataLoader = ({ audioUrl, children }: AudioDataLoaderProps) => {
|
||||
const [audioData, setAudioData] = useState<AudioData | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
if (!audioUrl) return
|
||||
|
||||
// Guard against (a) an unhandled rejection when the endpoint 404s (no vocal
|
||||
// stem for this job) and (b) a stale in-flight fetch resolving after a newer
|
||||
// audioUrl has already been set.
|
||||
let cancelled = false
|
||||
|
||||
fetchAudioData(audioUrl)
|
||||
.then((audioData) => {
|
||||
if (!cancelled) setAudioData(audioData)
|
||||
})
|
||||
.catch((error) => {
|
||||
if (!cancelled) {
|
||||
console.error('Failed to load vocals audio data', error)
|
||||
setAudioData(null)
|
||||
}
|
||||
})
|
||||
|
||||
return () => {
|
||||
cancelled = true
|
||||
setAudioData(null)
|
||||
}
|
||||
}, [audioUrl])
|
||||
|
||||
return (
|
||||
<VocalsAudioDataLoaderContext.Provider value={{ audioData }}>
|
||||
{children}
|
||||
</VocalsAudioDataLoaderContext.Provider>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
import { HTMLProps, useCallback, useEffect, useRef, useState } from 'react'
|
||||
import colors from 'tailwindcss/colors'
|
||||
import { AudioData } from '@/lib/audio-data'
|
||||
import { useAudioReady } from '@/lib/lyrics-review/hooks/useAudioReady'
|
||||
|
||||
export interface WaveformVisualizerProps extends Omit<HTMLProps<HTMLCanvasElement>, 'width' | 'height'> {
|
||||
startTime: number
|
||||
endTime: number
|
||||
audioData: AudioData | null
|
||||
barColor?: string
|
||||
}
|
||||
|
||||
export const WaveformVisualizer = ({
|
||||
startTime,
|
||||
endTime,
|
||||
audioData,
|
||||
className,
|
||||
barColor = colors.yellow['500'],
|
||||
... canvasProps
|
||||
}: WaveformVisualizerProps) => {
|
||||
const containerRef = useRef<HTMLDivElement | null>(null)
|
||||
const canvasCtxRef = useRef<CanvasRenderingContext2D | null>(null)
|
||||
const audioReady = useAudioReady()
|
||||
const [canvasSize, setCanvasSize] = useState<{ width: number; height: number; }>({ width: 0, height: 0 })
|
||||
|
||||
useEffect(() => {
|
||||
if (!containerRef.current) return
|
||||
|
||||
const resizeObserver = new ResizeObserver((entries) => {
|
||||
const size = entries.at(-1)!.contentBoxSize[0]
|
||||
setCanvasSize({
|
||||
width: size.inlineSize,
|
||||
height: size.blockSize
|
||||
})
|
||||
})
|
||||
resizeObserver.observe(containerRef.current, {
|
||||
box: 'content-box'
|
||||
})
|
||||
|
||||
return () => {
|
||||
resizeObserver.disconnect()
|
||||
}
|
||||
}, [containerRef.current])
|
||||
|
||||
const readAudioData = useCallback((startTime: number, endTime: number) => {
|
||||
if (audioData == null) return null
|
||||
|
||||
// Index directly into the time-based peak envelope (peaksPerSecond buckets
|
||||
// per second) so we only ever touch the window being drawn, never the whole
|
||||
// track.
|
||||
const startIndex = Math.max(0, Math.floor(startTime * audioData.peaksPerSecond))
|
||||
const endIndex = Math.min(audioData.peaks.length, Math.ceil(endTime * audioData.peaksPerSecond))
|
||||
return audioData.peaks.slice(startIndex, endIndex)
|
||||
}, [audioData])
|
||||
|
||||
const render = useCallback((startTime: number, endTime: number) => {
|
||||
const ctx = canvasCtxRef.current
|
||||
if (!ctx) return
|
||||
|
||||
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height)
|
||||
|
||||
ctx.fillStyle = barColor
|
||||
|
||||
const audioData = readAudioData(startTime, endTime)
|
||||
if (!audioData) return
|
||||
|
||||
for (let x = 0; x < ctx.canvas.width; x++) {
|
||||
// Clamp the first pixel: (x - 0.5) is negative at x=0, and a negative
|
||||
// slice start would sample peaks from the end of the window instead.
|
||||
const dataPointIndex = Math.max(0, Math.floor((x - 0.5) / ctx.canvas.width * audioData.length))
|
||||
// When fewer peaks than pixels are visible (zoomed in), adjacent columns
|
||||
// floor to the same index; force at least one peak per column so the
|
||||
// waveform doesn't render zero-height gaps.
|
||||
const nextDataPointIndex = Math.max(
|
||||
dataPointIndex + 1,
|
||||
Math.floor((x + 0.5) / ctx.canvas.width * audioData.length)
|
||||
)
|
||||
|
||||
const amplitude = audioData
|
||||
.slice(dataPointIndex, nextDataPointIndex)
|
||||
.reduce((maxAmplitude, point) => Math.max(maxAmplitude, Math.abs(point)), 0)
|
||||
|
||||
const barHeight = amplitude * ctx.canvas.height
|
||||
|
||||
ctx.fillRect(x, (ctx.canvas.height - barHeight) / 2, 1, barHeight)
|
||||
}
|
||||
}, [readAudioData, barColor])
|
||||
|
||||
// Re-render when the data (readAudioData is memoized on audioData), the window,
|
||||
// the canvas size, or the colour changes. audioData arrives asynchronously, so
|
||||
// omitting `render` here would leave the canvas blank until an unrelated prop
|
||||
// changed.
|
||||
useEffect(() => {
|
||||
render(startTime, endTime)
|
||||
}, [render, startTime, endTime, canvasSize, audioReady.ready])
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={containerRef}
|
||||
className={className}
|
||||
>
|
||||
<canvas
|
||||
ref={(el) => {
|
||||
canvasCtxRef.current = el?.getContext('2d') ?? null
|
||||
}}
|
||||
className={"w-[100%] h-[100%]"}
|
||||
width={canvasSize.width}
|
||||
height={canvasSize.height}
|
||||
{... canvasProps}
|
||||
></canvas>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -5,7 +5,8 @@ import { useState, useEffect, useCallback, useRef } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Loader2, Play, Square, RotateCcw, Trash2, History } from 'lucide-react'
|
||||
import { Loader2, Play, Square, RotateCcw, Trash2, History, XCircle } from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { LyricsSegment, Word } from '@/lib/lyrics-review/types'
|
||||
import { nanoid } from 'nanoid'
|
||||
import EditWordList from '../EditWordList'
|
||||
@@ -56,6 +57,7 @@ export default function EditModal({
|
||||
const t = useTranslations('lyricsReview.modals.editAll')
|
||||
const tActions = useTranslations('lyricsReview.editActionBar')
|
||||
const tHeader = useTranslations('lyricsReview.header')
|
||||
const tTimeline = useTranslations('lyricsReview.editTimeline')
|
||||
const { ready: audioReady } = useAudioReady()
|
||||
const [editedSegment, setEditedSegment] = useState<LyricsSegment | null>(segment)
|
||||
const [timingFixCount, setTimingFixCount] = useState(0)
|
||||
@@ -383,23 +385,65 @@ export default function EditModal({
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={(isOpen) => !isOpen && handleClose()}>
|
||||
<DialogContent className="max-w-[960px] max-h-[90vh] overflow-hidden flex flex-col" onKeyDown={handleKeyDown}>
|
||||
<DialogContent className="max-w-[960px] max-h-[90vh] overflow-hidden flex flex-col gap-2" onKeyDown={handleKeyDown}>
|
||||
<DialogHeader>
|
||||
<DialogTitle className="flex items-center gap-2">
|
||||
{isGlobal ? t('title') : t('editSegment', { index: segmentIndex ?? 0 })}
|
||||
{segment && segment.start_time !== null && onPlaySegment && (
|
||||
{/* Left: title (with the segment's time range folded into the heading)
|
||||
+ play. Right: Tap To Sync, moved up here to reclaim vertical space
|
||||
above the word list. pr-10 keeps it clear of the dialog close button. */}
|
||||
<div className="flex items-center justify-between gap-4 pr-10">
|
||||
<DialogTitle className="flex items-center gap-2">
|
||||
<span>
|
||||
{isGlobal ? t('title') : t('editSegment', { index: segmentIndex ?? 0 })}
|
||||
{!isGlobal &&
|
||||
editedSegment &&
|
||||
editedSegment.start_time !== null &&
|
||||
editedSegment.end_time !== null && (
|
||||
<span className="font-normal text-muted-foreground">
|
||||
{' '}
|
||||
({editedSegment.start_time.toFixed(2)} - {editedSegment.end_time.toFixed(2)})
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
{segment && segment.start_time !== null && onPlaySegment && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-8 w-8"
|
||||
onClick={handlePlayToggle}
|
||||
disabled={!audioReady}
|
||||
title={audioReady ? undefined : tHeader('audioStillLoading')}
|
||||
>
|
||||
{isPlaying ? <Square className="h-4 w-4" /> : <Play className="h-4 w-4" />}
|
||||
</Button>
|
||||
)}
|
||||
</DialogTitle>
|
||||
|
||||
{/* Tap To Sync toggle (relocated from EditTimelineSection) */}
|
||||
{editedSegment && editedSegment.words.some((w) => w.start_time !== null) && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-8 w-8"
|
||||
onClick={handlePlayToggle}
|
||||
disabled={!audioReady}
|
||||
title={audioReady ? undefined : tHeader('audioStillLoading')}
|
||||
variant={isManualSyncing ? 'outline' : 'default'}
|
||||
onClick={startManualSync}
|
||||
className={cn(
|
||||
'shrink-0',
|
||||
isManualSyncing
|
||||
? 'border-destructive text-destructive hover:bg-destructive/10'
|
||||
: 'bg-primary'
|
||||
)}
|
||||
>
|
||||
{isPlaying ? <Square className="h-4 w-4" /> : <Play className="h-4 w-4" />}
|
||||
{isManualSyncing ? (
|
||||
<>
|
||||
<XCircle className="h-4 w-4 mr-1" />
|
||||
{tTimeline('cancelSync')}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Play className="h-4 w-4 mr-1" />
|
||||
{tTimeline('tapToSync')}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
</DialogTitle>
|
||||
</div>
|
||||
</DialogHeader>
|
||||
|
||||
{isLoading ? (
|
||||
@@ -410,7 +454,7 @@ export default function EditModal({
|
||||
</p>
|
||||
</div>
|
||||
) : editedSegment ? (
|
||||
<div className="flex flex-col flex-1 space-y-4 overflow-hidden">
|
||||
<div className="flex flex-col flex-1 space-y-2 overflow-hidden">
|
||||
{timingFixCount > 0 && (
|
||||
<div
|
||||
role="status"
|
||||
@@ -429,17 +473,12 @@ export default function EditModal({
|
||||
words={editedSegment.words}
|
||||
startTime={startTime}
|
||||
endTime={endTime}
|
||||
originalStartTime={originalSegment?.start_time ?? null}
|
||||
originalEndTime={originalSegment?.end_time ?? null}
|
||||
currentStartTime={editedSegment.start_time}
|
||||
currentEndTime={editedSegment.end_time}
|
||||
currentTime={currentTime}
|
||||
isManualSyncing={isManualSyncing}
|
||||
syncWordIndex={syncWordIndex}
|
||||
isSpacebarPressed={isSpacebarPressed}
|
||||
onWordUpdate={handleWordChange}
|
||||
onPlaySegment={onPlaySegment}
|
||||
startManualSync={startManualSync}
|
||||
isGlobal={isGlobal}
|
||||
onTapStart={handleTapStart}
|
||||
onTapEnd={handleTapEnd}
|
||||
|
||||
@@ -3488,6 +3488,7 @@ export interface LyricsReviewApiClient {
|
||||
addLyrics: (source: string, lyrics: string) => Promise<CorrectionData>
|
||||
searchLyrics: (artist: string, title: string, forceSources?: string[]) => Promise<SearchLyricsResponse>
|
||||
getAudioUrl: (hash: string) => string
|
||||
getVocalsAudioUrl: () => string
|
||||
generatePreviewVideo: (data: CorrectionData, isDuet?: boolean) => Promise<{
|
||||
status: string
|
||||
message?: string
|
||||
@@ -3627,6 +3628,15 @@ export function createLyricsReviewApiClient(jobId: string): LyricsReviewApiClien
|
||||
return token ? `${base}?token=${encodeURIComponent(token)}` : base
|
||||
},
|
||||
|
||||
/**
|
||||
* Get vocals audio URL for playback
|
||||
*/
|
||||
getVocalsAudioUrl(): string {
|
||||
const token = getAccessToken()
|
||||
const base = `${API_BASE_URL}/api/review/${jobId}/audio/vocals`
|
||||
return token ? `${base}?token=${encodeURIComponent(token)}` : base
|
||||
},
|
||||
|
||||
/**
|
||||
* Generate a preview video from the current correction data
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
export interface AudioData {
|
||||
duration: number
|
||||
// Downsampled absolute-amplitude envelope: one peak per bucket. Storing the
|
||||
// envelope instead of the raw PCM keeps a whole vocal track in ~hundreds of KB
|
||||
// (peaksPerSecond * duration * 4 bytes) rather than the tens of MB a full
|
||||
// Float32Array of decoded samples would occupy, which noticeably slows the app.
|
||||
peaks: Float32Array
|
||||
peaksPerSecond: number
|
||||
}
|
||||
|
||||
// Resolution of the precomputed peak envelope. High enough to stay crisp when a
|
||||
// short segment is zoomed across the full timeline width, low enough to keep the
|
||||
// whole track tiny in memory. 400/s over a 4-minute song ≈ 96k floats (~384 KB).
|
||||
const PEAKS_PER_SECOND = 400
|
||||
|
||||
export async function fetchAudioData(url: string): Promise<AudioData> {
|
||||
// fetch() resolves even for 4xx/5xx; the vocals endpoint 404s when a job has
|
||||
// no vocal stem. Fail explicitly so the caller sees "no vocals" rather than an
|
||||
// opaque decodeAudioData error on the JSON/HTML error body.
|
||||
const response = await fetch(url)
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch vocals audio: ${response.status}`)
|
||||
}
|
||||
const arrayBuffer = await response.arrayBuffer()
|
||||
|
||||
const context = new AudioContext()
|
||||
|
||||
try {
|
||||
const decoded = await context.decodeAudioData(arrayBuffer)
|
||||
|
||||
const { duration, numberOfChannels, length } = decoded
|
||||
const bucketCount = Math.max(1, Math.ceil(duration * PEAKS_PER_SECOND))
|
||||
const samplesPerBucket = Math.max(1, Math.floor(length / bucketCount))
|
||||
const peaks = new Float32Array(bucketCount)
|
||||
|
||||
// Collapse all channels into a single envelope by taking the maximum
|
||||
// absolute sample value in each bucket. Iterate per bucket (not per sample)
|
||||
// so we avoid a division + Math.floor on every one of the ~millions of
|
||||
// samples, which would otherwise freeze the main thread while loading.
|
||||
// The raw decoded buffer is released when this function returns; only the
|
||||
// compact `peaks` array is retained.
|
||||
for (let channelIdx = 0; channelIdx < numberOfChannels; channelIdx++) {
|
||||
const channelData = decoded.getChannelData(channelIdx)
|
||||
for (let bucket = 0; bucket < bucketCount; bucket++) {
|
||||
const start = bucket * samplesPerBucket
|
||||
if (start >= length) break
|
||||
const end = bucket === bucketCount - 1 ? length : Math.min(length, start + samplesPerBucket)
|
||||
let peak = peaks[bucket]
|
||||
for (let i = start; i < end; i++) {
|
||||
const amplitude = Math.abs(channelData[i])
|
||||
if (amplitude > peak) {
|
||||
peak = amplitude
|
||||
}
|
||||
}
|
||||
peaks[bucket] = peak
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
duration,
|
||||
peaks,
|
||||
peaksPerSecond: PEAKS_PER_SECOND
|
||||
}
|
||||
} finally {
|
||||
context.close()
|
||||
}
|
||||
}
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "إعادة التنفيذ",
|
||||
"revertAllAuto": "التراجع عن الكل",
|
||||
"showDetails": "عرض التفاصيل"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "جاري الضغط... أفلت عندما تنتهي الكلمة",
|
||||
"pressSpacebarHint": "اضغط على زر المسافة عندما تبدأ الكلمة (انقر للكلمات القصيرة، واستمر بالضغط للكلمات الطويلة)",
|
||||
"tapToSync": "انقر للمزامنة",
|
||||
"tapWhenStarts": "انقر على الزر عندما تبدأ الكلمة",
|
||||
"wordProgress": "الكلمة {index} من {total}:",
|
||||
"cancelSync": "إلغاء",
|
||||
"hold": "اضغط مطولاً...",
|
||||
"tap": "انقر"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Torna a executar",
|
||||
"revertAllAuto": "Reverteix-ho tot",
|
||||
"showDetails": "Mostra els detalls"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Mantenint premut... Deixa anar quan acabi la paraula",
|
||||
"pressSpacebarHint": "Prem la barra espaiadora quan comenci la paraula (toca per a paraules curtes, mantén premut per a paraules llargues)",
|
||||
"tapToSync": "Toca per sincronitzar",
|
||||
"tapWhenStarts": "Toca el botó quan comenci la paraula",
|
||||
"wordProgress": "Paraula {index} de {total}:",
|
||||
"cancelSync": "Cancel·la",
|
||||
"hold": "MANTÉN...",
|
||||
"tap": "TOCA"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Spustit znovu",
|
||||
"revertAllAuto": "Vrátit vše",
|
||||
"showDetails": "Zobrazit podrobnosti"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Držíš... Pusť, když slovo skončí",
|
||||
"pressSpacebarHint": "Stiskni mezerník, když slovo začne (ťukni pro krátká slova, podrž pro dlouhá slova)",
|
||||
"tapToSync": "Ťukni pro synchronizaci",
|
||||
"tapWhenStarts": "Ťukni na tlačítko, když slovo začne",
|
||||
"wordProgress": "Slovo {index} z {total}:",
|
||||
"cancelSync": "Zrušit",
|
||||
"hold": "DRŽ...",
|
||||
"tap": "KLEPNI"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Kør igen",
|
||||
"revertAllAuto": "Fortryd alle",
|
||||
"showDetails": "Vis detaljer"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Holder nede... Slip, når ordet slutter",
|
||||
"pressSpacebarHint": "Tryk på mellemrumstasten, når ordet starter (tryk for korte ord, hold nede for lange ord)",
|
||||
"tapToSync": "Tryk for at synkronisere",
|
||||
"tapWhenStarts": "Tryk på knappen, når ordet starter",
|
||||
"wordProgress": "Ord {index} af {total}:",
|
||||
"cancelSync": "Annuller",
|
||||
"hold": "HOLD...",
|
||||
"tap": "TRYK"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Erneut ausführen",
|
||||
"revertAllAuto": "Alle rückgängig machen",
|
||||
"showDetails": "Details anzeigen"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Gedrückt halten... Loslassen, wenn das Wort endet",
|
||||
"pressSpacebarHint": "Drücke die Leertaste, wenn das Wort beginnt (tippen für kurze Wörter, gedrückt halten für lange Wörter)",
|
||||
"tapToSync": "Tippen zum Synchronisieren",
|
||||
"tapWhenStarts": "Tippe auf den Button, wenn das Wort beginnt",
|
||||
"wordProgress": "Wort {index} von {total}:",
|
||||
"cancelSync": "Abbrechen",
|
||||
"hold": "HALTEN...",
|
||||
"tap": "TIPPEN"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Επανεκτέλεση",
|
||||
"revertAllAuto": "Αναίρεση όλων",
|
||||
"showDetails": "Εμφάνιση λεπτομερειών"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Κρατάς πατημένο... Άφησέ το όταν τελειώσει η λέξη",
|
||||
"pressSpacebarHint": "Πάτησε το spacebar όταν ξεκινάει η λέξη (πάτησε στιγμιαία για μικρές λέξεις, κράτα πατημένο για μεγάλες λέξεις)",
|
||||
"tapToSync": "Πάτησε για συγχρονισμό",
|
||||
"tapWhenStarts": "Πάτησε το κουμπί όταν ξεκινάει η λέξη",
|
||||
"wordProgress": "Λέξη {index} από {total}:",
|
||||
"cancelSync": "Ακύρωση",
|
||||
"hold": "ΚΡΑΤΑ...",
|
||||
"tap": "ΠΑΤΑ"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1337,6 +1337,16 @@
|
||||
},
|
||||
"upcomingMore": "+{count} more"
|
||||
},
|
||||
"editTimeline": {
|
||||
"tapToSync": "Tap To Sync",
|
||||
"cancelSync": "Cancel",
|
||||
"wordProgress": "Word {index} of {total}:",
|
||||
"holdingRelease": "Holding... Release when word ends",
|
||||
"tapWhenStarts": "Tap the button when word starts",
|
||||
"pressSpacebarHint": "Press spacebar when word starts (tap for short words, hold for long words)",
|
||||
"tap": "TAP",
|
||||
"hold": "HOLD..."
|
||||
},
|
||||
"duet": {
|
||||
"markAsDuet": "Duet Mode",
|
||||
"duetOn": "Duet: ON",
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Volver a ejecutar",
|
||||
"revertAllAuto": "Revertir todo",
|
||||
"showDetails": "Mostrar detalles"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Manteniendo presionado... Suelta cuando termine la palabra",
|
||||
"pressSpacebarHint": "Presiona la barra espaciadora cuando empiece la palabra (toca para palabras cortas, mantén presionado para palabras largas)",
|
||||
"tapToSync": "Toca para sincronizar",
|
||||
"tapWhenStarts": "Toca el botón cuando empiece la palabra",
|
||||
"wordProgress": "Palabra {index} de {total}:",
|
||||
"cancelSync": "Cancelar",
|
||||
"hold": "MANTÉN...",
|
||||
"tap": "TOCA"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Suorita uudelleen",
|
||||
"revertAllAuto": "Kumoa kaikki",
|
||||
"showDetails": "Näytä tiedot"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Pidä painettuna... Vapauta, kun sana päättyy",
|
||||
"pressSpacebarHint": "Paina välilyöntiä, kun sana alkaa (napauta lyhyiden sanojen kohdalla, pidä painettuna pitkien kohdalla)",
|
||||
"tapToSync": "Napauta synkronoidaksesi",
|
||||
"tapWhenStarts": "Napauta painiketta, kun sana alkaa",
|
||||
"wordProgress": "Sana {index}/{total}:",
|
||||
"cancelSync": "Peruuta",
|
||||
"hold": "PIDÄ...",
|
||||
"tap": "NAPAUTA"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Relancer",
|
||||
"revertAllAuto": "Tout rétablir",
|
||||
"showDetails": "Afficher les détails"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Maintiens... Relâche quand le mot se termine",
|
||||
"pressSpacebarHint": "Appuie sur la barre d'espace quand le mot commence (appuie brièvement pour les mots courts, maintiens pour les mots longs)",
|
||||
"tapToSync": "Appuie pour synchroniser",
|
||||
"tapWhenStarts": "Appuie sur le bouton quand le mot commence",
|
||||
"wordProgress": "Mot {index} sur {total} :",
|
||||
"cancelSync": "Annuler",
|
||||
"hold": "MAINTIENS...",
|
||||
"tap": "APPUIE"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "הפעל מחדש",
|
||||
"revertAllAuto": "בטל הכל",
|
||||
"showDetails": "הצג פרטים"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "לחוץ... שחרר כשהמילה מסתיימת",
|
||||
"pressSpacebarHint": "לחץ על מקש הרווח כשהמילה מתחילה (הקש למילים קצרות, החזק למילים ארוכות)",
|
||||
"tapToSync": "הקש לסנכרון",
|
||||
"tapWhenStarts": "הקש על הכפתור כשהמילה מתחילה",
|
||||
"wordProgress": "מילה {index} מתוך {total}:",
|
||||
"cancelSync": "ביטול",
|
||||
"hold": "החזק...",
|
||||
"tap": "הקש"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "फिर से चलाओ",
|
||||
"revertAllAuto": "सब पहले जैसा करो",
|
||||
"showDetails": "विवरण दिखाओ"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "दबाए हुए... शब्द खत्म होने पर छोड़ दो",
|
||||
"pressSpacebarHint": "शब्द शुरू होने पर स्पेसबार दबाओ (छोटे शब्दों के लिए टैप करो, लंबे शब्दों के लिए दबाए रखो)",
|
||||
"tapToSync": "सिंक करने के लिए टैप करो",
|
||||
"tapWhenStarts": "शब्द शुरू होने पर बटन टैप करो",
|
||||
"wordProgress": "{total} में से {index} शब्द:",
|
||||
"cancelSync": "कैंसल",
|
||||
"hold": "दबाए रखो...",
|
||||
"tap": "टैप करो"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Pokreni ponovno",
|
||||
"revertAllAuto": "Poništi sve",
|
||||
"showDetails": "Prikaži detalje"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Drži... Otpusti kada riječ završi",
|
||||
"pressSpacebarHint": "Pritisni razmaknicu kada riječ počne (dodirni za kratke riječi, drži za duge riječi)",
|
||||
"tapToSync": "Dodirni za sinkronizaciju",
|
||||
"tapWhenStarts": "Dodirni gumb kada riječ počne",
|
||||
"wordProgress": "Riječ {index} od {total}:",
|
||||
"cancelSync": "Odustani",
|
||||
"hold": "DRŽI...",
|
||||
"tap": "TAPNI"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Újrafuttatás",
|
||||
"revertAllAuto": "Összes visszavonása",
|
||||
"showDetails": "Részletek megjelenítése"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Nyomva tartva... Engedd fel, amikor a szó véget ér",
|
||||
"pressSpacebarHint": "Nyomd meg a szóköz billentyűt, amikor a szó elkezdődik (rövid szavaknál röviden nyomd meg, hosszú szavaknál tartsd nyomva)",
|
||||
"tapToSync": "Koppints a szinkronizáláshoz",
|
||||
"tapWhenStarts": "Koppints a gombra, amikor a szó elkezdődik",
|
||||
"wordProgress": "{index}. szó a(z) {total} közül:",
|
||||
"cancelSync": "Mégse",
|
||||
"hold": "TARTSD...",
|
||||
"tap": "KOPPINTS"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Jalankan ulang",
|
||||
"revertAllAuto": "Kembalikan semua",
|
||||
"showDetails": "Tampilkan detail"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Menahan... Lepaskan saat kata selesai",
|
||||
"pressSpacebarHint": "Tekan spasi saat kata dimulai (ketuk untuk kata pendek, tahan untuk kata panjang)",
|
||||
"tapToSync": "Ketuk Untuk Sinkronisasi",
|
||||
"tapWhenStarts": "Ketuk tombol saat kata dimulai",
|
||||
"wordProgress": "Kata {index} dari {total}:",
|
||||
"cancelSync": "Batal",
|
||||
"hold": "TAHAN...",
|
||||
"tap": "KETUK"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Riesegui",
|
||||
"revertAllAuto": "Ripristina tutto",
|
||||
"showDetails": "Mostra dettagli"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Stai premendo... Rilascia quando la parola finisce",
|
||||
"pressSpacebarHint": "Premi la barra spaziatrice quando inizia la parola (premi brevemente per le parole brevi, tieni premuto per quelle lunghe)",
|
||||
"tapToSync": "Tocca per sincronizzare",
|
||||
"tapWhenStarts": "Tocca il pulsante quando inizia la parola",
|
||||
"wordProgress": "Parola {index} di {total}:",
|
||||
"cancelSync": "Annulla",
|
||||
"hold": "TIENI PREMUTO...",
|
||||
"tap": "TOCCA"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "再実行",
|
||||
"revertAllAuto": "すべて元に戻す",
|
||||
"showDetails": "詳細を表示"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "長押し中... 単語が終わったら離してください",
|
||||
"pressSpacebarHint": "単語が始まったらスペースキーを押してください(短い単語はタップ、長い単語は長押し)",
|
||||
"tapToSync": "タップして同期",
|
||||
"tapWhenStarts": "単語が始まったらボタンをタップしてください",
|
||||
"wordProgress": "単語 {index} / {total}:",
|
||||
"cancelSync": "キャンセル",
|
||||
"hold": "長押し...",
|
||||
"tap": "タップ"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "다시 실행",
|
||||
"revertAllAuto": "모두 되돌리기",
|
||||
"showDetails": "세부 정보 보기"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "누르는 중... 단어가 끝나면 떼세요",
|
||||
"pressSpacebarHint": "단어가 시작될 때 스페이스바를 누르세요 (짧은 단어는 짧게, 긴 단어는 길게 누르세요)",
|
||||
"tapToSync": "탭하여 동기화",
|
||||
"tapWhenStarts": "단어가 시작될 때 버튼을 탭하세요",
|
||||
"wordProgress": "단어 {index} / {total}:",
|
||||
"cancelSync": "취소",
|
||||
"hold": "길게 누르기...",
|
||||
"tap": "탭"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Jalankan semula",
|
||||
"revertAllAuto": "Kembalikan semua",
|
||||
"showDetails": "Papar butiran"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Sedang ditahan... Lepaskan apabila perkataan tamat",
|
||||
"pressSpacebarHint": "Tekan bar ruang apabila perkataan bermula (ketik untuk perkataan pendek, tahan untuk perkataan panjang)",
|
||||
"tapToSync": "Ketik Untuk Segerakkan",
|
||||
"tapWhenStarts": "Ketik butang apabila perkataan bermula",
|
||||
"wordProgress": "Perkataan {index} daripada {total}:",
|
||||
"cancelSync": "Batal",
|
||||
"hold": "TAHAN...",
|
||||
"tap": "TEKAN"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Kjør på nytt",
|
||||
"revertAllAuto": "Tilbakestill alle",
|
||||
"showDetails": "Vis detaljer"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Holder inne... Slipp når ordet slutter",
|
||||
"pressSpacebarHint": "Trykk på mellomromstasten når ordet starter (trykk kort for korte ord, hold inne for lange ord)",
|
||||
"tapToSync": "Trykk for å synkronisere",
|
||||
"tapWhenStarts": "Trykk på knappen når ordet starter",
|
||||
"wordProgress": "Ord {index} av {total}:",
|
||||
"cancelSync": "Avbryt",
|
||||
"hold": "HOLD...",
|
||||
"tap": "TRYKK"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Opnieuw uitvoeren",
|
||||
"revertAllAuto": "Alles ongedaan maken",
|
||||
"showDetails": "Details tonen"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Vasthouden... Laat los wanneer het woord eindigt",
|
||||
"pressSpacebarHint": "Druk op de spatiebalk wanneer het woord begint (tik voor korte woorden, houd ingedrukt voor lange woorden)",
|
||||
"tapToSync": "Tik om te synchroniseren",
|
||||
"tapWhenStarts": "Tik op de knop wanneer het woord begint",
|
||||
"wordProgress": "Woord {index} van {total}:",
|
||||
"cancelSync": "Annuleren",
|
||||
"hold": "HOUD VAST...",
|
||||
"tap": "TIK"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Uruchom ponownie",
|
||||
"revertAllAuto": "Cofnij wszystko",
|
||||
"showDetails": "Pokaż szczegóły"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Przytrzymujesz... Puść, gdy słowo się skończy",
|
||||
"pressSpacebarHint": "Naciśnij spację, gdy zaczyna się słowo (naciśnij krótko przy krótkich słowach, przytrzymaj przy długich)",
|
||||
"tapToSync": "Stuknij, aby zsynchronizować",
|
||||
"tapWhenStarts": "Stuknij przycisk, gdy zaczyna się słowo",
|
||||
"wordProgress": "Słowo {index} z {total}:",
|
||||
"cancelSync": "Anuluj",
|
||||
"hold": "PRZYTRZYMAJ...",
|
||||
"tap": "STUKNIJ"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Executar novamente",
|
||||
"revertAllAuto": "Reverter tudo",
|
||||
"showDetails": "Mostrar detalhes"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Segurando... Solte quando a palavra terminar",
|
||||
"pressSpacebarHint": "Pressione a barra de espaço quando a palavra começar (toque para palavras curtas, segure para palavras longas)",
|
||||
"tapToSync": "Toque para sincronizar",
|
||||
"tapWhenStarts": "Toque no botão quando a palavra começar",
|
||||
"wordProgress": "Palavra {index} de {total}:",
|
||||
"cancelSync": "Cancelar",
|
||||
"hold": "SEGURE...",
|
||||
"tap": "TOQUE"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Rulează din nou",
|
||||
"revertAllAuto": "Anulează tot",
|
||||
"showDetails": "Arată detaliile"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Ții apăsat... Eliberează când se termină cuvântul",
|
||||
"pressSpacebarHint": "Apasă tasta Space când începe cuvântul (apasă scurt pentru cuvinte scurte, ține apăsat pentru cuvinte lungi)",
|
||||
"tapToSync": "Apasă pentru a sincroniza",
|
||||
"tapWhenStarts": "Apasă butonul când începe cuvântul",
|
||||
"wordProgress": "Cuvântul {index} din {total}:",
|
||||
"cancelSync": "Anulează",
|
||||
"hold": "ȚINE...",
|
||||
"tap": "APASĂ"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Перезапустить",
|
||||
"revertAllAuto": "Отменить все",
|
||||
"showDetails": "Показать подробности"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Удерживай... Отпусти, когда слово закончится",
|
||||
"pressSpacebarHint": "Нажми пробел, когда начнется слово (нажми коротко для коротких слов, удерживай для длинных)",
|
||||
"tapToSync": "Нажми для синхронизации",
|
||||
"tapWhenStarts": "Нажми кнопку, когда начнется слово",
|
||||
"wordProgress": "Слово {index} из {total}:",
|
||||
"cancelSync": "Отмена",
|
||||
"hold": "УДЕРЖИВАЙ...",
|
||||
"tap": "НАЖМИ"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Spustiť znova",
|
||||
"revertAllAuto": "Vrátiť všetko",
|
||||
"showDetails": "Zobraziť podrobnosti"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Držíš... Uvoľni, keď sa slovo skončí",
|
||||
"pressSpacebarHint": "Stlač medzerník, keď sa slovo začne (ťukni pre krátke slová, podrž pre dlhé slová)",
|
||||
"tapToSync": "Ťukni pre synchronizáciu",
|
||||
"tapWhenStarts": "Ťukni na tlačidlo, keď sa slovo začne",
|
||||
"wordProgress": "Slovo {index} z {total}:",
|
||||
"cancelSync": "Zrušiť",
|
||||
"hold": "DRŽ...",
|
||||
"tap": "ŤUKNI"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Kör igen",
|
||||
"revertAllAuto": "Återställ alla",
|
||||
"showDetails": "Visa detaljer"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Håller in... Släpp när ordet slutar",
|
||||
"pressSpacebarHint": "Tryck på mellanslag när ordet börjar (tryck snabbt för korta ord, håll in för långa ord)",
|
||||
"tapToSync": "Tryck för att synka",
|
||||
"tapWhenStarts": "Tryck på knappen när ordet börjar",
|
||||
"wordProgress": "Ord {index} av {total}:",
|
||||
"cancelSync": "Avbryt",
|
||||
"hold": "HÅLL IN...",
|
||||
"tap": "TRYCK"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "รันอีกครั้ง",
|
||||
"revertAllAuto": "คืนค่าทั้งหมด",
|
||||
"showDetails": "แสดงรายละเอียด"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "กำลังกดค้าง... ปล่อยเมื่อจบคำ",
|
||||
"pressSpacebarHint": "กดสเปซบาร์เมื่อเริ่มคำ (แตะสำหรับคำสั้นๆ กดค้างสำหรับคำยาวๆ)",
|
||||
"tapToSync": "แตะเพื่อซิงค์",
|
||||
"tapWhenStarts": "แตะปุ่มเมื่อเริ่มคำ",
|
||||
"wordProgress": "คำที่ {index} จาก {total}:",
|
||||
"cancelSync": "ยกเลิก",
|
||||
"hold": "กดค้าง...",
|
||||
"tap": "แตะ"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Patakbuhin muli",
|
||||
"revertAllAuto": "Ibalik lahat",
|
||||
"showDetails": "Ipakita ang mga detalye"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Naka-hold... Bitawan kapag tapos na ang salita",
|
||||
"pressSpacebarHint": "Pindutin ang spacebar kapag nagsimula ang salita (i-tap para sa maiikling salita, i-hold para sa mahahabang salita)",
|
||||
"tapToSync": "I-tap Para I-sync",
|
||||
"tapWhenStarts": "I-tap ang button kapag nagsimula ang salita",
|
||||
"wordProgress": "Salita {index} ng {total}:",
|
||||
"cancelSync": "Kanselahin",
|
||||
"hold": "I-HOLD...",
|
||||
"tap": "I-TAP"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Yeniden çalıştır",
|
||||
"revertAllAuto": "Tümünü geri al",
|
||||
"showDetails": "Detayları göster"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Basılı tutuluyor... Kelime bittiğinde bırak",
|
||||
"pressSpacebarHint": "Kelime başladığında boşluk tuşuna bas (kısa kelimeler için dokun, uzun kelimeler için basılı tut)",
|
||||
"tapToSync": "Senkronize Etmek İçin Dokun",
|
||||
"tapWhenStarts": "Kelime başladığında düğmeye dokun",
|
||||
"wordProgress": "Kelime {index} / {total}:",
|
||||
"cancelSync": "İptal",
|
||||
"hold": "BASILI TUT...",
|
||||
"tap": "DOKUN"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Перезапустити",
|
||||
"revertAllAuto": "Скасувати все",
|
||||
"showDetails": "Показати деталі"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Тримай... Відпусти, коли слово закінчиться",
|
||||
"pressSpacebarHint": "Натисни пробіл, коли починається слово (натисни для коротких слів, утримуй для довгих)",
|
||||
"tapToSync": "Натисни для синхронізації",
|
||||
"tapWhenStarts": "Натисни кнопку, коли починається слово",
|
||||
"wordProgress": "Слово {index} з {total}:",
|
||||
"cancelSync": "Скасувати",
|
||||
"hold": "УТРИМУЙ...",
|
||||
"tap": "НАТИСНИ"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "Chạy lại",
|
||||
"revertAllAuto": "Hoàn tác tất cả",
|
||||
"showDetails": "Hiện chi tiết"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "Đang giữ... Thả ra khi từ kết thúc",
|
||||
"pressSpacebarHint": "Nhấn phím cách khi từ bắt đầu (nhấn thả cho từ ngắn, nhấn giữ cho từ dài)",
|
||||
"tapToSync": "Nhấn để đồng bộ",
|
||||
"tapWhenStarts": "Nhấn nút khi từ bắt đầu",
|
||||
"wordProgress": "Từ {index} trên {total}:",
|
||||
"cancelSync": "Hủy",
|
||||
"hold": "GIỮ...",
|
||||
"tap": "CHẠM"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -1389,6 +1389,16 @@
|
||||
"rerun": "重新运行",
|
||||
"revertAllAuto": "全部还原",
|
||||
"showDetails": "显示详情"
|
||||
},
|
||||
"editTimeline": {
|
||||
"holdingRelease": "按住... 在字词结束时松开",
|
||||
"pressSpacebarHint": "在字词开始时按空格键(短词轻按,长词按住)",
|
||||
"tapToSync": "点击同步",
|
||||
"tapWhenStarts": "在字词开始时点击按钮",
|
||||
"wordProgress": "第 {index} 个词,共 {total} 个:",
|
||||
"cancelSync": "取消",
|
||||
"hold": "按住...",
|
||||
"tap": "点击"
|
||||
}
|
||||
},
|
||||
"instrumentalReview": {
|
||||
|
||||
@@ -73,6 +73,11 @@ class ReviewServer:
|
||||
output_config: OutputConfig,
|
||||
audio_filepath: str,
|
||||
logger: logging.Logger,
|
||||
# Optional vocals stem powering the timeline waveform. May be absent when a
|
||||
# separation produced no vocals stem; the vocals endpoint 404s and the
|
||||
# frontend hides the waveform. Keyword-only in practice (callers pass it by
|
||||
# name), so relocating it here from before `logger` is safe.
|
||||
vocals_filepath: Optional[str] = None,
|
||||
# Instrumental review data (optional - for combined review flow)
|
||||
instrumental_options: Optional[List[Dict[str, Any]]] = None,
|
||||
backing_vocals_analysis: Optional[Dict[str, Any]] = None,
|
||||
@@ -85,7 +90,8 @@ class ReviewServer:
|
||||
Args:
|
||||
correction_result: The lyrics correction result to review
|
||||
output_config: Output configuration
|
||||
audio_filepath: Path to the main audio file (vocals)
|
||||
audio_filepath: Path to the main audio file
|
||||
vocals_filepath: Path the vocals (lead & backing) audio file
|
||||
logger: Logger instance
|
||||
instrumental_options: List of instrumental options for selection
|
||||
Each option: {"id": str, "label": str, "audio_path": str}
|
||||
@@ -97,6 +103,7 @@ class ReviewServer:
|
||||
self.correction_result = correction_result
|
||||
self.output_config = output_config
|
||||
self.audio_filepath = audio_filepath
|
||||
self.vocals_filepath = vocals_filepath
|
||||
self.logger = logger or logging.getLogger(__name__)
|
||||
self.review_completed = False
|
||||
self.corrections_saved = False # Flag for intermediate save (before instrumental review)
|
||||
@@ -416,6 +423,8 @@ class ReviewServer:
|
||||
async def get_audio_with_job_id(job_id: str, audio_hash: str):
|
||||
if audio_hash in _stem_names:
|
||||
return await self.get_instrumental_audio(audio_hash)
|
||||
elif audio_hash == "vocals":
|
||||
return await self.get_vocals_audio()
|
||||
return await self.get_audio(audio_hash)
|
||||
self.app.add_api_route("/api/review/{job_id}/audio/{audio_hash}", get_audio_with_job_id, methods=["GET"])
|
||||
|
||||
@@ -1072,6 +1081,25 @@ class ReviewServer:
|
||||
|
||||
return FileResponse(audio_path, media_type=content_type, filename=os.path.basename(audio_path))
|
||||
|
||||
async def get_vocals_audio(self):
|
||||
"""Stream the vocals audio file."""
|
||||
|
||||
audio_path = self.vocals_filepath
|
||||
if not audio_path or not os.path.exists(audio_path):
|
||||
raise HTTPException(status_code=404, detail="Vocals audio not found")
|
||||
|
||||
# Determine content type based on file extension
|
||||
ext = os.path.splitext(audio_path)[1].lower()
|
||||
content_types = {
|
||||
".flac": "audio/flac",
|
||||
".mp3": "audio/mpeg",
|
||||
".wav": "audio/wav",
|
||||
".m4a": "audio/mp4",
|
||||
}
|
||||
content_type = content_types.get(ext, "application/octet-stream")
|
||||
|
||||
return FileResponse(audio_path, media_type=content_type, filename=os.path.basename(audio_path))
|
||||
|
||||
async def generate_preview_video(self, updated_data: Dict[str, Any] = Body(...)):
|
||||
"""Generate a preview video with the current corrections."""
|
||||
# Check if preview video generation is allowed (disabled with --no-video)
|
||||
|
||||
@@ -213,11 +213,20 @@ def run_combined_review(
|
||||
backing_vocals_path = None
|
||||
|
||||
clean_instrumental_path = None
|
||||
vocals_path = None
|
||||
clean_result = separated.get("clean_instrumental", {})
|
||||
if isinstance(clean_result, dict) and clean_result.get("instrumental"):
|
||||
clean_instrumental_path = _resolve_path_for_cwd(clean_result["instrumental"], track_dir)
|
||||
if not os.path.exists(clean_instrumental_path):
|
||||
clean_instrumental_path = None
|
||||
if isinstance(clean_result, dict):
|
||||
if clean_result.get("instrumental"):
|
||||
clean_instrumental_path = _resolve_path_for_cwd(clean_result["instrumental"], track_dir)
|
||||
if not os.path.exists(clean_instrumental_path):
|
||||
clean_instrumental_path = None
|
||||
# Vocals stem drives the (optional) timeline waveform. A partial separation
|
||||
# may have an instrumental but no "vocals" key — use .get() and never crash
|
||||
# the review over a missing waveform; the frontend tolerates its absence.
|
||||
vocals_source = clean_result.get("vocals")
|
||||
if vocals_source:
|
||||
candidate = _resolve_path_for_cwd(vocals_source, track_dir)
|
||||
vocals_path = candidate if os.path.exists(candidate) else None
|
||||
|
||||
with_backing_path = None
|
||||
combined_result = separated.get("combined_instrumentals", {})
|
||||
@@ -303,6 +312,7 @@ def run_combined_review(
|
||||
correction_result=correction_result,
|
||||
output_config=output_config,
|
||||
audio_filepath=resolved_audio or "",
|
||||
vocals_filepath=vocals_path,
|
||||
logger=logger,
|
||||
# Instrumental review data
|
||||
instrumental_options=instrumental_options,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "karaoke-gen"
|
||||
version = "0.197.0"
|
||||
version = "0.197.1"
|
||||
description = "Generate karaoke videos with synchronized lyrics. Handles the entire process from downloading audio and lyrics to creating the final video with title screens."
|
||||
authors = ["Andrew Beveridge <andrew@beveridge.uk>"]
|
||||
license = "MIT"
|
||||
|
||||
Reference in new issue
Block a user