脉冲跟踪器mcp
MCP服务器,用于读取、编辑、分析和渲染脉冲跟踪器模块文件。
它为stdio MCP服务器提供了使用工具 .it 和 .mptm 模块,由一个小型二进制格式层和一个用于MCP处理程序的工具层支持。
特性
- 读取模块元数据、订单列表、完整模式、模式范围、仪器和样本
- 分析样本以推断音乐角色和基本波形特征
- 直接编辑跟踪器数据:注释、模式范围、订单、通道、模块设置、仪器和样本标题
- 复制模块并执行排列助手,如克隆行、复制模式和转置音符范围
- 通过和弦布局、罗马数字进行、节奏发生器、自动扫音、琶音、音阶运行、模式扩展/收缩和片段重用,在更高的层次上作曲
- 将单个样本导出到WAV
- 通过以下方式将完整模块、顺序子集或单个模式渲染到WAV
openmpt123
项目结构
src/
index.ts
it-format/
parser.ts
writer.ts
types.ts
tools/
shared.ts
sample-analysis.ts
read-tools.ts
write-tools.ts
audio-tools.ts
test/
helpers/
*.test.ts需求
- Node.js用于测试和类型检查
- 用于在生产环境中运行MCP服务器的Bun
openmpt123上PATH用于WAV渲染
安装
npm install发展
类型检查:
npx tsc --noEmit运行测试:
npm test运行单个测试文件:
node --import tsx --test test/tools.test.ts启动MCP服务器:
bun run src/index.ts可用的MCP工具
阅读工具:
get_module_infoget_pattern_orderget_patternget_pattern_rangeget_instrument_listget_sample_listanalyze_sampleanalyze_module_samples
写入工具:
copy_moduleset_noteset_pattern_cell_rangeclear_pattern_rangecopy_patternclone_pattern_rowstranspose_pattern_rangeadd_patternremove_patternset_pattern_orderinsert_order_rangeset_module_infoset_instrumentset_sample_settingsset_channel_settings
音频工具:
export_sample_to_wavrender_to_wavrender_pattern_to_wav
编写工具:
place_chordplace_chord_progressionplace_progression_by_numeralfill_rhythmic_patternfill_multi_channel_rhythmfill_note_sequenceapply_effect_sweepapply_volume_gradientapply_effect_columngenerate_arpeggio_patterngenerate_scale_runexpand_patternstrum_chordcreate_pattern_from_templaterepeat_section_with_variation
编写工具示例
将有声I-V-vi-IV进程放入模式3:
{
"tool": "place_progression_by_numeral",
"file_path": "song.it",
"pattern_index": 3,
"start_row": 0,
"key": "C",
"numerals": ["I", "V", "vi", "IV"],
"duration_rows": 16,
"start_channel": 0,
"instrument": 1,
"volume": 40,
"octave": 4,
"voice_leading": "nearest"
}在一次通话中生成踢腿模式和问候语:
{
"tool": "fill_multi_channel_rhythm",
"file_path": "song.it",
"pattern_index": 4,
"start_row": 0,
"end_row": 63,
"cycle_length": 16,
"tracks": [
{ "channel": 0, "hits": [0, 4, 8, 12], "note": "C-5", "instrument": 1, "volume": 48 },
{ "channel": 1, "hits": [2, 6, 10, 14], "note": "C-5", "instrument": 2, "volume": 28 }
]
}将旋律写成持续时间加休息时间:
{
"tool": "fill_note_sequence",
"file_path": "song.it",
"pattern_index": 5,
"start_row": 0,
"channel": 2,
"instrument": 3,
"volume": 32,
"notes": [
{ "note": "C-5", "duration_rows": 2 },
{ "note": "E-5", "duration_rows": 2 },
{ "note": "...", "duration_rows": 2 },
{ "note": "G-5", "duration_rows": 1 }
]
}对效果列应用参数扫描:
{
"tool": "apply_effect_sweep",
"file_path": "song.it",
"pattern_index": 2,
"start_row": 0,
"end_row": 15,
"channel": 3,
"effect": "D",
"start_param": "00",
"end_param": "30",
"curve": "linear"
}展开或缩小所选行:
{
"tool": "expand_pattern",
"file_path": "song.it",
"pattern_index": 1,
"start_row": 0,
"end_row": 15,
"factor": 2,
"start_channel": 0,
"end_channel": 3
}{
"tool": "expand_pattern",
"file_path": "song.it",
"pattern_index": 1,
"start_row": 0,
"end_row": 15,
"factor": 0.5,
"start_channel": 0,
"end_channel": 3
}一步从和声和节奏材料创建新图案:
{
"tool": "create_pattern_from_template",
"file_path": "song.it",
"rows": 64,
"chord_progression": {
"chords": [
{ "root": "C", "chord_type": "major", "duration_rows": 16 },
{ "root": "G", "chord_type": "major", "duration_rows": 16 },
{ "root": "A", "chord_type": "minor", "duration_rows": 16 },
{ "root": "F", "chord_type": "major", "duration_rows": 16 }
],
"start_channel": 0,
"instrument": 1,
"volume": 40,
"voice_leading": "nearest",
"octave": 4
},
"rhythmic_tracks": [
{ "channel": 3, "hits": [0, 4, 8, 12], "cycle_length": 16, "note": "C-5", "instrument": 2, "volume": 48 }
],
"add_to_order": true
}建筑
src/it-format/:纯模块解析和序列化逻辑,不依赖于MCPsrc/tools/:面向MCP的处理程序和模式src/index.ts:服务器注册和stdio传输布线
除非您明确更改了与样本相关的标头设置,否则在解析和回写模块时,样本PCM会逐字节保留。
备注
- 渲染取决于外部
openmpt123;没有它,渲染工具将在运行时失败 - 在Node下运行测试,并加入Bun垫片
test/helpers/setup.ts - 服务器是基于文件路径的,在工具调用之间不保持会话状态
