diff --git a/backend/job_manager.py b/backend/job_manager.py
index 38045ca..69cd0d6 100755
--- a/backend/job_manager.py
+++ b/backend/job_manager.py
@@ -95,13 +95,24 @@ _flags_lock = threading.Lock()
# ---------------------------------------------------------------------------
# Thread pools
# Two executors:
-# _general_executor — multi-worker for CPU-bound tasks (e.g. ABC conversion)
-# _gpu_executor — single-worker for GPU-exclusive tasks (PyTorch + TF)
-# serialises Demucs/BS-RoFormer and Omnizart so they
-# never compete for VRAM; FIFO by submission order.
+# _general_executor — multi-worker for CPU-bound tasks (e.g. ABC conversion)
+# _gpu_executor — single-worker for GPU-exclusive tasks (PyTorch + TF)
+# serialises Demucs/BS-RoFormer and Omnizart so they
+# never compete for VRAM; FIFO by submission order.
+# _transcription_executor — single-worker queue ONLY for lyric transcription and
+# LRC alignment. Kept separate from _gpu_executor so
+# stem separation can run without blocking, but still
+# prevents two transcription/alignment jobs from
+# competing for VRAM. Jobs are submitted here instead
+# of _gpu_executor for these job types.
# ---------------------------------------------------------------------------
-_general_executor = ThreadPoolExecutor(max_workers=4)
-_gpu_executor = ThreadPoolExecutor(max_workers=1)
+_general_executor = ThreadPoolExecutor(max_workers=4)
+_gpu_executor = ThreadPoolExecutor(max_workers=1)
+_transcription_executor = ThreadPoolExecutor(max_workers=1)
+
+# Queue-depth counter for the transcription executor (includes the running job).
+_tx_queue_lock = threading.Lock()
+_tx_queue_depth = 0
# ---------------------------------------------------------------------------
@@ -207,14 +218,44 @@ def submit(fn: Callable, *args, **kwargs):
def submit_gpu(fn: Callable, *args, **kwargs):
"""Submit a GPU-exclusive background task (single-worker FIFO queue).
- Use for any job that loads PyTorch or TensorFlow models onto the GPU:
- stem separation (Demucs / BS-RoFormer), MIDI transcription (Omnizart),
- lyrics alignment (wav2vec2 + Demucs vocal extraction). Tasks run
- strictly one-at-a-time in the order they were submitted.
+ Use for stem separation (Demucs / BS-RoFormer) and MIDI transcription.
+ Tasks run strictly one-at-a-time in the order they were submitted.
"""
_gpu_executor.submit(fn, *args, **kwargs)
+def submit_transcription(job_id: str, fn: Callable, *args, **kwargs):
+ """Submit a lyric transcription or LRC alignment job.
+
+ Uses a dedicated single-worker executor so transcription jobs are
+ serialised independently of stem separation, preventing VRAM contention.
+ Shows queue position in the job's progress field while waiting.
+ """
+ global _tx_queue_depth
+
+ with _tx_queue_lock:
+ _tx_queue_depth += 1
+ position = _tx_queue_depth
+
+ if position > 1:
+ update_job(job_id, progress=f"Queued (position {position} of {position})…")
+
+ def _wrapper():
+ global _tx_queue_depth
+ # Recalculate position at start time (earlier jobs may have finished).
+ with _tx_queue_lock:
+ pos = _tx_queue_depth
+ if pos > 1:
+ update_job(job_id, progress=f"Queued — waiting for {pos - 1} job(s) to finish…")
+ try:
+ fn(*args, **kwargs)
+ finally:
+ with _tx_queue_lock:
+ _tx_queue_depth -= 1
+
+ _transcription_executor.submit(_wrapper)
+
+
def _record_to_dict(record: JobRecord) -> dict:
return {
"id": record.id,
diff --git a/backend/logging.yaml b/backend/logging.yaml
new file mode 100644
index 0000000..18debbb
--- /dev/null
+++ b/backend/logging.yaml
@@ -0,0 +1,41 @@
+# StemEngine Python logging configuration.
+# Edit `root.level` to control verbosity:
+# DEBUG — full trace: job steps, model loads, GPU memory events, alignment details
+# INFO — normal operational messages
+# WARNING — warnings and errors only (quiet production mode)
+#
+# Individual loggers can be overridden in the `loggers` section below.
+
+version: 1
+disable_existing_loggers: false
+
+formatters:
+ standard:
+ format: "%(asctime)s %(levelname)-8s %(name)s — %(message)s"
+ datefmt: "%H:%M:%S"
+
+handlers:
+ console:
+ class: logging.StreamHandler
+ formatter: standard
+ stream: ext://sys.stdout
+
+root:
+ level: WARNING
+ handlers: [console]
+
+loggers:
+ # ── StemEngine application loggers ──────────────────────────────────────────
+ backend:
+ level: WARNING # change to DEBUG to see all app-level debug output
+ propagate: true
+
+ # ── Third-party: kept at WARNING to avoid noise ───────────────────────────
+ httpx: { level: WARNING, propagate: true }
+ httpcore: { level: WARNING, propagate: true }
+ urllib3: { level: WARNING, propagate: true }
+ multipart: { level: WARNING, propagate: true }
+ watchfiles: { level: WARNING, propagate: true }
+ asyncio: { level: WARNING, propagate: true }
+ h11: { level: WARNING, propagate: true }
+ uvicorn.access: { level: WARNING, propagate: true }
diff --git a/backend/main.py b/backend/main.py
index fc326bf..8a7396e 100755
--- a/backend/main.py
+++ b/backend/main.py
@@ -2,9 +2,19 @@
StemEngine — FastAPI application entry point.
Mounts all API routers and serves the built React frontend as static files.
"""
+import logging
+import logging.config
from pathlib import Path
from fastapi import FastAPI
+
+# Load logging config from the discrete YAML file next to this package.
+# Edit backend/logging.yaml to change log levels without touching code.
+_log_cfg = Path(__file__).parent / "logging.yaml"
+if _log_cfg.exists():
+ import yaml
+ with open(_log_cfg) as _f:
+ logging.config.dictConfig(yaml.safe_load(_f))
from fastapi.middleware.cors import CORSMiddleware
from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
diff --git a/backend/requirements.txt b/backend/requirements.txt
index b295bd1..e29554a 100755
--- a/backend/requirements.txt
+++ b/backend/requirements.txt
@@ -51,9 +51,10 @@ cryptography>=42.0
# MIDI transcription via basic-pitch
# Installed separately in Dockerfile with --no-deps to avoid TF/numpy conflict.
# Runtime inference uses onnxruntime (above) instead of TensorFlow.
-# pretty_midi is basic-pitch's MIDI output library; must be installed separately
-# since it's normally pulled in as a dep of basic-pitch.
+# pretty_midi and mir_eval are basic-pitch deps that must be installed separately
+# since --no-deps skips them along with tensorflow.
pretty_midi>=0.2.10
+mir_eval>=0.7
# Syllable hyphenation (pure-Python, for per-syllable ELRC timing)
pyphen>=0.14.0
diff --git a/backend/routers/projects.py b/backend/routers/projects.py
index 8929624..a3fea58 100755
--- a/backend/routers/projects.py
+++ b/backend/routers/projects.py
@@ -78,6 +78,7 @@ class LyricTranscribeRequest(BaseModel):
diarize: bool = False # run speaker diarization (WhisperX only)
lrc_power_preset: str = "standard" # 'eco' | 'standard' | 'performance'
phoneme_align: bool = False # use phonemizer + phoneme model for syllable-level timestamps
+ two_pass: bool = False # run a second VAD pass to fill gaps > 2 s
lyrics_source: str = "transcribe" # 'transcribe' | 'auto' | 'tag' | 'file' — when not 'transcribe',
# skip Whisper and force-align existing lyrics instead
existing_lyrics: Optional[str] = None # lyrics text (plain or LRC) to align; overrides lyrics_source
@@ -407,7 +408,8 @@ def lrc_project(project_id: str, body: LrcRequest):
job_id = jm.create_job("lrc_align")
set_project_lrc_job(project_id, body.stem_name, job_id)
- jm.submit_gpu(
+ jm.submit_transcription(
+ job_id,
run_lrc_alignment,
job_id,
audio_path,
@@ -481,7 +483,8 @@ def lyric_transcribe_project(project_id: str, body: LyricTranscribeRequest):
# frontend always shows the most-recent AI transcription for that stem.
set_project_lrc_job(project_id, f"{body.stem_name}_whisper", job_id)
- jm.submit_gpu(
+ jm.submit_transcription(
+ job_id,
run_lyric_transcription,
job_id,
stem_path,
@@ -497,6 +500,7 @@ def lyric_transcribe_project(project_id: str, body: LyricTranscribeRequest):
diarize=body.diarize,
power_preset=body.lrc_power_preset,
phoneme_align=body.phoneme_align,
+ two_pass=body.two_pass,
existing_lyrics=resolved_lyrics,
)
return {"job_id": job_id, "output_dir": str(output_dir)}
diff --git a/backend/services/abc_generator.py b/backend/services/abc_generator.py
index da7fc63..2484b8b 100755
--- a/backend/services/abc_generator.py
+++ b/backend/services/abc_generator.py
@@ -1,8 +1,12 @@
-from music21 import environment, converter, metadata, stream
-from pathlib import Path
-import subprocess
-import os
+import logging
import traceback
+import os
+import subprocess
+from pathlib import Path
+
+from music21 import environment, converter, metadata, stream
+
+log = logging.getLogger(__name__)
def _post_process_abc_content(abc_text: str, title: str) -> str:
@@ -47,7 +51,7 @@ def convert_midi_to_abc(
for midi_path in midi_paths:
part_name = Path(midi_path).stem
part_title = f"{song_title} ({part_name})"
- print(f" -> Processing part: {part_name}.mid")
+ log.debug(" -> Processing part: %s.mid", part_name)
temp_midi_path = temp_dir / f"{part_title}.mid"
temp_abc_path = temp_dir / f"{part_title}.abc"
@@ -55,7 +59,7 @@ def convert_midi_to_abc(
try:
score_part = converter.parse(midi_path, forceSource=True)
if not score_part or not score_part.flatten().notesAndRests:
- print(f" -> Skipping empty MIDI: {Path(midi_path).name}") # noqa
+ log.debug(" -> Skipping empty MIDI: %s", Path(midi_path).name)
continue
single_part_score = stream.Score()
@@ -71,12 +75,11 @@ def convert_midi_to_abc(
result = subprocess.run(cmd, capture_output=True, text=True, check=False)
if result.returncode != 0:
- print(f" -> ERROR: midi2abc failed for {part_name}: "
- f"{result.stderr}")
+ log.debug(" -> ERROR: midi2abc failed for %s: %s", part_name, result.stderr)
continue
if not temp_abc_path.exists() or temp_abc_path.stat().st_size == 0:
- print(f" -> ERROR: midi2abc created an empty file for {part_name}.")
+ log.debug(" -> ERROR: midi2abc created an empty file for %s.", part_name)
continue
with open(temp_abc_path, 'r', encoding='utf-8') as f:
@@ -84,12 +87,11 @@ def convert_midi_to_abc(
abc_results[part_name] = _post_process_abc_content(
abc_text_content, part_title)
- print(f" -> Successfully converted {part_name} to ABC.")
+ log.debug(" -> Successfully converted %s to ABC.", part_name)
except Exception as e:
- print(
- f" -> ERROR during ABC conversion for {part_name}: {e}")
- traceback.print_exc()
+ log.debug(" -> ERROR during ABC conversion for %s: %s", part_name, e)
+ log.debug(traceback.format_exc())
finally:
if temp_midi_path.exists():
os.remove(temp_midi_path)
@@ -108,21 +110,20 @@ def generate_mix_abc(mix_midi_path: str, song_title: str) -> str | None:
temp_abc_path = temp_dir / f"{mix_title}.abc"
try:
- print("\n -> Creating combined 'Mix' ABC score...")
+ log.debug(" -> Creating combined 'Mix' ABC score...")
cmd = ['midi2abc', mix_midi_path, '-o', str(temp_abc_path)]
result = subprocess.run(cmd, capture_output=True, text=True, check=False)
if result.returncode == 0 and temp_abc_path.exists():
raw_mix_abc = temp_abc_path.read_text(encoding='utf-8')
cleaned_mix_abc = _post_process_abc_content(raw_mix_abc, mix_title)
- print(" -> Successfully created 'Mix' ABC.")
+ log.debug(" -> Successfully created 'Mix' ABC.")
return cleaned_mix_abc
else:
- print(
- f" -> ERROR: midi2abc failed for Mix: {result.stderr}")
+ log.debug(" -> ERROR: midi2abc failed for Mix: %s", result.stderr)
return None
except Exception as e:
- print(f" -> ERROR during Mix ABC conversion: {e}")
+ log.debug(" -> ERROR during Mix ABC conversion: %s", e)
return None
finally:
if temp_abc_path.exists():
diff --git a/backend/services/lrc_service.py b/backend/services/lrc_service.py
index ae140ec..e6921c9 100755
--- a/backend/services/lrc_service.py
+++ b/backend/services/lrc_service.py
@@ -2,6 +2,7 @@
LRC alignment service for creating enhanced ELRC files with word-level timestamps.
Uses the lyrics-sync module for vocal extraction and forced alignment.
"""
+import logging
import os
import re
import sys
@@ -12,6 +13,8 @@ from typing import Optional, List, Tuple
from .. import job_manager as jm
from ..config import JOBS_DIR, LRC_SYNC_DIR
+
+log = logging.getLogger(__name__)
from .metadata_util import (
extract_lyrics_from_file,
lyrics_to_plaintext,
@@ -154,7 +157,9 @@ def run_lrc_alignment(
else:
out_path = LRC_SYNC_DIR / job_id
out_path.mkdir(parents=True, exist_ok=True)
-
+ log.debug("[%s] run_lrc_alignment start — source=%s vocals=%s precision=%s",
+ job_id, lyrics_source, is_vocals, timing_precision)
+
try:
# Import lyrics-sync here to handle any import issues gracefully
try:
@@ -235,6 +240,7 @@ def run_lrc_alignment(
)
except Exception as exc:
+ log.debug("[%s] lrc_alignment failed — %s: %s", job_id, type(exc).__name__, exc)
jm.update_job(job_id, status=jm.JobStatus.ERROR, error=str(exc), progress="Error.")
diff --git a/backend/services/lyric_transcriber_service.py b/backend/services/lyric_transcriber_service.py
index 0cc1925..6424087 100755
--- a/backend/services/lyric_transcriber_service.py
+++ b/backend/services/lyric_transcriber_service.py
@@ -49,9 +49,13 @@ try:
except Exception:
pass
+import logging
+
from .. import job_manager as jm
from ..config import JOBS_DIR, LRC_SYNC_DIR
+log = logging.getLogger(__name__)
+
@dataclass
class WordTimestamp:
@@ -1034,6 +1038,7 @@ def run_lyric_transcription(
diarize: bool = False,
power_preset: str = "standard",
phoneme_align: bool = False,
+ two_pass: bool = False,
existing_lyrics: Optional[str] = None,
):
"""
@@ -1064,7 +1069,9 @@ def run_lyric_transcription(
else:
out_path = LRC_SYNC_DIR / job_id
out_path.mkdir(parents=True, exist_ok=True)
-
+ log.debug("[%s] run_lyric_transcription start — model=%s engine=%s phoneme=%s two_pass=%s",
+ job_id, model, engine, phoneme_align, two_pass)
+
try:
if engine == "whisperx":
# ── WhisperX path: faster-whisper backend + phoneme-level alignment ──
@@ -1087,11 +1094,13 @@ def run_lyric_transcription(
return
device = "cuda" if torch.cuda.is_available() else "cpu"
+ log.debug("[%s] device=%s power_preset=%s", job_id, device, power_preset)
_wx_preset = _WHISPERX_POWER_PRESETS.get(power_preset, _WHISPERX_POWER_PRESETS['standard'])
batch_size = _wx_preset['batch_size']
compute_type = _wx_preset['compute_type_cuda'] if device == "cuda" else "int8"
# Auto-ensure vocals stem for best transcription quality.
+ log.debug("[%s] ensuring vocals stem from %s", job_id, audio_path)
audio_path = _ensure_vocals(audio_path, job_id)
# Music-tuned ASR options:
@@ -1148,16 +1157,18 @@ def run_lyric_transcription(
vad_options=_vad_opts,
)
- jm.update_job(job_id, progress=f"Pass 1: Transcribing with WhisperX ({model}, {power_preset})...")
+ jm.update_job(job_id, progress=f"Transcribing with WhisperX ({model}, {power_preset})...")
wx_result = wx_model.transcribe(audio_arr, batch_size=batch_size)
detected_lang = wx_result.get("language") or language or "unknown"
+ log.debug("[%s] transcription done — lang=%s segments=%d",
+ job_id, detected_lang, len(wx_result.get("segments", [])))
- # Pass 2: re-transcribe any gaps > 2 s that VAD may have missed
- # (e.g. quieter verse sections after long instrumentals).
- wx_result["segments"] = _fill_transcript_gaps(
- wx_model, audio_arr, wx_result.get("segments", []),
- batch_size, job_id, min_gap=2.0,
- )
+ if two_pass:
+ # Re-transcribe any gaps > 2 s that VAD may have missed
+ wx_result["segments"] = _fill_transcript_gaps(
+ wx_model, audio_arr, wx_result.get("segments", []),
+ batch_size, job_id, min_gap=2.0,
+ )
# Free the Whisper model from VRAM before loading the alignment model.
# large-v2/v3 consume 3–6 GB; keeping both models resident simultaneously
@@ -1173,6 +1184,7 @@ def run_lyric_transcription(
return
# ── Alignment (word-level or phoneme-level) ─────────────────────────
+ log.debug("[%s] starting alignment — phoneme=%s", job_id, phoneme_align)
_use_phoneme = phoneme_align
_phoneme_orig_words: list = []
@@ -1438,6 +1450,8 @@ def run_lyric_transcription(
"word_count": sum(len(seg.words) for seg in result.segments),
}
+ log.debug("[%s] complete — %d output files: %s",
+ job_id, len(output_files), [f["name"] for f in output_files])
jm.update_job(
job_id,
status=jm.JobStatus.DONE,
@@ -1445,11 +1459,16 @@ def run_lyric_transcription(
files=output_files,
result=result_summary
)
-
+
except Exception as exc:
+ log.debug("[%s] failed — %s: %s", job_id, type(exc).__name__, exc)
jm.update_job(job_id, status=jm.JobStatus.ERROR, error=str(exc), progress="Error.")
- # Best-effort GPU flush so a failed job doesn't strand VRAM.
+ # Best-effort GPU flush so a failed job doesn't strand VRAM for the next
+ # queued job. gc.collect() releases live tensor refs before empty_cache()
+ # can reclaim the CUDA memory they hold.
try:
+ import gc
+ gc.collect()
import torch
if torch.cuda.is_available():
torch.cuda.empty_cache()
diff --git a/backend/services/mix_service.py b/backend/services/mix_service.py
index 6d14c51..8e906b2 100755
--- a/backend/services/mix_service.py
+++ b/backend/services/mix_service.py
@@ -2,12 +2,15 @@
Mix service: create static or dynamic mixes from separated stems.
CPU-bound (pydub) — uses the general executor, not the GPU queue.
"""
+import logging
from pathlib import Path
from typing import Dict, List, Optional
from .. import job_manager as jm
from .preset_service import make_static, make_dynamic
+log = logging.getLogger(__name__)
+
def run_mix(
job_id: str,
@@ -19,6 +22,8 @@ def run_mix(
dynamic_levels: Optional[Dict[str, float]] = None,
):
"""Background task: create a mix from separated stems."""
+ log.debug("[%s] run_mix start — preset=%s format=%s output=%s",
+ job_id, preset_type, output_format, output_path)
jm.update_job(job_id, status=jm.JobStatus.RUNNING, progress="Creating mix...")
try:
out = Path(output_path)
@@ -33,6 +38,7 @@ def run_mix(
else:
raise ValueError(f"Unknown preset type: {preset_type}")
+ log.debug("[%s] mix complete — output=%s", job_id, result_path)
jm.update_job(
job_id,
status=jm.JobStatus.DONE,
@@ -40,6 +46,7 @@ def run_mix(
files=[{"name": out.name, "path": result_path, "type": preset_type}],
)
except Exception as exc:
+ log.debug("[%s] mix failed — %s: %s", job_id, type(exc).__name__, exc)
jm.update_job(job_id, status=jm.JobStatus.ERROR, error=str(exc), progress="Error.")
diff --git a/backend/services/pipeline_service.py b/backend/services/pipeline_service.py
index b079ce4..795fa4b 100755
--- a/backend/services/pipeline_service.py
+++ b/backend/services/pipeline_service.py
@@ -3,6 +3,7 @@ Full pipeline: separate → transcribe → abc-convert.
Supports both Demucs (CLI) and BS-RoFormer (Python API) for the separation stage.
Uses project-based folder structure for organized output.
"""
+import logging
import sys
import subprocess
import time
@@ -16,6 +17,8 @@ from .project_namer import project_name, make_project_dirs
from .separator_service import BSR_PREFIX, BSR_STEM_MODE
from . import abc_generator
+log = logging.getLogger(__name__)
+
def run_pipeline(
job_id: str,
@@ -34,6 +37,9 @@ def run_pipeline(
Creates organized project folder structure under MEDIA_DIR.
"""
+ log.debug("[%s] run_pipeline start — model=%s format=%s transcribe_mode=%s input=%s",
+ job_id, sep_model, sep_format, transcribe_mode, input_path)
+
# Read metadata for project naming
jm.update_job(job_id, status=jm.JobStatus.RUNNING, progress="Reading metadata...")
metadata = read_metadata(input_path)
@@ -78,6 +84,7 @@ def run_pipeline(
job_id, input_path, sep_model, sep_format, stems_dir
)
except Exception as exc:
+ log.debug("[%s] pipeline separation failed — %s: %s", job_id, type(exc).__name__, exc)
jm.update_job(job_id, status=jm.JobStatus.ERROR, error=str(exc), progress="Separation failed.")
return
@@ -152,6 +159,8 @@ def run_pipeline(
except Exception as exc:
jm.update_job(job_id, progress=f"[3/3] ABC conversion error: {exc}")
+ log.debug("[%s] pipeline complete — project=%s stems=%d files=%d",
+ job_id, proj_name, len(stem_files), len(all_files))
jm.update_job(
job_id, status=jm.JobStatus.DONE,
progress="Pipeline complete.",
diff --git a/backend/services/separator_service.py b/backend/services/separator_service.py
index 2db1796..d43dba3 100755
--- a/backend/services/separator_service.py
+++ b/backend/services/separator_service.py
@@ -4,6 +4,7 @@ Stem separation service with project-based folder structure and preset mixing.
- BS-RoFormer → Python API (in-process, no subprocess needed)
- Presets → Instrumental, Static, Dynamic mixing via preset_service
"""
+import logging
import os
import subprocess
import sys
@@ -24,6 +25,8 @@ from .project_namer import project_name, make_project_dirs
from .preset_service import make_instrumental, make_static, make_dynamic
from .project_metadata import write_project_metadata
+log = logging.getLogger(__name__)
+
# ---------------------------------------------------------------------------
# Stem file naming helper
# ---------------------------------------------------------------------------
@@ -229,6 +232,9 @@ def run_separation(
Static/ (if preset is static)
Dynamic/ (if preset is dynamic)
"""
+ log.debug("[%s] run_separation start — model=%s format=%s preset=%s input=%s",
+ job_id, model, output_format, preset_type, input_path)
+
# Read metadata for project naming
jm.update_job(job_id, status=jm.JobStatus.RUNNING, progress="Reading metadata...")
metadata = read_metadata(input_path)
@@ -565,6 +571,8 @@ def run_separation(
jm.append_job_files(parent_job_id, stem_entries)
project_id_result = None
+ log.debug("[%s] separation complete — project=%s stems=%d files=%d",
+ job_id, proj_name, len(stem_files), len(all_files))
jm.update_job(
job_id,
status=jm.JobStatus.DONE,
@@ -600,8 +608,10 @@ def run_separation(
"The GPU was automatically reset — please retry the separation. "
"If the error keeps occurring, restart the container."
)
+ log.debug("[%s] separation GPU error — %s: %s", job_id, type(exc).__name__, err_str[:200])
jm.update_job(job_id, status=jm.JobStatus.ERROR, error=user_msg, progress="GPU error — retry to use reset GPU.")
else:
+ log.debug("[%s] separation failed — %s: %s", job_id, type(exc).__name__, exc)
jm.update_job(job_id, status=jm.JobStatus.ERROR, error=err_str, progress="Error.")
diff --git a/backend/services/transcriber_service.py b/backend/services/transcriber_service.py
index 61e9cdf..4224a98 100755
--- a/backend/services/transcriber_service.py
+++ b/backend/services/transcriber_service.py
@@ -4,11 +4,14 @@ Supports two modes mapped to inference parameter presets:
polyphonic — general multi-instrument transcription
melody — single-voice / vocal melody (melodia trick, min frequency)
"""
+import logging
from pathlib import Path
from .. import job_manager as jm
from ..config import JOBS_DIR, TRANSCRIBE_PRESETS
+log = logging.getLogger(__name__)
+
def run_transcription(job_id: str, input_path: str, mode: str):
"""
@@ -18,6 +21,7 @@ def run_transcription(job_id: str, input_path: str, mode: str):
from basic_pitch.inference import predict
from basic_pitch import ICASSP_2022_MODEL_PATH
+ log.debug("[%s] run_transcription start — mode=%s input=%s", job_id, mode, input_path)
output_dir = JOBS_DIR / job_id
output_dir.mkdir(parents=True, exist_ok=True)
@@ -45,6 +49,7 @@ def run_transcription(job_id: str, input_path: str, mode: str):
dest = output_dir / output_name
midi_data.write(str(dest))
+ log.debug("[%s] transcription complete — output=%s", job_id, dest.name)
jm.update_job(
job_id,
status=jm.JobStatus.DONE,
@@ -53,4 +58,5 @@ def run_transcription(job_id: str, input_path: str, mode: str):
)
except Exception as exc:
+ log.debug("[%s] transcription failed — %s: %s", job_id, type(exc).__name__, exc)
jm.update_job(job_id, status=jm.JobStatus.ERROR, error=str(exc), progress="Error.")
diff --git a/backend/static/index.html b/backend/static/index.html
index 69610ca..7a2db23 100644
--- a/backend/static/index.html
+++ b/backend/static/index.html
@@ -19,8 +19,8 @@
-
-
+
+
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 82da8f3..ead39f9 100755
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -10,6 +10,7 @@
"dependencies": {
"@tanstack/react-query": "^5.0.0",
"@tonejs/midi": "^2.0.28",
+ "abcjs": "^6.6.2",
"lucide-react": "^0.294.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
@@ -1214,6 +1215,16 @@
"vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
}
},
+ "node_modules/abcjs": {
+ "version": "6.6.2",
+ "resolved": "https://registry.npmjs.org/abcjs/-/abcjs-6.6.2.tgz",
+ "integrity": "sha512-YLbp5lYUq0uOywWZx9EuTdm0TcflKZi7hOzz366A/LFl3qoAXSYIjznJQmr/VeHg8NcLxZYoN8dLi7PqCpxKEA==",
+ "license": "MIT",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/paulrosen"
+ }
+ },
"node_modules/any-promise": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
diff --git a/frontend/package.json b/frontend/package.json
index 4234cc5..547ca61 100755
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -11,10 +11,11 @@
"dependencies": {
"@tanstack/react-query": "^5.0.0",
"@tonejs/midi": "^2.0.28",
- "tone": "^14.7.0",
+ "abcjs": "^6.6.2",
"lucide-react": "^0.294.0",
"react": "^18.2.0",
- "react-dom": "^18.2.0"
+ "react-dom": "^18.2.0",
+ "tone": "^14.7.0"
},
"devDependencies": {
"@types/react": "^18.2.37",
diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts
index efcc181..c07b789 100755
--- a/frontend/src/api/client.ts
+++ b/frontend/src/api/client.ts
@@ -389,6 +389,7 @@ export const lyricTranscribeProject = (
diarize?: boolean
lrcPowerPreset?: string
phonemeAlign?: boolean
+ twoPass?: boolean
}
) => {
const wordTs = opts?.wordTimestamps ?? true
@@ -414,6 +415,7 @@ export const lyricTranscribeProject = (
diarize: opts?.diarize ?? false,
lrc_power_preset: opts?.lrcPowerPreset ?? 'standard',
phoneme_align: phonemeAlign,
+ two_pass: opts?.twoPass ?? false,
}),
})
}
diff --git a/frontend/src/components/AutoPipelineDialog.tsx b/frontend/src/components/AutoPipelineDialog.tsx
index d6584b1..6e3b4ee 100755
--- a/frontend/src/components/AutoPipelineDialog.tsx
+++ b/frontend/src/components/AutoPipelineDialog.tsx
@@ -185,6 +185,7 @@ export default function AutoPipelineDialog({ target, onClose, onComplete, onOpen
wordTimestamps: wordTs,
diarize: step.diarize,
phonemeAlign: step.phonemeAlign,
+ twoPass: step.twoPass ?? false,
})
await pollUntilDone(transcribeJobId, ctrl.signal)
}, ctrl.signal, retry)
diff --git a/frontend/src/components/LyricsLivePreview.tsx b/frontend/src/components/LyricsLivePreview.tsx
index 0aabb88..90f5da7 100755
--- a/frontend/src/components/LyricsLivePreview.tsx
+++ b/frontend/src/components/LyricsLivePreview.tsx
@@ -843,6 +843,7 @@ export default function LyricsLivePreview({ lrcText, audioUrl, stems, title, sty
// ── Fullscreen ────────────────────────────────────────────────────────────
const fullscreenRef = useRef(null)
const [isFullscreen, setIsFullscreen] = useState(false)
+ const [isNarrow, setIsNarrow] = useState(typeof window !== 'undefined' && window.innerWidth < 640)
// Scale font size up in fullscreen so lyrics fill the larger canvas
const fontSize = isFullscreen ? Math.round(baseFontSize * 1.65) : baseFontSize
@@ -853,6 +854,12 @@ export default function LyricsLivePreview({ lrcText, audioUrl, stems, title, sty
return () => document.removeEventListener('fullscreenchange', onFsChange)
}, [])
+ useEffect(() => {
+ function check() { setIsNarrow(window.innerWidth < 640) }
+ window.addEventListener('resize', check)
+ return () => window.removeEventListener('resize', check)
+ }, [])
+
function toggleFullscreen() {
if (!isFullscreen) fullscreenRef.current?.requestFullscreen()
else document.exitFullscreen()
@@ -1537,8 +1544,7 @@ export default function LyricsLivePreview({ lrcText, audioUrl, stems, title, sty
function renderTransport() {
return (