和弦生成器

一款用于生成和弦进行WAV文件的Node.js工具,提供多种预设和弦、节奏和乐器选项,适用于音乐制作和开发集成。

  • by Misfits-Rebels-Outcasts
  • JavaScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 Misfits-Rebels-Outcasts/chord-synth

使用说明

和弦合成器

生成和弦推进WAV文件。零依赖。仅限Node.js。

28个命名预设,22个琶音模式,7种乐器,斜线和弦(Am/E),换位,垫/低音/鼓轨道,混响。

快速开始

# Install globally
npm install -g chord-synth

# Generate a WAV file
chord-synth --preset "C G Am F" --bpm 120 --output pop.wav

# Custom jazz with slash chords
chord-synth --preset "Dm9 | G7/B | Cmaj7 | Am7/E" --instrument piano --drums bossanova --output jazz.wav

# Named preset transposed to key of G
chord-synth --preset "I-V-vi-IV (Pop)" --transpose 7 --output pop_in_G.wav

# Batch render from JSON file
chord-synth --batch render_jobs.json --output ./wavs/

用作MCP服务器

暴露 generate_wav 和 list_options 任何MCP兼容代理(Claude Desktop、Claude Code、Cursor、Windsurf等)的工具。

克劳德桌面 --添加到 claude_desktop_config.json:

{
  "mcpServers": {
    "chord-synth": {
      "command": "npx",
      "args": ["-y", "chord-synth", "mcp"]
    }
  }
}

克劳德代码:


# Add to Claude Code (point to the installed mcp-server.js)
claude mcp add chord-synth -- npx chord-synth --mcp

然后问克劳德: “以80 BPM的速度在Am F C G上生成悲伤的小提琴琶音” --它将呼叫 generate_wav 直接。

ChatGPT法典:

Prompt:
I have a mcp tool to generate chord wav files at https://github.com/Misfits-Rebels-Outcasts/chord-synth,
use it generate a chord progression for violin "Am Dm G C" at 128 bpm 

用作Node.js模块

const { renderJob, PRESETS, SCHEMA } = require('chord-synth');
const fs = require('fs');

// Render a WAV buffer
const wav = renderJob({
  preset: "C G Am/E F",
  bpm: 120,
  instrument: "piano",
  pattern: 1,        // Up
  enablePad: true,
  drumPattern: "poprock"
});

fs.writeFileSync('output.wav', wav);

代理接口

代理商应致电 chord-synth --schema 要获取完整的JSON工具规范:

chord-synth --schema

退货:

{
  "tool": "chord-synth",
  "description": "Generate chord progression WAV files...",
  "input_schema": {
    "type": "object",
    "required": ["preset"],
    "properties": {
      "preset": { "type": "string", "description": "Named preset or custom chords..." },
      "bpm": { "type": "integer", "default": 120 },
      "instrument": { "type": "string", "enum": ["piano","guitar","violin",...] },
      ...
    }
  },
  "examples": [...]
}

列出所有可用选项:

chord-synth --list

参数

参数 类型 默认值 说明
preset 字符串 必需的 命名预设("I-V-vi-IV (Pop)")或自定义和弦("C G Am/E F")
bpm int 120 速度
transpose int 0 闪米特语(-11到+11)
pattern int 1 Arp模式索引(见下文)
rate 字符串 "1/8" 票据利率: 1/1 1/2 1/4 1/8 1/16 1/32 (三元组加T)
instrument 字符串 "piano" piano guitar violin flute clarinet cello bass
octaveRange int 1 1-4倍频程跨度
baseOctave int 3 开始MIDI八度音阶
velocity int 90 MIDI速度1-127
swing 浮动 0.5 0.5=直,0.66=中等,0.75=重
loops int 2 渐进式重复
enablePad bool true 持续的和弦轨迹
padOctave int 4 垫音八度音阶
padVolume 浮动 0.12 垫体积(0.0-0.3)
enableBass bool true 自动低音(斜线和弦设置低音音符)
enableDrums bool true 鼓轨
drumPattern 字符串 "poprock" 见下面的鼓图案
reverbMix 浮动 0.18 反向金额(0.0-0.5)

命名预设

类别 预设
流行/摇滚 I-V-vi-IV (Pop), I-vi-IV-V (50s), vi-IV-I-V (Sad), I-IV-V-IV (Rock), I-V-vi-iii-IV (Canon)
爵士乐 ii-V-I (Jazz), I-vi-ii-V (Jazz Turnaround), iii-vi-ii-V (Coltrane), Autumn Leaves, So What, Steely Dan
新灵魂/R&B Neo-Soul I, Neo-Soul II, R&B Smooth
蓝调 12-Bar Blues, Minor Blues
拉丁语 Bossa Nova, Girl from Ipanema, Andalusian Cadence, Royal Road (JP)
模态/环境 Dorian Vamp, Lydian Float, Ambient Pads
EDM EDM Anthem, Trance, House
经典 Pachelbel Canon, Gospel

或者使用任何自定义和弦字符串: "Fmaj7 Em7 Dm9 Cmaj7", "Am | Dm/F | E7 | Am"等等。

Arp图案

索引 名称 索引 名称
0 和弦(方块) 11 小拇指
1 向上 12 拇指粉红色
2 向下 13 1-3-5-3
3 上下 14 1-5-3-5
4 向下上 15 1-5-8-5
5 上下(不重复) 16 1-3-5-8-5-3
6 向下向上(不重复) 17 阿尔伯蒂低音
7 随机 18 跨步
8 随机行走 19 三分之一断裂
9 由外而内 20 踏板音调
10 由内而外 21 交替低音

鼓图案

8beat 16beat poprock acousticpop bossanova swing funk rnb waltz arpeggio none

和弦符号

根: C C# Db D D# Eb E F F# Gb G G# Ab A A# Bb B

质量: (major) m 7 maj7 m7 dim aug sus2 sus4 9 m9 maj9 11 m11 13 6 m6 dim7 m7b5 add9 5 power

砍和弦: Am/E (Am和弦,E低音), C/G, Dm7/A

分隔符:空格或 | 两者都工作。 C G Am F = C | G | Am | F

输出

WAV PCM 16位单声道44100 Hz。与所有DAW、音频播放器和音频处理工具兼容。

许可证

麻省理工学院