Files
code-sinth/examples/pad.patch
Jose Luis Montañes 7debc7436e initial: code-sinth — DSL-driven modular synth (Python engine + web app)
Patch language with osc/noise/trig/seq/adsr/filter/delay/poly + voice templates
and inline live values. Two runtimes:

- code_sinth/ — Python engine (numpy + sounddevice). Hot-reload via mtime
  watcher. Offline render to WAV. Static-HTTP+WS visualizer (viz/) that
  injects waveforms next to each `node X = ...` line.
- web/ — port of the engine to JS running in AudioWorklet. Single static
  page with CodeMirror 6 editor (line widgets for live waveforms) and a
  control surface on the right with knobs/faders/step_seq/piano_roll
  declared from the patch. State preserved across hot-reload.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 17:37:06 +02:00

26 lines
778 B
Diff

# Pad polifonico. Cada voz tiene dos saws desafinados, env con release largo, LP suave.
# rate=4 (250ms/nota) con gate_duration=0.6 -> notas se solapan. voices=8 cubre el stack.
voice pad {
node o1 = osc(saw, freq=freq)
node o2 = osc(saw, freq=freq * 1.005)
node sum = (o1 + o2) * 0.5
node env = adsr(a=0.06, d=0.3, s=0.5, r=1.2, gate=gate)
node lp = filter(lp, in=sum, cutoff=400 + env*1500, q=1.2)
out <- lp * env
}
# Progresion en C: Cmaj - Am - Fmaj - Gmaj, 4 notas por acorde.
node p = poly(
voice=pad, voices=8,
rate=4, gate_duration=0.6,
notes=[
261.63, 329.63, 392.00, 523.25,
220.00, 261.63, 329.63, 440.00,
174.61, 220.00, 261.63, 349.23,
196.00, 246.94, 293.66, 392.00
]
)
out <- p * 0.18