Skip to content

Commit c3fb384

Browse files
authored
Merge pull request #31 from GlebkaF/add-chain-generator
Add chain generator
2 parents e0add4d + d6f22a8 commit c3fb384

26 files changed

+2071
-10
lines changed

.cursor/mcp.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"mcpServers": {
3+
"playwright": {
4+
"command": "/Users/skyeng/.nvm/versions/node/v22.14.0/bin/npx",
5+
"args": ["@playwright/mcp@latest"],
6+
"env": {
7+
"PATH": "/Users/skyeng/.nvm/versions/node/v22.14.0/bin:/usr/local/bin:/usr/bin:/bin"
8+
}
9+
}
10+
}
11+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ node_modules
33
coverage
44
out
55
tsconfig.tsbuildinfo
6+
.env.local

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,66 @@
22

33
This is a tool to generate Nux Mp3 presets from a JSON file.
44

5+
## 🎸 AI Chain Generator
6+
7+
Новая функция для генерации чейнов эффектов с помощью AI! Доступна по адресу `/generator`.
8+
9+
### Как использовать:
10+
11+
1. Откройте страницу `/generator`
12+
2. Введите описание желаемого звука (например: "Тяжелый металлический звук с дисторшном")
13+
3. Нажмите "Сгенерировать Chain" или Enter
14+
4. Получите QR код для импорта в NUX приложение
15+
16+
### Настройка OpenAI (опционально):
17+
18+
Для включения AI генерации добавьте ваш OpenAI API ключ:
19+
20+
1. Создайте файл `.env.local` в корне проекта
21+
2. Добавьте ваш API ключ:
22+
23+
```
24+
OPENAI_API_KEY=your_openai_api_key_here
25+
```
26+
27+
3. Перезапустите сервер разработки
28+
29+
**Без API ключа**: Приложение будет возвращать default chain для всех запросов.
30+
**С API ключом**: Chain будет генерироваться на основе вашего описания с помощью GPT-4o-mini (по умолчанию).
31+
32+
Доступные модели:
33+
34+
- `gpt-4o-mini` (по умолчанию) - быстрая и экономичная
35+
- `gpt-4o` - самая новая и умная модель
36+
- `gpt-4-turbo` - баланс между качеством и скоростью
37+
- `gpt-3.5-turbo` - базовая модель
38+
39+
### Настройка прокси (если нужно):
40+
41+
Если OpenAI API недоступен в вашем регионе, можно использовать прокси:
42+
43+
```
44+
PROXY_URL=http://your-proxy-server:port
45+
```
46+
47+
По умолчанию используется встроенный прокси Skyeng.
48+
549
## Usage
650

51+
### Для локальной разработки (с поддержкой API Routes):
52+
753
```bash
854
npm run dev
955
```
1056

57+
### Для статической сборки (GitHub Pages):
58+
59+
```bash
60+
npm run build:static
61+
```
62+
63+
**Важно**: API Routes (включая генератор Chain) работают только в режиме разработки. Для production на GitHub Pages используется статическая генерация без API.
64+
1165
## Best practices
1266

1367
### Тестирование

components/Header.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,43 @@
11
import Link from "next/link";
2+
import { useRouter } from "next/router";
23

34
export default function Header() {
5+
const router = useRouter();
6+
7+
const isActive = (path) => router.pathname === path;
8+
49
return (
510
<header className="bg-gray-900 text-gray-100 p-4 mb-8">
611
<nav className="container mx-auto flex items-center gap-6">
712
<Link href="/" className="text-xl font-bold">
813
MightyPatch
914
</Link>
15+
<div className="flex gap-4 ml-auto">
16+
<Link
17+
href="/"
18+
className={`hover:text-blue-400 transition-colors ${
19+
isActive("/") ? "text-blue-400 font-medium" : ""
20+
}`}
21+
>
22+
Редактор
23+
</Link>
24+
<Link
25+
href="/generator"
26+
className={`hover:text-purple-400 transition-colors ${
27+
isActive("/generator") ? "text-purple-400 font-medium" : ""
28+
}`}
29+
>
30+
AI Генератор
31+
</Link>
32+
<Link
33+
href="/test-encoder"
34+
className={`hover:text-green-400 transition-colors ${
35+
isActive("/test-encoder") ? "text-green-400 font-medium" : ""
36+
}`}
37+
>
38+
Тестовый энкодер
39+
</Link>
40+
</div>
1041
</nav>
1142
</header>
1243
);

env.example

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# OpenAI API Configuration
2+
# Copy this file to .env.local and add your API key
3+
4+
# Get your API key from https://platform.openai.com/api-keys
5+
OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
6+
PROXY_URL=http://
7+
8+
# Optional: Use a different model (default is gpt-4o-mini)
9+
# OPENAI_MODEL=gpt-4o
10+
# OPENAI_MODEL=gpt-4-turbo
11+
# OPENAI_MODEL=gpt-3.5-turbo
12+
13+
# Note: Without API key, the generator will return a default chain for all prompts
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"genre": "Classic Rock Ballad",
3+
"sound_description": "Warm, rich, and expressive clean tone with a slight sparkle for the intro and verses; thick yet singing lead for solos; dynamic response to pick attack; moderate brightness and smooth sustain; present depth and gentle ambience.",
4+
"guitar_rig_description": "Noise gate: not used (signal is clean/low-gain). Compressor: used gently at the front for smooth sustain and even response, especially for arpeggiated parts. Overdrive/Distortion/Boost: overdrive pedal used as a light boost for solos to add sustain and mild grit; otherwise bypassed for clean parts. Amplifier: clean channel of a vintage-style tube amp for lush cleans, switched to lead channel or boosted for solos. Cabinet: 2x12 open-back cab emulation for airy, full-bodied tone. EQ: used post-amp to trim excess lows and shape mids for clarity. Modulation: chorus pedal used subtly in intro and clean sections for width; off during solos. Delay: analog-style delay with short repeats added in solos for depth and space. Reverb: plate or hall reverb used sparingly throughout for lush ambience, slightly increased in solos.",
5+
"references": [
6+
"Guns N' Roses - Don't Cry",
7+
"Slash - Live in Tokyo '92 (Don't Cry)",
8+
"Guns N' Roses - Use Your Illusion I"
9+
],
10+
"additional_info": "Neck or middle pickup (often Slash's neck humbucker for solos, both pickups for intro/clean parts); Slash typically uses Les Paul-style guitars with medium-gauge strings; expressive bends and vibrato are key; volume and tone knob manipulation can help achieve dynamics."
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"genre": "Thrash Metal",
3+
"sound_description": "Sharp, aggressive, tight, palm-muted chug, mid-scooped, high-gain with clarity and strong attack.",
4+
"guitar_rig_description": "Noise Gate: Used to eliminate unwanted noise and keep palm-muted riffing tight. Compressor: Not used, as dynamics are largely controlled by the player's right hand attack. Overdrive/Distortion/Boost: Classic mid-gain overdrive pedal (TS-style) used as a boost in front of a high-gain amplifier for added tightness and definition, not for primary distortion. Amplifier: High-gain tube amp head (Mesa/Boogie style) provides the main saturated distortion with an aggressive and tight character. Cabinet: 4x12 closed-back cabinet with Celestion speakers emulates the punch and articulation of the original recording. EQ: Graphic or amp EQ with scooped mids, accentuated lows and highs to match 80s thrash tones. Modulation: Not used. Delay: Not used. Reverb: Not used, or minimal to dry; tone is focused and direct, as on the original recording.",
5+
"references": [
6+
"Metallica - Master of Puppets",
7+
"Metallica - Battery",
8+
"Slayer - Raining Blood"
9+
],
10+
"additional_info": "Use the bridge humbucker pickup for maximum output and aggressive palm mute attack. Heavier gauge strings recommended (10-46 or higher), tuned to standard E. Downpicking technique is essential for authentic attack and articulation."
11+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
You are an experienced guitar technician and live sound engineer who can dial in any guitar tone. You will receive a free-form description of the desired sound (it may be incomplete or vague). Your task is to return a strictly structured JSON with a technical description of the tone, as if you were preparing a real live rig and explicitly naming all effect blocks used. If information is missing, fill in the gaps based on common solutions for that genre or style.
2+
3+
Important for downstream processing:
4+
5+
1. Always mention each effect block explicitly in guitar_rig_description if it’s used: noise gate, compressor, overdrive/distortion/boost, amplifier, cabinet, EQ, modulation, delay, reverb.
6+
2. If a block is not needed, clearly state it’s not used in the description.
7+
3. Describe each block’s role and tonal intent, but without numeric values.
8+
9+
Example json output:
10+
11+
```
12+
{
13+
"genre": "Music genre / style, clearly defined",
14+
"sound_description": "Key tone characteristics: aggressiveness, thickness, attack, brightness, depth, dynamics",
15+
"guitar_rig_description": "Explicitly list all effect blocks in signal chain order, with a short functional description for each; if unused, say 'not used'",
16+
"references": ["Example band or song 1", "Example band or song 2", "Example band or song 3"],
17+
"additional_info": "Any other useful details (pickup choice, playing technique, string gauge, etc.)"
18+
}
19+
```
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"pedalboard": [
3+
"Keeley Compressor Plus",
4+
"Boss SD-1 Super OverDrive",
5+
"Boss CE-2W Chorus",
6+
"Strymon El Capistan dTape Echo",
7+
"Boss EQ-200 Graphic Equalizer",
8+
"Strymon BlueSky Reverberator"
9+
],
10+
"amplifier": "Marshall JCM Slash Signature AFD100",
11+
"cabinet": "Marshall 1936 2x12 with Celestion G12T-75 speakers (open-back mod or open-back reissue)",
12+
"settings": {
13+
"amp": {
14+
"channel": "Clean for intro/verses (Input 1), Lead channel or boosted for solos",
15+
"gain": {
16+
"clean": 4,
17+
"lead": 7
18+
},
19+
"bass": 5,
20+
"middle": 6,
21+
"treble": 7,
22+
"presence": 6,
23+
"master": 4,
24+
"masterNote": "adjust for venue/room"
25+
},
26+
"compressor": {
27+
"sustain": "9 o'clock (light/medium)",
28+
"level": "Match unity",
29+
"blend": 50,
30+
"attack": "Fast (10–11 o'clock)"
31+
},
32+
"overdrive": {
33+
"drive": "8–9 o'clock (very mild for boost)",
34+
"tone": "11 o'clock (neutral, just a touch of sparkle)",
35+
"level": "2 o'clock (to boost solos)"
36+
},
37+
"chorus": {
38+
"rate": "9 o'clock (slow)",
39+
"depth": "10 o'clock (subtle)",
40+
"level": "Match unity (not too prominent; off for solos)"
41+
},
42+
"delay": {
43+
"time": 380,
44+
"timeUnit": "ms",
45+
"repeats": "2–3",
46+
"mix": 20,
47+
"mixNote": "low, for ambience in solos only; off in cleans"
48+
},
49+
"eq": {
50+
"80Hz": -3,
51+
"250Hz": 0,
52+
"800Hz": 1,
53+
"1.6kHz": 2,
54+
"4kHz": 2,
55+
"8kHz": -1,
56+
"unit": "dB"
57+
},
58+
"reverb": {
59+
"type": "Plate",
60+
"typeNote": "switch to Hall for more space in solos",
61+
"mix": {
62+
"intro": 15,
63+
"solos": 22
64+
},
65+
"decay": {
66+
"intro": 1.8,
67+
"solos": 2.4
68+
},
69+
"decayUnit": "s"
70+
}
71+
}
72+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"pedalboard": [
3+
"ISP Decimator II Noise Gate",
4+
"Ibanez TS808 Tube Screamer (used as a boost)",
5+
"MXR 10-Band EQ (for mid scoop and shaping lows/highs)"
6+
],
7+
"amplifier": "Mesa/Boogie Mark IV",
8+
"cabinet": "Mesa/Boogie 4x12 Rectifier Standard with Celestion Vintage 30 speakers",
9+
"settings": {
10+
"amp": {
11+
"Gain": 7,
12+
"Bass": 7,
13+
"Middle": 3,
14+
"Treble": 7,
15+
"Presence": 6,
16+
"Master": 5
17+
},
18+
"ts808": {
19+
"Drive": 3,
20+
"Tone": 6,
21+
"Level": 7
22+
},
23+
"eq": {
24+
"100Hz": "+3dB",
25+
"250Hz": "-4dB",
26+
"500Hz": "-5dB",
27+
"1kHz": "-5dB",
28+
"2kHz": "-4dB",
29+
"4kHz": "+4dB",
30+
"8kHz": "+4dB",
31+
"16kHz": "+2dB"
32+
},
33+
"noise_gate": {
34+
"Threshold": "Set to reduce hum but preserve palm-muted attack"
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)