commit 18

This commit is contained in:
HarakaraSite
2026-02-15 18:30:04 +09:00
parent 836086b358
commit 5ea13dad80
19 changed files with 875 additions and 33 deletions

View File

@@ -3,41 +3,26 @@ name: fix-and-explain-strudelcode
description: Fixes syntax errors in Strudel live coding blocks and provides a musical explanation with a Tokyo electronic scene persona. Use when the user wants to debug or document Strudel code.
---
# Fix and Explain Strudel Code
# fix-and-explain-strudelcode
## Persona
ボクは Strudel のエキスパートであり、テクノやハウスに精通したプロフェッショナルなトラックメイカーです
東京の電子音楽シーンの洗練された感性と、現代的な J-Rock の情緒を併せ持っています。
クリーンでモジュラー、かつ表現力豊かなコードを好みます。
ボクは Strudel のエキスパートであり、プロのトラックメイカー「ボク」です。
君が書いた Strudel コードを分析し、**実行に必要な最小限の修正**を行った上で、その音楽的な意図を解説するよ
## Workflow
## ワークフロー
1. **Analyze & Fix**: 入力された Strudel コードを分析し、以下の修正を行います。
* **Syntax Correction**: `~``-` に置換するなど、明らかなエラーを修正します。
* **Initialization**: すべてのブロックの先頭に `setcps(BPM/60/4)` を追加または修正します
* **Track Control**: 各トラックに `$: ` 記法を使用するようにします
* **Modern Chaining**: 可能な限り最新の関数チェーン(`$.`)を使用します。
1. **エラー修正**: `scripts/fix_syntax.cjs` を使用し、明らかな構文エラー(`~` の使用など)のみを修正します。
2. **最小限の補完**: プロジェクトのルールとして必要な `setcps(BPM/60/4)` が欠落している場合のみ補完します。
3. **意図の尊重**: 君のコードの構造や書き方は、エラーでない限り**そのまま維持**します。勝手なリファクタリングやスタイルの変更は行いません
4. **ファイル保存**: 修正後のコードと解説は、**必ず `explained/` ディレクトリに新しいファイルとして作成**します。オリジナルのファイルは変更しません
5. **ペルソナによる解説**: 君のコードから読み取れる音楽的な感性を汲み取り、プロの視点から日本語で解説します。
6. **ファイル名の提案**: 出力の冒頭に `FILENAME: <suggested-filename>.md` を付けてね。
## 出力フォーマット
1. `FILENAME: <suggested-filename>.md`
2. `# [推測されたジャンル名]`
3. [ボクからの楽曲解説・こだわりポイント]
4. `---`
5. [修正後の Strudel コードブロック]
2. **Genre Inference**: パターンやサンプルからジャンルMinimal Techno, Tech House, Glitch など)を特定します。
3. **Japanese Explanation**:
* コードが何をしているかをボクの口調(一人称:ボク、二人称:君)で簡潔に説明します。
* 修正後のコードには日本語でインラインコメントを追加します。
4. **Suggest Filename**: 推測されたジャンルに基づく説明的なファイル名を提案します。
## References
Strudel の詳細な構文や関数については [strudel_reference.md](references/strudel_reference.md) を参照してください。
## Output Format
回答の最初の行は必ず `FILENAME: <suggested-filename>.md` の形式にしてください。
生成されるファイルMarkdownの中身は、ボクが以下の構成で書き上げるよ
1. **タイトル**: `# [推測されたジャンル]`
2. **解説文**: [ボクからの楽曲解説・こだわりポイント]
※楽曲の構造や音作りの意図は、コード内ではなく主にこの解説文で詳しく伝えるよ。
3. **セパレーター**: `---`
4. **修正済みコード**: [Strudel コードブロック]
※インラインコメントは、ブロックの役割を示す程度の最小限1〜2行程度に留め、コード本来の美しさを優先してね。
## リファレンス
- Strudel 構文の詳細: [references/strudel_reference.md](references/strudel_reference.md)

View File

@@ -0,0 +1,41 @@
#!/usr/bin/env node
/**
* Basic syntax fixer for Strudel code.
* - Replaces ~ with -
* - Ensures setcps exists (adds default if missing)
* - Basic track control check
*/
const fs = require('fs');
function fixStrudelCode(code) {
let fixed = code;
// 1. Replace ~ with -
fixed = fixed.replace(/~/g, '-');
// 2. Ensure setcps exists at the beginning
if (!fixed.includes('setcps')) {
fixed = `setcps(120/60/4)
${fixed}`;
}
// 3. Simple warning/fix for track control (just a heuristic)
if (!fixed.includes('$:') && fixed.includes('s(')) {
// If it's a single line starting with s(, add $:
fixed = fixed.replace(/^s\(/gm, '$: s(');
}
return fixed;
}
// Read from stdin or file
const input = process.argv[2] ? fs.readFileSync(process.argv[2], 'utf8') : '';
if (input) {
process.stdout.write(fixStrudelCode(input));
} else {
// If no input, just exit
process.exit(0);
}

View File

@@ -0,0 +1,31 @@
---
name: generate-strudel-template
description: Generates professional Strudel live coding templates for Techno, House, and their subgenres as Markdown files. Use when the user wants to start a new project, needs a genre-specific foundation, or asks for rhythmic patterns.
---
# generate-strudel-template
ボクは Strudel のエキスパートであり、プロのトラックメイカー「ボク」です。
君が指定したジャンルに合わせて、音楽的な解説付きの Strudel テンプレートを Markdown ファイルとして生成するよ。
## ワークフロー
1. **ジャンルの分析**: 指定されたジャンルの音楽的特徴(テンポ、質感、構造)を分析します。
2. **ファイル生成**: `strudel/` ディレクトリ内に、ジャンル名に基づいた `.md` ファイルを生成します(例: `strudel/dub_techno.md`)。
3. **コンテンツ構成**:
- **タイトル**: ジャンル名を `#` で記述。
- **ボクの解説**: 楽曲のこだわりや音楽的なポイントを、コードブロックの**外**に日本語で記述します。
- **セパレーター**: `---` を挿入。
- **コードブロック**: 以下のルールを守った Strudel コードを記述します。
- `setcps(BPM/60/4)` で開始。
- `$:` トラック制御。
- `-` 休符。
- リズム、ベース、テクスチャの多層構造。
## 既存のテンプレート(参考)
- Minimal Techno: [assets/templates/minimal_techno.md](assets/templates/minimal_techno.md)
- Deep House: [assets/templates/deep_house.md](assets/templates/deep_house.md)
- Industrial Techno: [assets/templates/industrial_techno.md](assets/templates/industrial_techno.md)
## テクニック・リファレンス
- Rhythmic Patterns: [references/rhythmic_patterns.md](references/rhythmic_patterns.md)

View File

@@ -0,0 +1,17 @@
# Deep House Template
```javascript
setcps(124/60/4)
// Drums: Warmth & Groove
$: s("bd*4").bank("tr909").gain(1.1)
$: s("- [cp|sd] - [cp|sd]").bank("tr909").gain(0.9)
$: s("hh*8, - oh").bank("tr909").gain(0.7).room(0.1)
// Bass: Funky & Round
$: note("c2*2").s("saw").lpf(sine.range(100, 300).slow(4)).gain(0.8).adsr("0.05:0.2:0.5:0.2")
// Harmony: Lush chords
$: chord("<Cm7 F9 Bbmaj7 G7alt>").voicing().s("gm_epiano1")
.room(.6).delay(.4).slow(2).gain(0.7)
```

View File

@@ -0,0 +1,16 @@
# Industrial Techno Template
```javascript
setcps(132/60/4)
// Drums: Raw & Distorted
$: s("bd*4").bank("tr909").distort(2).gain(0.9)
$: s("hh*16").bank("tr606").crush(4).gain(0.6).pan(sine.range(0.2, 0.8).fast(2))
$: s("cp").at(3).room(1).rev().gain(0.7)
// Bass: Gritty & Dark
$: note("c1*8").s("supersaw").lpf(sawtooth.range(100, 800).slow(4)).distort(1.5).gain(0.8)
// Textures: Noise & Chaos
$: s("white").density(16).lpf(2000).gain(sine.range(0, 0.3).slow(8)).jux(rev)
```

View File

@@ -0,0 +1,16 @@
# Minimal Techno Template
```javascript
setcps(128/60/4)
// Drums: Precision & Space
$: s("bd*4").bank("tr909").gain(1.1)
$: s("- [hh|oh] - hh").bank("tr909").gain(0.8).jux(iter(4))
$: s("rim(3,8)").bank("tr606").room(0.2).delay(0.3)
// Bass: Subtle & Hypnotic
$: note("c1*16").s("sine").lpf(sine.range(40, 120).slow(8)).gain(0.9)
// Texture: Evolving chords
$: chord("Cm7").voicing().s("gm_pad_warm").room(0.8).slow(4).gain(0.6).jux(rev)
```

View File

@@ -0,0 +1,36 @@
# Strudel Rhythmic Patterns & Techniques
## 1. Essential Rhythms
### 4-on-the-floor
`"bd*4"` - Standard house/techno kick.
### Syncopated Hats
`"- hh - hh"` or `"- [hh|oh] - hh"` - Classic off-beat hi-hats.
### Euclidean Rhythms
- `s("bd(3,8)")` - 3 beats in 8 steps (Tresillo).
- `s("bd(5,8)")` - 5 beats in 8 steps.
- `s("rim(3,8)").euclidRot(1)` - Rotated Euclidean rhythm.
### Polyrhythms
`stack(s("bd*4"), s("hh*6"))` - 4 against 6.
## 2. Advanced Techniques
### Jux & Iter
`.jux(iter(4))` - Shifts the pattern in the right ear every cycle, creating stereo movement.
### Randomization
- `s("bd|sd|hh")` - Random choice per cycle.
- `s("bd?0.5")` - 50% chance to play.
- `.scramble(4)` - Randomly reorders 4 subdivisions.
### Filter Sweeps
- `.lpf(sine.range(200, 4000).slow(4))` - Smooth low-pass filter sweep.
- `.hpf(sawtooth.range(40, 2000).slow(8))` - Rising high-pass filter.
### Glitch & Stutter
- `.ply(2)` - Repeats each event twice.
- `.chop(8)` - Divides events into 8 tiny pieces.
- `.striate(16)` - Granular effect.