본문으로 건너뛰기
Z

dsh-sheet-music

z-zoneh/dsh-sheet-music

Transcribes an audio file or video link into a chord chart, numbered notation and MIDI.

설치

dsh plugin --profile web add github:z-zoneh/dsh-sheet-music

README

dsh-sheet-music 扒谱

A DeepSeek Harness bundle that transcribes a song into a chord chart (和弦进行), numbered notation (简谱) and MIDI — right inside the conversation.

装进 DeepSeek Harness 的扒谱插件:给一个音频文件或一个视频链接,直接得到和弦谱、简谱和 MIDI。

你: 扒一下这首 https://www.bilibili.com/video/BV...
→ 扒谱完成: ...
  调性 F major (置信度 0.91) · BPM 95.0 · 时长 2:31 · 拍号 4/4
  和弦 302 个 · 旋律音符 671 个 · 计算耗时 41.2s

What it does / 它能做什么

  • Full multi-instrument songs — HPSS separates harmony from percussion, so drums never vote on pitch. 整首歌多乐器素材可用;和声/打击乐分离,鼓点不参与音高判断。
  • Beat tracking + bar lines — detects BPM and beats, then infers bar lines from harmonic change, so pickups are handled. 自动打拍,并从和声变化量推断小节线,正确处理弱起。
  • One chord per beat — 156 chord templates (triads, sevenths, sus, add, dim, aug) with the bass deciding the root and inversions (E/G#, A/C#). 逐拍和弦识别,低音决定根音与转位。
  • Key from the progression — the key is voted on by the whole chord sequence, which is far steadier than matching a profile against raw chroma. 用整段和弦进行推断调性。
  • Constant-hum rejection — a per-pitch-class static floor is subtracted, which rescues recordings with a continuous low rumble. 逐音级静态底噪扣减,抗持续低频嗡鸣。
  • Lead melody → 简谱 — harmonic salience plus Viterbi continuity tracking, quantised to a musical grid. 谐波显著性 + Viterbi 连续性跟踪提取主旋律。
  • Sections — A/B/C form table from harmonic-similarity clustering.

Install / 安装

dsh plugin --profile <profile> add dsh-sheet-music

Then restart dsh web (or use the in-app plugin manager on DSH Desktop).

The first transcription provisions a private Python environment under ~/.cache/dsh-sheet (or the platform temp directory when that is not writable) and installs the engine's dependencies. This happens once, takes a few minutes, and prints progress to the host log. Point pipIndex (config) or SHEET_PIP_INDEX (env) at a mirror if PyPI is slow where you are.

首次转谱会自动在 ~/.cache/dsh-sheet 下建一个私有 Python 环境并安装引擎依赖;只发生一次,需要几分钟。国内可把 pipIndex 配置项或 SHEET_PIP_INDEX 环境变量指向镜像源。

The sheet tool / 工具参数

parametertypemeaning
sourcestring, requiredlocal audio path (mp3/wav/m4a/flac/ogg…), or an http(s) URL (Bilibili / YouTube) to download first
outdirstringoutput directory; relative paths resolve against the session working directory. Defaults to sheet_out beside the audio, or sheet_out in the session directory when source is a link
titlestringsong title used for file names and headings
bpmnumbertempo hint, when the user already knows it
keystringkey hint such as G, Am, F#m; overrides detection
beatsPerBarnumbertime-signature numerator, default 4
maxDurationnumberonly transcribe the first N seconds
staticPctnumberpercentile of the per-pitch-class noise floor to subtract (default 5; 0 disables). Raise it on a recording with a constant low hum

Output files / 输出文件

filecontents
<slug>.chords.txtkey, BPM, form table, per-beat chord timeline, per-bar chord table
<slug>.jianpu.txt简谱: scale degree + octave marks + duration marks, with a note list
<slug>.midthree-track MIDI (tempo/key signature, lead melody, chords)
<slug>.jsonthe structured result

Configuration / 配置

config keyenv varmeaning
pythonSHEET_PYTHONan interpreter that already has the engine's dependencies
basePythonSHEET_BASE_PYTHONthe interpreter used to create the private venv
homeSHEET_HOMEwhere the private venv lives
pipIndexSHEET_PIP_INDEXpin a pip index URL (skips the automatic speed probe)
autoInstall—set false to forbid provisioning entirely
timeoutMs / installTimeoutMs—wall-clock budgets

Requirements / 依赖

  • A Python 3.9+ interpreter reachable as python3, python or via config. The engine uses librosa, numpy, scipy, soundfile, mido, yt-dlp and PyAV (av). PyAV is not optional: soundfile cannot open m4a/m4s/mp3, and those are exactly the formats people hand this tool. No system ffmpeg is required — soundfile/PyAV decode on their own.
  • The first run needs those packages. If the interpreter above lacks them, the bundle creates a private venv itself — no manual setup. It measures candidate package indexes and picks the fastest instead of assuming PyPI is reachable: on some networks pypi.org needed ~117 s for a single wheel where the Tsinghua mirror took 2 s, which is the difference between a working install and a 20-minute timeout. Pin pipIndex (or SHEET_PIP_INDEX) to skip the probe and use a specific index.
  • No @deepseek-ai/* imports: the tool is registered as a raw JSON-Schema definition, so the bundle works without out-of-tree package resolution.

Accuracy / 精度

Measured on synthetic material with fully known ground truth (a clean multi-instrument mix, the same mix with a 49 Hz rumble added, and a rendered piano excerpt):

fixtureroot correctroot + qualityexact label
clean mix (C major, C Am F G C Am Dm G)100%100%100%
same mix + 49 Hz rumble100%88%88%
piano excerpt (A major, 8 bars)100%—matches the source progression

Melody extraction on the same piano excerpt: F1 0.88, 33/33 ground-truth notes recovered, precision 0.79 (the remainder is left-hand arpeggio bleed). Tempo is within ~2% of the true value on these fixtures.

On real commercial recordings accuracy varies with how dense and how processed the mix is — treat the output as a strong first draft, not a definitive score.

Licence

MIT

관련 플러그인