Disc Jockey Plus
=================
> A professional note-block music mod for Minecraft Java 26.2
> Unofficial fork of the original Disc Jockey - Fully ported to 26.2 -
> Built-in full localization - Real-time spectrum visualization - 88-key piano keyboard
Dependent Mods
--------------
- Fabric Loader >= 0.19.2
- Fabric API >= 0.157.0
- Cloth Config API >= 26.2.155
- Mod Menu >= 20.0.1 (optional)
- PianoLib >= 1.0.2+DJP2.7.2 (optional)
================================================================================
Introduction
================================================================================
Disc Jockey Plus is an unofficial fork of the original Disc Jockey, fully ported
to Minecraft Java 26.2. It adds an 88-key piano keyboard (A0-C8), real-time
spectrum visualization, MIDI import/export, non-destructive NBS pitch-range
repair (Clamp/Fold), instrument remapping, a preview system, a sleep timer,
and full internationalization.
Press J or run /discjockey to open the main GUI.
==================================================================================
In game check update
/discjockey update
================================================================================
Anti-Anti-Cheating
================================================================================
Reinforced Anti-Anti-Cheating.
================================================================================
Core Features
================================================================================
88-Key Piano Keyboard
---------------------
- Covers all 88 semitones from A0 (-39) to C8 (48), zeroed at A0, mapped
one-to-one to PianoLib / NoteBlock pitches.
- Physical keyboard mapping (C-major layout: A S D F G H J K L ; ' plus black
keys W E T Y U O P [ ]); keys 1/2/3 are fixed to A0/A#0/B0 for quick
testing and recording.
- Octave transposition: [-] / [+] buttons or the 0 key jump to C4;
getDisp() shows the current octave offset.
- Three playback paths are tried in order: PianoAPI (sqlmc.api.PianoAPI)
first, then PianoLib 88-note cache (pianolib:key_0-key_87), and finally
NOTE_BLOCK_HARP with pitch fallback, so sound works both on the main menu
and in-world.
- MIDI recording: built-in MidiRecorder supports sustain pedal (Sustain CC64),
reverb (Reverb CC91/93), and ADSR envelopes; recorded .mid files are
auto-saved to the recordings/ folder.
Real-Time Spectrum Visualization
--------------------------------
- A 16-band spectrum with peak-hold and exponential decay, rendering smoothly
with no ghosting.
- Five render styles are available and can be switched with one click in the
GUI: BAR, WAVE, RING, MIRROR, PARTICLE.
- The spectrum is always shown on the main menu and in-world HUD (controlled
by the spectrumAlwaysVisible config); both playback and preview drive the
spectrum.
NBS Playback & NBS Repair (Clamp / Fold)
-----------------------------------------
- Loads .nbs songs with support for play / pause / stop / resume / loop /
shuffle / autoplay.
- Clamp / Fold (non-destructive): runs octave folding at runtime for NBS songs
outside the 0-24 range; the original file is not modified and nothing is
written to disk, only a foldedNotes cache is generated.
- fold auto enables automatic repair; fold scan scans all songs;
fold info <song> shows the pitch-range report for a single song.
- Transpose: applies runtime octave-fold transposition to notes to prevent
high notes from being clipped.
MIDI Import & Export
--------------------
- NBS -> MIDI export (disc_jockey.screen.export_midi): exports a standard
.mid with tempo (Tempo), time signature (4/4 Time Signature), and bar
markers (Bar Marker); output goes to the midi/ folder and is opened
automatically.
- MIDI -> NBS import (disc_jockey.screen.import_midi): reads .mid / .midi
via a built-in file chooser, parses note events, generates a Song, and
safely falls back on empty files or parse failures.
Preview System
--------------
- Preview songs from both the main menu and in-world (uses SoundSource.MASTER
when outside a world; auto-switches to playLocalSound after joining a world).
- M mutes / unmutes preview; P toggles preview looping (keybindings are
customizable in Controls settings).
- Preview and playback are mutually exclusive: starting one automatically
stops the other.
Instrument Management
--------------------
- instrument <name> counts nearby note blocks of the specified instrument.
- remapInstruments manages instrument mapping: map / unmap / show / clear -
map one instrument to another (e.g. brass), resolving server-side instrument
detection differences.
Speed & Transpose
-----------------
- speed <value> adjusts playback / preview speed (default 1.0, shared with
preview stepping).
- transpose transposes the current song (octave folding, preserving #F24 from
being clipped).
Utilities
---------
- reload reloads all songs (including hot-reload watching).
- spectrum toggles the in-GUI spectrum display on / off.
- sleep <seconds> stops playback after a timer, or cancels the timer.
- now / info / progress show the current song, its info, and playback progress.
- clampstatus / fold status check repair status; unclamp cancels repair.
================================================================================
Command Reference
================================================================================
Basic Playback
--------------
/discjockey Open the Disc Jockey GUI
/discjockey play <song> Play the specified song
/discjockey pause Pause playback
/discjockey stop Stop playback
/discjockey resume Resume playback
/discjockey now Show the song currently playing
/discjockey info Show current song info and playback speed
/discjockey progress Show playback progress
Playback Modes
--------------
/discjockey loop yes|no Enable / disable single-song loop
/discjockey shuffle Toggle shuffle playback mode
/discjockey autoplay Enable / disable auto-play (queue)
/discjockey random Play a random song from the GUI list
Preview
-------
/discjockey preview <song> Preview the specified song or show preview status
M key Mute / unmute preview
P key Enable / disable preview looping
Keybindings are customizable in Controls settings.
Speed & Transpose
-----------------
/discjockey speed <value> Adjust playback speed
/discjockey transpose Transpose the current song
NBS Repair (Clamp / Fold)
-------------------------
(Non-destructive, temporary; does not modify the original file.)
/discjockey clamp <xxx.nbs> Temporarily repair the specified NBS song
/discjockey unclamp Cancel repair
/discjockey clampstatus Check the current repair status
/discjockey fold auto Enable automatic repair
/discjockey fold info <xxx.nbs> Show the repair status of a single song
/discjockey fold rebuild Re-run repair (refresh status)
/discjockey fold scan Scan all songs for needed repair
/discjockey fold status Equivalent to clampstatus
Instrument Management
---------------------
/discjockey instrument <name> Count nearby note blocks of the specified instrument
/discjockey remapInstruments map <src> <dst> Create an instrument mapping
/discjockey remapInstruments unmap <src> <dst> Remove the specified mapping
/discjockey remapInstruments show Show the current mapping state
/discjockey remapInstruments clear Clear all instrument mappings
Utilities
---------
/discjockey reload Reload all songs
/discjockey spectrum Toggle the in-GUI spectrum display
/discjockey sleep <seconds> Stop playback after a timer / cancel the timer
/discjockey help Show help information
================================================================================
Notes
================================================================================
- Only legal .nbs files are supported.
- Clamp / Fold is non-destructive and temporary; it takes effect only at
runtime and reverts when disabled or canceled.
- The GUI includes real-time spectrum visualization (5 styles available).
- All keybindings can be customized in Controls settings.
- Requires Fabric Loader + Minecraft 26.2; optionally depends on PianoLib /
sqlmc PianoAPI for high-quality piano sounds.
================================================================================
Technical
================================================================================
- Uses a two-layer spectrum architecture - SpectrumDataSmoother (peak-hold +
exponential decay) and SpectrumVisualizer (unified playback/preview data
source) - for stable, non-pegging spectrum rendering.
- Playback uses SongPlayer (configurable async playback, RateLimiter-based
packet-rate limiting, sleep timer) together with Tuner (multi-layer fallback
note-block lookup after octave folding).
- Cross-frame safe GUI opening: Main.openScreenOnNextTick defers screen
requests to the next tick via a ConcurrentLinkedQueue, avoiding the race
where the closing chat screen carries the new GUI away with it.
- Obfuscation-friendly: all Screen subclasses, MidiRecorder, and reflection-
using classes (PianoPlayer / DiscJockeyHud) are preserved verbatim via
ProGuard keep rules to prevent VerifyError.
================================================================================
Copyright
================================================================================
(c) Disc Jockey Plus - Unofficial fork of Disc Jockey.
# Disc Jockey Plus
## 依赖项目
Fabric Loader >0.19.2
Fabric API >0.157.0
Cloth Congih API >=26.2.155
Mod Menu >=20.0.1 (可选的)
PianoLib >=1.0.2+DJP2.7.2 (可选的)
> **为 Minecraft Java 版 26.2 打造的专业级音符盒音乐播放模组**
> 原版 *Disc Jockey* 的非官方分支 · 全版本适配 26.2 · 内置完整多语言 · 实时频谱可视化 · 88 键钢琴键盘
## ✨ 简介
**Disc Jockey Plus** 是原版 *Disc Jockey* 的非官方分支,已将模组完整适配至 **Minecraft Java 版 26.2**,并追加了多项实用功能:内置 88 键钢琴键盘、实时频谱可视化、MIDI 双向转换、NBS 音域修复、音色映射、预览系统、睡眠定时器等,同时内置完整多语言支持。
> 按 **J 键** 或输入 `/discjockey` 即可打开主界面。
---
## 🎯 核心功能
### 🎹 88 键钢琴键盘
- 完整覆盖 **A0(−39) ~ C8(48)** 共 88 个半音,零点为 A0,与 PianoLib / NoteBlock 音高一一对应。
- 支持物理键盘映射,**1/2/3 固定映射 A0/A#0/B0**,方便试音与录制。
- **八度移调**:`[−]` / `[+]` 按钮或数字键 `0` 一键回到 C4,`getDisp()` 显示当前八度偏移。
- **三种播放路径自动择优**:优先 PianoAPI→ 回退 PianoLib 88 音缓存→ 最终回退 `NOTE_BLOCK_HARP` 变调,确保主菜单与世界内都能出声。
- **MIDI 录制**:内置 `MidiRecorder`,支持延音踏板、混响、ADSR 包络,录制的 `.mid` 文件自动保存至 `recordings/` 目录。
###游戏内检查升级
使用/discjockey update
### 📊 实时频谱可视化
- 16 段频谱,峰值保持+ 指数衰减,渲染丝滑无重影。
- 提供 **5 种渲染样式**,可在 GUI 内一键切换:
`条形 BAR` · `波形 WAVE` · `圆环 RING` · `镜像对称 MIRROR` · `粒子 PARTICLE`
- 主菜单与世界内 HUD 常驻显示,播放/预览均驱动频谱跳动。
### 🎵 NBS 播放与 NBS 修复
- 加载 `.nbs` 歌曲,支持播放 / 暂停 / 停止 / 恢复 / 循环 / 随机 / 自动连播。
- **Clamp / Fold(非破坏性)**:对超出 0~24 音域的 NBS 曲目做运行时八度折叠,不改原文件、不写盘,仅生成 `foldedNotes` 缓存。
- `fold auto` 启用自动修复;`fold scan` 扫描全部曲目;`fold info <曲目>` 查看单首音域报告。
- 移调:运行时对音符做八度折叠移调,避免高音被截断。
### 🎼 MIDI 双向转换
- **NBS → MIDI 导出**:导出标准 `.mid`,含速度、拍号、小节线标记,输出至 `midi/` 目录并自动打开。
- **MIDI → NBS 导入**:通过内置文件选择器读取 `.mid` / `.midi`,自动解析音符事件并生成 Song,支持空文件 / 解析失败安全兜底。
### 🎚️ 预览系统
- 主菜单与世界内均可预览曲目。
- **M 键** 预览静音 / 取消静音,**P 键** 开启 / 关闭预览循环(按键绑定可在"控制"设置中自定义)。
- 预览与播放互斥:启动一方自动停止另一方。
### 🎷 乐器管理
- `instrument <名称>` 统计周围指定乐器的音符盒数量。
- `remapInstruments` 音色映射管理:`map` / `unmap` / `show` / `clear`,把一种乐器映射到另一种(如铜管乐器映射),解决服务器乐器判定差异。
### ⚡ 速度与音调
- `speed <数值>` 调整播放 / 预览速度(默认 1.0,与预览步进共享)。
- `transpose` 对当前曲目移调(八度折叠,保护 #F24 不被压掉)。
### 🧰 实用工具
- `reload` 重新加载所有曲目(含热重载监听)。
- `spectrum` 开启 / 关闭 GUI 内频谱显示。
- `sleep <秒数>` 定时停止播放 / 取消定时。
- `now` / `info` / `progress` 查看当前曲目、信息与进度。
- `clampstatus` / `fold status` 检查修复状态,`unclamp` 取消修复。
---
## 📜 指令大全
### 🎵 基础播放控制
| 指令 | 说明 |
|---|---|
| `/discjockey` | 打开 Disc Jockey GUI |
| `/discjockey play <曲目>` | 播放指定曲目 |
| `/discjockey pause` | 暂停播放 ⏸ |
| `/discjockey stop` | 停止播放 |
| `/discjockey resume` | 恢复播放 |
| `/discjockey now` | 查看当前正在播放的曲目 |
| `/discjockey info` | 查看当前曲目信息与播放速度 |
| `/discjockey progress` | 查看播放进度 |
###🛡️防反作弊
增强了原版Disc Jockey的防反作弊。
### 🔁 播放模式
| 指令 | 说明 |
|---|---|
| `/discjockey loop yes\|no` | 开启 / 关闭单曲循环 |
| `/discjockey shuffle` | 切换随机播放模式 |
| `/discjockey autoplay` | 开启 / 关闭自动连播 |
| `/discjockey random` | 随机播放 GUI 列表中的一首曲目 |
### 👂 预览系统
| 指令 | 说明 |
|---|---|
| `/discjockey preview <曲目>` | 预览指定曲目或查看预览状态 |
| **M 键** | 预览静音 / 取消静音 |
| **P 键** | 开启 / 关闭预览循环 |
> 按键绑定可在"控制"设置中修改。
### ⚡ 速度与音调
| 指令 | 说明 |
|---|---|
| `/discjockey speed <数值>` | 调整播放速度 |
| `/discjockey transpose` | 对当前曲目进行移调 |
### 🛠️ NBS 修复
> 修复为**临时、非破坏性操作**,不会改动原文件。
| 指令 | 说明 |
|---|---|
| `/discjockey clamp <xxx.nbs>` | 对指定 NBS 曲目进行临时修复 |
| `/discjockey unclamp` | 取消修复 |
| `/discjockey clampstatus` | 检查当前修复状态 |
| `/discjockey fold auto` | 启用自动修复 |
| `/discjockey fold info <xxx.nbs>` | 查看单个曲目的修复状态 |
| `/discjockey fold rebuild` | 重新执行修复(刷新状态) |
| `/discjockey fold scan` | 扫描所有曲目是否需要修复 |
| `/discjockey fold status` | 等同于 `clampstatus` |
### 🎹 乐器管理
| 指令 | 说明 |
|---|---|
| `/discjockey instrument <名称>` | 统计周围指定乐器的音符盒数量 |
| `/discjockey remapInstruments map <源> <目标>` | 建立音色映射 |
| `/discjockey remapInstruments unmap <源> <目标>` | 移除指定映射 |
| `/discjockey remapInstruments show` | 查看当前映射状态 |
| `/discjockey remapInstruments clear` | 清空所有音色映射 |
### 🧰 实用工具
| 指令 | 说明 |
|---|---|
| `/discjockey reload` | 重新加载所有曲目 |
| `/discjockey spectrum` | 开启 / 关闭 GUI 内的频谱显示 |
| `/discjockey sleep <秒数>` | 定时停止播放 / 取消定时 |
| `/discjockey help` | 查看帮助信息 |
---
## 📌 注意事项
- 仅支持带有 **.nbs** 后缀名的合法音乐文件。
- Clamp / Fold 为**非破坏性操作**,仅临时生效,关闭或取消后恢复原状。
- GUI 内自带**实时频谱可视化**(5 种样式可切换)。
- 所有快捷键均支持在"控制"设置中**自定义**。
- 依赖 Fabric Loader + Minecraft 26.2;可选依赖 PianoLib / sqlmc PianoAPI 用于高品质钢琴音色。
## 🔧 技术说明
- 采用 `SpectrumDataSmoother`(峰值保持 + 指数衰减)与 `SpectrumVisualizer`(统一播放/预览数据源)双层架构,频谱稳定无卡顶。
- 播放采用 `SongPlayer`(可配置异步播放、发包速率限制 `RateLimiter`、睡眠定时器)+ `Tuner`(八度折叠后多层 fallback 查找音符盒)。
- 跨帧安全开界面:`Main.openScreenOnNextTick` 通过 `ConcurrentLinkedQueue` 把界面请求推迟到下一 tick,规避聊天框关闭带走界面的竞争。
- 混淆友好:所有 Screen 子类、`MidiRecorder`、反射类均通过 ProGuard keep 规则原样保留,避免 `VerifyError`。
---
© Disc Jockey Plus — 基于原版 *Disc Jockey* 的非官方分支

