From 39843ae95c4403b6db26ac90f680f2a65bbe6b97 Mon Sep 17 00:00:00 2001 From: Aqua Date: Wed, 4 Nov 2026 13:38:49 +0000 Subject: [PATCH 1/3] Add static in-browser playground for AquaSynth patches tools/AquaLower lowers .aqua to Faust (FaustEmitter.EmitScript); tools/aqua-playground compiles the lowered Faust to wasm with @grame/faustwasm in the page and plays it through an AudioWorklet, with sliders from the DSP's UI and the Faust source shown. Thruster plus 41 .aqua patches. Headless node test compiles and renders every patch (non-silent, finite). Co-Authored-By: Claude Sonnet 5.5 --- tools/AquaLower/AquaLower.csproj | 15 + tools/AquaLower/Program.cs | 35 ++ tools/aqua-playground/.gitignore | 2 + tools/aqua-playground/README.md | 28 ++ tools/aqua-playground/build.mjs | 18 ++ tools/aqua-playground/lower.sh | 13 + tools/aqua-playground/lowered/808-clap.dsp | 76 +++++ tools/aqua-playground/lowered/808-cowbell.dsp | 65 ++++ tools/aqua-playground/lowered/808-hat.dsp | 65 ++++ tools/aqua-playground/lowered/808-kick.dsp | 54 ++++ tools/aqua-playground/lowered/808-snare.dsp | 65 ++++ tools/aqua-playground/lowered/808-tom.dsp | 54 ++++ .../advanced-alien-multivalve-graph.dsp | 231 ++++++++++++++ .../lowered/advanced-aurora-pad.dsp | 87 +++++ .../lowered/advanced-bird-syrinx-graph.dsp | 238 ++++++++++++++ .../lowered/advanced-bird-syrinx.dsp | 253 +++++++++++++++ .../lowered/advanced-glass-creature.dsp | 98 ++++++ .../lowered/advanced-human-larynx-graph.dsp | 185 +++++++++++ .../lowered/advanced-machine-breath.dsp | 87 +++++ .../lowered/advanced-ritual-sequence.dsp | 87 +++++ .../lowered/advanced-subtractive-drums.dsp | 98 ++++++ .../lowered/advanced-syrinx-voice.dsp | 238 ++++++++++++++ .../lowered/bfxr-coin-spark.dsp | 65 ++++ .../lowered/bfxr-portal-chirp.dsp | 65 ++++ .../lowered/bfxr-shield-pop.dsp | 65 ++++ .../aqua-playground/lowered/bfxr-ui-bloom.dsp | 65 ++++ tools/aqua-playground/lowered/catalog.json | 300 ++++++++++++++++++ .../dx7-algorithm-32-additive-organ.dsp | 112 +++++++ .../lowered/dx7-algorithm-8-bright-pair.dsp | 77 +++++ .../lowered/dx7-public-domain-mc-mm-5-3.dsp | 54 ++++ ...x7-public-domain-prc-synth1-calibrated.dsp | 52 +++ .../lowered/examples-language-tour.dsp | 76 +++++ .../aqua-playground/lowered/fm-bell-bell.dsp | 65 ++++ .../aqua-playground/lowered/fm-bell-chime.dsp | 65 ++++ .../aqua-playground/lowered/fm-bell-coin.dsp | 65 ++++ .../aqua-playground/lowered/fm-bell-gong.dsp | 65 ++++ tools/aqua-playground/lowered/sfxr-blip.dsp | 54 ++++ ...fxr-classic-classic-sfxr-abstract-golf.dsp | 120 +++++++ .../lowered/sfxr-explosion.dsp | 54 ++++ tools/aqua-playground/lowered/sfxr-hit.dsp | 54 ++++ tools/aqua-playground/lowered/sfxr-jump.dsp | 54 ++++ tools/aqua-playground/lowered/sfxr-laser.dsp | 54 ++++ tools/aqua-playground/lowered/sfxr-pickup.dsp | 54 ++++ .../aqua-playground/lowered/sfxr-powerup.dsp | 54 ++++ tools/aqua-playground/lowered/thruster.dsp | 29 ++ .../lowered/wobble-bass-growl.dsp | 65 ++++ .../lowered/wobble-bass-neuro.dsp | 65 ++++ .../lowered/wobble-bass-talker.dsp | 65 ++++ .../lowered/wobble-bass-yoy.dsp | 65 ++++ tools/aqua-playground/package-lock.json | 35 ++ tools/aqua-playground/package.json | 13 + tools/aqua-playground/test.mjs | 49 +++ tools/aqua-playground/web/app.js | 91 ++++++ tools/aqua-playground/web/index.html | 38 +++ tools/aqua-playground/web/styles.css | 19 ++ tools/aqua-playground/web/ui.mjs | 17 + 56 files changed, 4332 insertions(+) create mode 100644 tools/AquaLower/AquaLower.csproj create mode 100644 tools/AquaLower/Program.cs create mode 100644 tools/aqua-playground/.gitignore create mode 100644 tools/aqua-playground/README.md create mode 100644 tools/aqua-playground/build.mjs create mode 100755 tools/aqua-playground/lower.sh create mode 100644 tools/aqua-playground/lowered/808-clap.dsp create mode 100644 tools/aqua-playground/lowered/808-cowbell.dsp create mode 100644 tools/aqua-playground/lowered/808-hat.dsp create mode 100644 tools/aqua-playground/lowered/808-kick.dsp create mode 100644 tools/aqua-playground/lowered/808-snare.dsp create mode 100644 tools/aqua-playground/lowered/808-tom.dsp create mode 100644 tools/aqua-playground/lowered/advanced-alien-multivalve-graph.dsp create mode 100644 tools/aqua-playground/lowered/advanced-aurora-pad.dsp create mode 100644 tools/aqua-playground/lowered/advanced-bird-syrinx-graph.dsp create mode 100644 tools/aqua-playground/lowered/advanced-bird-syrinx.dsp create mode 100644 tools/aqua-playground/lowered/advanced-glass-creature.dsp create mode 100644 tools/aqua-playground/lowered/advanced-human-larynx-graph.dsp create mode 100644 tools/aqua-playground/lowered/advanced-machine-breath.dsp create mode 100644 tools/aqua-playground/lowered/advanced-ritual-sequence.dsp create mode 100644 tools/aqua-playground/lowered/advanced-subtractive-drums.dsp create mode 100644 tools/aqua-playground/lowered/advanced-syrinx-voice.dsp create mode 100644 tools/aqua-playground/lowered/bfxr-coin-spark.dsp create mode 100644 tools/aqua-playground/lowered/bfxr-portal-chirp.dsp create mode 100644 tools/aqua-playground/lowered/bfxr-shield-pop.dsp create mode 100644 tools/aqua-playground/lowered/bfxr-ui-bloom.dsp create mode 100644 tools/aqua-playground/lowered/catalog.json create mode 100644 tools/aqua-playground/lowered/dx7-algorithm-32-additive-organ.dsp create mode 100644 tools/aqua-playground/lowered/dx7-algorithm-8-bright-pair.dsp create mode 100644 tools/aqua-playground/lowered/dx7-public-domain-mc-mm-5-3.dsp create mode 100644 tools/aqua-playground/lowered/dx7-public-domain-prc-synth1-calibrated.dsp create mode 100644 tools/aqua-playground/lowered/examples-language-tour.dsp create mode 100644 tools/aqua-playground/lowered/fm-bell-bell.dsp create mode 100644 tools/aqua-playground/lowered/fm-bell-chime.dsp create mode 100644 tools/aqua-playground/lowered/fm-bell-coin.dsp create mode 100644 tools/aqua-playground/lowered/fm-bell-gong.dsp create mode 100644 tools/aqua-playground/lowered/sfxr-blip.dsp create mode 100644 tools/aqua-playground/lowered/sfxr-classic-classic-sfxr-abstract-golf.dsp create mode 100644 tools/aqua-playground/lowered/sfxr-explosion.dsp create mode 100644 tools/aqua-playground/lowered/sfxr-hit.dsp create mode 100644 tools/aqua-playground/lowered/sfxr-jump.dsp create mode 100644 tools/aqua-playground/lowered/sfxr-laser.dsp create mode 100644 tools/aqua-playground/lowered/sfxr-pickup.dsp create mode 100644 tools/aqua-playground/lowered/sfxr-powerup.dsp create mode 100644 tools/aqua-playground/lowered/thruster.dsp create mode 100644 tools/aqua-playground/lowered/wobble-bass-growl.dsp create mode 100644 tools/aqua-playground/lowered/wobble-bass-neuro.dsp create mode 100644 tools/aqua-playground/lowered/wobble-bass-talker.dsp create mode 100644 tools/aqua-playground/lowered/wobble-bass-yoy.dsp create mode 100644 tools/aqua-playground/package-lock.json create mode 100644 tools/aqua-playground/package.json create mode 100644 tools/aqua-playground/test.mjs create mode 100644 tools/aqua-playground/web/app.js create mode 100644 tools/aqua-playground/web/index.html create mode 100644 tools/aqua-playground/web/styles.css create mode 100644 tools/aqua-playground/web/ui.mjs diff --git a/tools/AquaLower/AquaLower.csproj b/tools/AquaLower/AquaLower.csproj new file mode 100644 index 0000000..6c55fc0 --- /dev/null +++ b/tools/AquaLower/AquaLower.csproj @@ -0,0 +1,15 @@ + + + + Exe + net10.0 + enable + enable + false + + + + + + + diff --git a/tools/AquaLower/Program.cs b/tools/AquaLower/Program.cs new file mode 100644 index 0000000..6f0b113 --- /dev/null +++ b/tools/AquaLower/Program.cs @@ -0,0 +1,35 @@ +using System.Text.Json; +using AquaSynth.Dsl; + +// Lowers .aqua patches to Faust source for the static playground (tools/aqua-playground). +// usage: AquaLower = ... +// A .aqua entry goes through FaustEmitter.EmitScript, the same lowering the daemon uses; a .dsp entry +// (the thruster) is already Faust and is copied verbatim. Writes /.dsp, and +// catalog.json for the browser (the one non-CultNet xeno at this boundary). +if (args.Length < 3) { Console.Error.WriteLine("usage: AquaLower = ..."); return 2; } +var outDir = Path.GetFullPath(args[0]); +var root = Path.GetFullPath(args[1]); +Directory.CreateDirectory(outDir); +var entries = new List(); +foreach (var spec in args.Skip(2)) +{ + var eq = spec.IndexOf('='); + var name = spec[..eq]; + var rel = spec[(eq + 1)..]; + var path = Path.Combine(root, rel); + var text = File.ReadAllText(path); + string source; + var warnings = new List(); + if (path.EndsWith(".aqua", StringComparison.Ordinal)) + { + var export = FaustEmitter.EmitScript(text, new FaustExportOptions(name)); + source = export.Source; + warnings.AddRange(export.Warnings); + } + else source = text; + File.WriteAllText(Path.Combine(outDir, name + ".dsp"), source); + entries.Add(new { name, origin = rel.Replace('\\', '/'), kind = path.EndsWith(".aqua", StringComparison.Ordinal) ? "aqua" : "faust", dsp = name + ".dsp", warnings }); + Console.WriteLine($"{name}: {source.Length} chars from {rel}, {warnings.Count} warnings"); +} +File.WriteAllText(Path.Combine(outDir, "catalog.json"), JsonSerializer.Serialize(entries, new JsonSerializerOptions { WriteIndented = true })); +return 0; diff --git a/tools/aqua-playground/.gitignore b/tools/aqua-playground/.gitignore new file mode 100644 index 0000000..b947077 --- /dev/null +++ b/tools/aqua-playground/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +dist/ diff --git a/tools/aqua-playground/README.md b/tools/aqua-playground/README.md new file mode 100644 index 0000000..720915b --- /dev/null +++ b/tools/aqua-playground/README.md @@ -0,0 +1,28 @@ +# AquaSynth Playground + +Static, serverless audition page for AquaSynth patches. Pick a patch, read the Faust it lowers to, +move the sliders the DSP itself declares, press Play. + +**What is live:** 42 patches (`catalog.json`): the hand-written Faust `thruster` (with its `rpm` +control) and 41 of the 43 `.aqua` files, lowered by `tools/AquaLower` through `FaustEmitter.EmitScript` +(the lowering the daemon uses). Faust is compiled to WebAssembly in the page +(`@grame/faustwasm` 0.20.0, libfaust 2.90), played through an AudioWorklet, and the lowered source +is shown in an editable box with a Recompile button. + +**What it is not:** `.aqua` is lowered ahead of time (`lowered/`), not in the page; editing Faust works, +editing `.aqua` does not. `advanced/additive-pad` and `advanced/electro-drop-demo` lower to ~1.5 MB of +Faust each and are left out. One-shot patches sound once per Play press and mostly declare no +controls, so their slider panel is empty. + +## Entry points + +- `lower.sh`: regenerate `lowered/*.dsp` and `catalog.json` (needs .NET SDK and `CULTLIB_ROOT`). +- `node build.mjs [outDir]`: assemble the site in `dist/` (run `npm install` first). +- `node test.mjs [dist]`: headless check of `dist/`: each patch compiles to wasm, renders 2 s + offline, is non-silent and finite; the thruster is also run at rpm 600 and 4800. + It cannot hear and does not run an AudioWorklet or a browser. +- `web/`: the page (`index.html`, `app.js`, `ui.mjs`, `styles.css`). + +Serve `dist/` from any static host (`python3 -m http.server`); AudioWorklet needs `localhost` or https. +The older `tools/vocal-tract-playground` renders server-side through the .NET renderer; this one +does not need a server. diff --git a/tools/aqua-playground/build.mjs b/tools/aqua-playground/build.mjs new file mode 100644 index 0000000..e23a87c --- /dev/null +++ b/tools/aqua-playground/build.mjs @@ -0,0 +1,18 @@ +// Assembles dist/ (the static site): web/, lowered/ patches + catalog.json, and the faustwasm runtime +// (ESM wrapper + libfaust wasm) copied from node_modules. Usage: node build.mjs [outDir] +import { cpSync, mkdirSync, rmSync } from "node:fs"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +const here = dirname(fileURLToPath(import.meta.url)); +const out = resolve(process.argv[2] ?? join(here, "dist")); +const fw = join(here, "node_modules/@grame/faustwasm"); +rmSync(out, { recursive: true, force: true }); +mkdirSync(join(out, "vendor/faustwasm"), { recursive: true }); +cpSync(join(here, "web"), out, { recursive: true }); +cpSync(join(here, "lowered"), out, { recursive: true }); +cpSync(join(fw, "dist/esm/index.js"), join(out, "vendor/faustwasm/index.js")); +cpSync(join(fw, "COPYING.txt"), join(out, "vendor/faustwasm/COPYING.txt")); +for (const f of ["libfaust-wasm.js", "libfaust-wasm.wasm", "libfaust-wasm.data"]) + cpSync(join(fw, "libfaust-wasm", f), join(out, "vendor/libfaust-wasm", f)); +console.log(`built ${out}`); diff --git a/tools/aqua-playground/lower.sh b/tools/aqua-playground/lower.sh new file mode 100755 index 0000000..bff324a --- /dev/null +++ b/tools/aqua-playground/lower.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# Regenerates lowered/*.dsp and catalog.json from patches/ through the AquaLower tool (needs the .NET SDK +# and a CultLib checkout at the admitted revision: set CULTLIB_ROOT). The two largest patches +# (additive-pad, electro-drop-demo lower to about 1.5 MB of Faust each) stay out of the catalog. +set -euo pipefail +cd "$(dirname "$0")/../.." +entries=(thruster=thruster/thruster.dsp) +while IFS= read -r rel; do + case "$rel" in advanced/additive-pad.aqua|advanced/electro-drop-demo.aqua) continue;; esac + name=$(echo "${rel%.aqua}" | tr '/' '-') + entries+=("$name=$rel") +done < <(cd patches && find . -name '*.aqua' | sed 's|^\./||' | sort) +dotnet run -c Release --project tools/AquaLower -- tools/aqua-playground/lowered patches "${entries[@]}" diff --git a/tools/aqua-playground/lowered/808-clap.dsp b/tools/aqua-playground/lowered/808-clap.dsp new file mode 100644 index 0000000..e1243bc --- /dev/null +++ b/tools/aqua-playground/lowered/808-clap.dsp @@ -0,0 +1,76 @@ +import("stdfaust.lib"); +declare name "808-clap"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 1800 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = no.noise; +voice_0_colored = (voice_0_osc * (1.0 - clip01(0.95 + patch_mod_noise + 0.0)) + no.noise * clip01(0.95 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.42 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.55 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.55 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered + (voice_0_filtered : de.fdelay(2048, min(2047.0, max(0.0, abs(0.004 + 0 * voice_0_age) * ma.SR)))); +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.11, 0.018) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.22); + +voice_1_age = age; +voice_1_freq = ((max(20, 2200 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = no.noise; +voice_1_colored = (voice_1_osc * (1.0 - clip01(0.95 + patch_mod_noise + 0.0)) + no.noise * clip01(0.95 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.42 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.55 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.55 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered + (voice_1_filtered : de.fdelay(2048, min(2047.0, max(0.0, abs(0.008 + 0 * voice_1_age) * ma.SR)))); +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0, 0, 1, 0.11, 0.022) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.22); + +voice_2_age = age; +voice_2_freq = ((max(20, 2600 * pow(2.0, 0 * voice_2_age + 0.5 * 0 * voice_2_age * voice_2_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_2_osc = no.noise; +voice_2_colored = (voice_2_osc * (1.0 - clip01(0.95 + patch_mod_noise + 0.0)) + no.noise * clip01(0.95 + patch_mod_noise + 0.0)); +voice_2_driven = ma.tanh(voice_2_colored * (1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0); +voice_2_folded = voice_2_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_2_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_2_filtered = voice_2_folded : fi.lowpass(1, max(20.0, clip01(0.42 * (1.0 + 0 * voice_2_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.55 * (1.0 + 0 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.55 * (1.0 + 0 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_2_phased = voice_2_filtered + (voice_2_filtered : de.fdelay(2048, min(2047.0, max(0.0, abs(0.012 + 0 * voice_2_age) * ma.SR)))); +voice_2_formants = voice_2_phased; +voice_2 = ((voice_2_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_2_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_2_age, 0, 0, 1, 0.11, 0.028) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.22); + +process = softclip((voice_0 + voice_1 + voice_2) * 1); diff --git a/tools/aqua-playground/lowered/808-cowbell.dsp b/tools/aqua-playground/lowered/808-cowbell.dsp new file mode 100644 index 0000000..a9e3996 --- /dev/null +++ b/tools/aqua-playground/lowered/808-cowbell.dsp @@ -0,0 +1,65 @@ +import("stdfaust.lib"); +declare name "808-cowbell"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 540 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = select2(wrap01(os.phasor(1.0, ((max(20, 540 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0) < clip01(0.43 + 0 * voice_0_age + patch_mod_duty + 0.0), -0.5, 0.5); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.16 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.16 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.82 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.18 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.18 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.18, 0.05) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.16); + +voice_1_age = age; +voice_1_freq = ((max(20, 800 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = select2(wrap01(os.phasor(1.0, ((max(20, 800 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0) < clip01(0.47 + 0 * voice_1_age + patch_mod_duty + 0.0), -0.5, 0.5); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.16 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.16 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.82 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.18 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.18 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0, 0, 1, 0.16, 0.045) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.12); + +process = softclip((voice_0 + voice_1) * 1); diff --git a/tools/aqua-playground/lowered/808-hat.dsp b/tools/aqua-playground/lowered/808-hat.dsp new file mode 100644 index 0000000..551f76c --- /dev/null +++ b/tools/aqua-playground/lowered/808-hat.dsp @@ -0,0 +1,65 @@ +import("stdfaust.lib"); +declare name "808-hat"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 9000 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = no.noise; +voice_0_colored = (voice_0_osc * (1.0 - clip01(1 + patch_mod_noise + 0.0)) + no.noise * clip01(1 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.05 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.05 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.24 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.9 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.9 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.055, 0.006) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.16); + +voice_1_age = age; +voice_1_freq = ((max(20, 6800 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = select2(wrap01(os.phasor(1.0, ((max(20, 6800 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0) < clip01(0.5 + 0 * voice_1_age + patch_mod_duty + 0.0), -0.5, 0.5); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.05 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.05 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.24 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.9 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.9 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0, 0, 1, 0.04, 0.005) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.045); + +process = softclip((voice_0 + voice_1) * 1); diff --git a/tools/aqua-playground/lowered/808-kick.dsp b/tools/aqua-playground/lowered/808-kick.dsp new file mode 100644 index 0000000..9ee8ad7 --- /dev/null +++ b/tools/aqua-playground/lowered/808-kick.dsp @@ -0,0 +1,54 @@ +import("stdfaust.lib"); +declare name "808-kick"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(32, 58 * pow(2.0, -3.8 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(32, 58 * pow(2.0, -3.8 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.18 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.18 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.85 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 0.6060606, 0.42, 0.045) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 1.32); + +process = softclip((voice_0) * 1); diff --git a/tools/aqua-playground/lowered/808-snare.dsp b/tools/aqua-playground/lowered/808-snare.dsp new file mode 100644 index 0000000..b65dbaf --- /dev/null +++ b/tools/aqua-playground/lowered/808-snare.dsp @@ -0,0 +1,65 @@ +import("stdfaust.lib"); +declare name "808-snare"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 180 * pow(2.0, -1.2 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 180 * pow(2.0, -1.2 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.12, 0.02) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.08); + +voice_1_age = age; +voice_1_freq = ((max(20, 140 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = no.noise; +voice_1_colored = (voice_1_osc * (1.0 - clip01(0.85 + patch_mod_noise + 0.0)) + no.noise * clip01(0.85 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.55 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.45 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.45 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0, 0, 1, 0.2, 0.035) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.55); + +process = softclip((voice_0 + voice_1) * 1); diff --git a/tools/aqua-playground/lowered/808-tom.dsp b/tools/aqua-playground/lowered/808-tom.dsp new file mode 100644 index 0000000..28235ed --- /dev/null +++ b/tools/aqua-playground/lowered/808-tom.dsp @@ -0,0 +1,54 @@ +import("stdfaust.lib"); +declare name "808-tom"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(62, 115 * pow(2.0, -1.45 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(62, 115 * pow(2.0, -1.45 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.78 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 0.78125, 0.34, 0.055) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.704); + +process = softclip((voice_0) * 1); diff --git a/tools/aqua-playground/lowered/advanced-alien-multivalve-graph.dsp b/tools/aqua-playground/lowered/advanced-alien-multivalve-graph.dsp new file mode 100644 index 0000000..f73fe80 --- /dev/null +++ b/tools/aqua-playground/lowered/advanced-alien-multivalve-graph.dsp @@ -0,0 +1,231 @@ +import("stdfaust.lib"); +declare name "advanced-alien-multivalve-graph"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_param_0_base = hslider("/alien/core/pressure", 0.74, 0, 1.5, 0.001) : si.smoo; +patch_param_0_curve_time = max(0.0, age * 1 - 0); +patch_param_0_curve_value = select2(patch_param_0_curve_time < 0.1, select2(patch_param_0_curve_time < 0.5, select2(patch_param_0_curve_time < 0.9, 0.22, seg(patch_param_0_curve_time, 0.5, 0.4, 0.82, 0.22)), seg(patch_param_0_curve_time, 0.1, 0.4, 0.76, 0.82)), seg(patch_param_0_curve_time, 0, 0.1, 0.08, 0.76)); +patch_param_0_curve_depth = hslider("/curves/core_breath/depth", 0.9, 0, 1, 0.001) : si.smoo; +patch_param_0 = min(1.5, max(0, patch_param_0_base * (1.0 - patch_param_0_curve_depth) + patch_param_0_curve_value * patch_param_0_curve_depth)); +patch_param_1_base = hslider("/alien/side/pressure", 0.52, 0, 1.5, 0.001) : si.smoo; +patch_param_1_curve_time = max(0.0, age * 1 - 0); +patch_param_1_curve_value = select2(patch_param_1_curve_time < 0.18, select2(patch_param_1_curve_time < 0.38, select2(patch_param_1_curve_time < 0.62, select2(patch_param_1_curve_time < 0.9, 0.12, seg(patch_param_1_curve_time, 0.62, 0.28, 0.7, 0.12)), seg(patch_param_1_curve_time, 0.38, 0.24, 0.22, 0.7)), seg(patch_param_1_curve_time, 0.18, 0.2, 0.54, 0.22)), seg(patch_param_1_curve_time, 0, 0.18, 0.02, 0.54)); +patch_param_1_curve_depth = hslider("/curves/side_breath/depth", 0.9, 0, 1, 0.001) : si.smoo; +patch_param_1 = min(1.5, max(0, patch_param_1_base * (1.0 - patch_param_1_curve_depth) + patch_param_1_curve_value * patch_param_1_curve_depth)); +patch_param_2 = hslider("/alien/core/opening", 0.24, 0, 1, 0.001) : si.smoo; +patch_param_3 = hslider("/alien/side/opening", 0.3, 0, 1, 0.001) : si.smoo; +patch_param_4_base = hslider("/alien/aperture", 0.85, 0, 2, 0.001) : si.smoo; +patch_param_4_curve_time = max(0.0, age * 1 - 0); +patch_param_4_curve_value = select2(patch_param_4_curve_time < 0.22, select2(patch_param_4_curve_time < 0.55, select2(patch_param_4_curve_time < 0.9, 0.9, seg(patch_param_4_curve_time, 0.55, 0.35, 0.62, 0.9)), seg(patch_param_4_curve_time, 0.22, 0.33, 1.1, 0.62)), seg(patch_param_4_curve_time, 0, 0.22, 0.42, 1.1)); +patch_param_4_curve_depth = hslider("/curves/mouth_shape/depth", 0.8, 0, 1, 0.001) : si.smoo; +patch_param_4 = min(2, max(0, patch_param_4_base * (1.0 - patch_param_4_curve_depth) + patch_param_4_curve_value * patch_param_4_curve_depth)); +patch_param_5 = hslider("/alien/branch/opening", 0.46, 0, 1, 0.001) : si.smoo; + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_graph_drive = 1.0; +voice_0_graph_terminal_area_core_valve = max(0.000001, ((max(0.0, min((0.48 + ((2.43) - 0.48) * (exp(0.0 - pow((0 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.48) * 0), (patch_param_4) + max(0.0, ((0.48 + ((2.43) - 0.48) * (exp(0.0 - pow((0 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.48) * 0)) - (patch_param_4)) * (1.0 - (exp(0.0 - pow((0 - (3.4)) / (max(0.001, 0.09 * 6)), 2.0))))))) * (max(0.0, min((0.48 + ((2.43) - 0.48) * (exp(0.0 - pow((0 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.48) * 0), (patch_param_4) + max(0.0, ((0.48 + ((2.43) - 0.48) * (exp(0.0 - pow((0 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.48) * 0)) - (patch_param_4)) * (1.0 - (exp(0.0 - pow((0 - (3.4)) / (max(0.001, 0.09 * 6)), 2.0)))))))) * max(0.0, 1)); +voice_0_graph_terminal_reflection_core_valve = 0; +voice_0_graph_terminal_area_side_valve = max(0.000001, 0.04 * max(0.0, 1)); +voice_0_graph_terminal_reflection_side_valve = 0; +voice_0_graph_terminal_area_aperture = max(0.000001, ((max(0.0, min((0.44 + ((2.43) - 0.44) * (exp(0.0 - pow((5 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.44) * 1), (patch_param_4) + max(0.0, ((0.44 + ((2.43) - 0.44) * (exp(0.0 - pow((5 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.44) * 1)) - (patch_param_4)) * (1.0 - (exp(0.0 - pow((5 - (3.4)) / (max(0.001, 0.09 * 6)), 2.0))))))) * (max(0.0, min((0.44 + ((2.43) - 0.44) * (exp(0.0 - pow((5 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.44) * 1), (patch_param_4) + max(0.0, ((0.44 + ((2.43) - 0.44) * (exp(0.0 - pow((5 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.44) * 1)) - (patch_param_4)) * (1.0 - (exp(0.0 - pow((5 - (3.4)) / (max(0.001, 0.09 * 6)), 2.0)))))))) * max(0.0, 0.85)); +voice_0_graph_terminal_reflection_aperture = ((0.72) * (1.0 - clip01(max(0.0, patch_param_4))) + (-0.58) * clip01(max(0.0, patch_param_4))); +voice_0_graph_terminal_area_side_coupler_from = max(0.000001, ((max(0.0, min((0.933 + ((2.43) - 0.933) * (exp(0.0 - pow((2.9 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.933) * 0), (patch_param_4) + max(0.0, ((0.933 + ((2.43) - 0.933) * (exp(0.0 - pow((2.9 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.933) * 0)) - (patch_param_4)) * (1.0 - (exp(0.0 - pow((2.9 - (3.4)) / (max(0.001, 0.09 * 6)), 2.0))))))) * (max(0.0, min((0.933 + ((2.43) - 0.933) * (exp(0.0 - pow((2.9 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.933) * 0), (patch_param_4) + max(0.0, ((0.933 + ((2.43) - 0.933) * (exp(0.0 - pow((2.9 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.933) * 0)) - (patch_param_4)) * (1.0 - (exp(0.0 - pow((2.9 - (3.4)) / (max(0.001, 0.09 * 6)), 2.0)))))))) * max(0.0, 0.62)); +voice_0_graph_terminal_reflection_side_coupler_from = 0; +voice_0_graph_terminal_area_side_coupler_to = max(0.000001, 0.0324 * max(0.0, 0.46)); +voice_0_graph_terminal_reflection_side_coupler_to = 0; +voice_0_graph_node_area_core_valve = max(0.000001, voice_0_graph_terminal_area_core_valve); +voice_0_graph_node_reflection_core_valve = (voice_0_graph_terminal_reflection_core_valve) / 1; +voice_0_graph_node_area_side_coupler_from = max(0.000001, voice_0_graph_terminal_area_side_coupler_from); +voice_0_graph_node_reflection_side_coupler_from = (voice_0_graph_terminal_reflection_side_coupler_from) / 1; +voice_0_graph_node_area_aperture = max(0.000001, voice_0_graph_terminal_area_aperture); +voice_0_graph_node_reflection_aperture = (voice_0_graph_terminal_reflection_aperture) / 1; +voice_0_graph_node_area_side_valve = max(0.000001, voice_0_graph_terminal_area_side_valve); +voice_0_graph_node_reflection_side_valve = (voice_0_graph_terminal_reflection_side_valve) / 1; +voice_0_graph_node_area_side_coupler_to = max(0.000001, voice_0_graph_terminal_area_side_coupler_to); +voice_0_graph_node_reflection_side_coupler_to = (voice_0_graph_terminal_reflection_side_coupler_to) / 1; +voice_0_graph_segment_area_0 = max(0.000001, ((max(0.0, min((0.8685 + ((2.43) - 0.8685) * (exp(0.0 - pow((1.45 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.8685) * 0), (patch_param_4) + max(0.0, ((0.8685 + ((2.43) - 0.8685) * (exp(0.0 - pow((1.45 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.8685) * 0)) - (patch_param_4)) * (1.0 - (exp(0.0 - pow((1.45 - (3.4)) / (max(0.001, 0.09 * 6)), 2.0))))))) * (max(0.0, min((0.8685 + ((2.43) - 0.8685) * (exp(0.0 - pow((1.45 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.8685) * 0), (patch_param_4) + max(0.0, ((0.8685 + ((2.43) - 0.8685) * (exp(0.0 - pow((1.45 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.8685) * 0)) - (patch_param_4)) * (1.0 - (exp(0.0 - pow((1.45 - (3.4)) / (max(0.001, 0.09 * 6)), 2.0))))))))); +voice_0_graph_segment_area_1 = max(0.000001, ((max(0.0, min((0.692 + ((2.43) - 0.692) * (exp(0.0 - pow((3.95 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.692) * 0), (patch_param_4) + max(0.0, ((0.692 + ((2.43) - 0.692) * (exp(0.0 - pow((3.95 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.692) * 0)) - (patch_param_4)) * (1.0 - (exp(0.0 - pow((3.95 - (3.4)) / (max(0.001, 0.09 * 6)), 2.0))))))) * (max(0.0, min((0.692 + ((2.43) - 0.692) * (exp(0.0 - pow((3.95 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.692) * 0), (patch_param_4) + max(0.0, ((0.692 + ((2.43) - 0.692) * (exp(0.0 - pow((3.95 - (12.9)) / (max(0.001, 0.18 * 6)), 2.0))) + ((patch_param_4) - 0.692) * 0)) - (patch_param_4)) * (1.0 - (exp(0.0 - pow((3.95 - (3.4)) / (max(0.001, 0.09 * 6)), 2.0))))))))); +voice_0_graph_segment_area_2 = max(0.000001, 0.2916); +voice_0_graph_connection_coupling_side_coupler_connection = clip01(0.62); +voice_0_graph_connection_loss_side_coupler_connection = clip01(1); +voice_0_graph_radiation_gain = 1.0; +voice_0_graph_source_core_valve = 0.0; +voice_0_graph_source_side_valve = 0.0; +voice_0_graph(x) = voice_0_graph_loop ~ si.bus(6) : (si.block(6), _) with { + voice_0_graph_loop(r0, r1, r2, l0, l1, l2) = voice_0_graph_next_r0, voice_0_graph_next_r1, voice_0_graph_next_r2, voice_0_graph_next_l0, voice_0_graph_next_l1, voice_0_graph_next_l2, voice_0_graph_out with { + voice_0_graph_in_0_start = l0; + voice_0_graph_in_0_end = r0; + voice_0_graph_in_1_start = l1; + voice_0_graph_in_1_end = r1; + voice_0_graph_in_2_start = l2; + voice_0_graph_in_2_end = r2; + voice_0_graph_source_core_valve_core_valve_load_pressure = voice_0_graph_node_incident_pressure_core_valve; + voice_0_graph_source_core_valve_core_valve_stiffness_hint = max(0.00002, min(0.16, pow(2.0 * ma.PI * max(20.0, ((max(20, 190 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) / ma.SR, 2.0))); + voice_0_graph_source_core_valve_core_valve_flow_scale = max(0.0, 1.1); + voice_0_graph_source_core_valve_core_valve_tissue_loss = clip01(0.18); + voice_0_graph_source_core_valve_core_valve_aperture_shape = clip01(0.44); + voice_0_graph_source_core_valve_core_valve_flow_loss = max(0.0, 0.38); + voice_0_graph_source_core_valve_core_valve_reservoir_pressure = (clip01(patch_param_0)) * (max(0.0, 1)); + voice_0_graph_source_core_valve_core_valve_downstream_pressure = (max(0.0, 0.03)) + (max(0.0, 0.38)) * ma.tanh(voice_0_graph_source_core_valve_core_valve_load_pressure); + voice_0_graph_source_core_valve_core_valve_pressure_drive = max(0.0, voice_0_graph_source_core_valve_core_valve_reservoir_pressure - voice_0_graph_source_core_valve_core_valve_downstream_pressure); + voice_0_graph_source_core_valve_core_valve_stiffness = voice_0_graph_source_core_valve_core_valve_stiffness_hint * (0.35 + 1.65 * (clip01(0.44))); + voice_0_graph_source_core_valve_core_valve_modal_frequency = max(45.0, min(10000.0, (ma.SR / (2.0 * ma.PI)) * sqrt(max(0.00002, voice_0_graph_source_core_valve_core_valve_stiffness) / (max(0.02, 0.35))))); + voice_0_graph_source_core_valve_core_valve_load_detune = 1.0 - 0.035 * ma.tanh(voice_0_graph_source_core_valve_core_valve_load_pressure * (max(0.0, 0.38))); + voice_0_graph_source_core_valve_core_valve_oscillation_threshold = 0.030 + 0.070 * (max(0.0, 0.18)) + 0.080 * voice_0_graph_source_core_valve_core_valve_tissue_loss + 0.18 * clip01(max(0.0, patch_param_2)); + voice_0_graph_source_core_valve_core_valve_oscillation_gate = clip01((voice_0_graph_source_core_valve_core_valve_pressure_drive - voice_0_graph_source_core_valve_core_valve_oscillation_threshold) * (3.0 + 1.6 * max(0.0, 1.0 - (max(0.0, 0.18))))); + voice_0_graph_source_core_valve_core_valve_modal_q = 3.0 + 22.0 * clip01((clip01(patch_param_0)) * (1.0 - 0.45 * (max(0.0, 0.18)) - 0.35 * voice_0_graph_source_core_valve_core_valve_tissue_loss) + 0.35 * (clip01(0.44))); + voice_0_graph_source_core_valve_core_valve_modal_seed = (no.noise * 0.018 + voice_0_graph_source_core_valve_core_valve_pressure_drive * max(0.0, 0.22 - clip01(max(0.0, patch_param_2))) * 0.16); + voice_0_graph_source_core_valve_core_valve_modal_ring = voice_0_graph_source_core_valve_core_valve_modal_seed : fi.resonbp(voice_0_graph_source_core_valve_core_valve_modal_frequency, voice_0_graph_source_core_valve_core_valve_modal_q, 1); + voice_0_graph_source_core_valve_core_valve_modal_oscillator = os.osc(voice_0_graph_source_core_valve_core_valve_modal_frequency * voice_0_graph_source_core_valve_core_valve_load_detune) * voice_0_graph_source_core_valve_core_valve_oscillation_gate; + voice_0_graph_source_core_valve_core_valve_modal_tissue = (voice_0_graph_source_core_valve_core_valve_modal_oscillator * (0.70 + 0.80 * (clip01(0.44))) + voice_0_graph_source_core_valve_core_valve_modal_ring * 0.35) * max(0.0, 1.0 - 0.35 * (max(0.0, 0.18)) - 0.45 * voice_0_graph_source_core_valve_core_valve_tissue_loss); + voice_0_graph_source_core_valve_core_valve_upper_stiffness_effective = max((max(0.0, 0)), voice_0_graph_source_core_valve_core_valve_stiffness * (0.80 + 0.45 * (clip01(0.44)))); + voice_0_graph_source_core_valve_core_valve_lower_stiffness_effective = max((max(0.0, 0)), voice_0_graph_source_core_valve_core_valve_stiffness * (1.05 + 0.55 * (clip01(0.44)))); + voice_0_graph_source_core_valve_core_valve_coupling_stiffness = (max(0.0, 0.12)) * (1.0 + 1.5 * (clip01(0.44))); + voice_0_graph_source_core_valve_core_valve_lower_velocity_decay = min(0.9995, max(0.20, 1.0 - ((0.010 + 0.090 * (max(0.0, 0.18)) + 0.040 * (max(0.0, 0.12)) + 0.055 * voice_0_graph_source_core_valve_core_valve_tissue_loss) / (max(0.02, 0.3))))); + voice_0_graph_source_core_valve_core_valve_upper_velocity_decay = min(0.9995, max(0.20, 1.0 - ((0.012 + 0.105 * (max(0.0, 0.18)) + 0.030 * (max(0.0, 0.12)) + 0.055 * voice_0_graph_source_core_valve_core_valve_tissue_loss) / (max(0.02, 0.18))))); + voice_0_graph_source_core_valve_core_valve_lower_force = (voice_0_graph_source_core_valve_core_valve_pressure_drive * (0.0005 + 0.0028 * (1.0 - clip01(max(0.0, patch_param_2)))) - (max(0.0, 0.38)) * voice_0_graph_source_core_valve_core_valve_load_pressure * 0.0012) / (max(0.02, 0.3)); + voice_0_graph_source_core_valve_core_valve_upper_force = (voice_0_graph_source_core_valve_core_valve_pressure_drive * (0.0003 + 0.0018 * (1.0 - clip01(max(0.0, patch_param_2)))) - (max(0.0, 0.38)) * voice_0_graph_source_core_valve_core_valve_load_pressure * 0.0008) / (max(0.02, 0.18)); + voice_0_graph_source_core_valve_core_valve_lower_velocity = voice_0_graph_source_core_valve_core_valve_lower_force : + ~ *(voice_0_graph_source_core_valve_core_valve_lower_velocity_decay / (1.0 + 10.0 * voice_0_graph_source_core_valve_core_valve_lower_stiffness_effective + voice_0_graph_source_core_valve_core_valve_coupling_stiffness + 0.4 * (max(0.0, 0.8)))); + voice_0_graph_source_core_valve_core_valve_upper_velocity = (voice_0_graph_source_core_valve_core_valve_upper_force + voice_0_graph_source_core_valve_core_valve_lower_velocity * voice_0_graph_source_core_valve_core_valve_coupling_stiffness * 0.35) : + ~ *(voice_0_graph_source_core_valve_core_valve_upper_velocity_decay / (1.0 + 10.0 * voice_0_graph_source_core_valve_core_valve_upper_stiffness_effective + voice_0_graph_source_core_valve_core_valve_coupling_stiffness + 0.4 * (max(0.0, 0.8)))); + voice_0_graph_source_core_valve_core_valve_lower_displacement = voice_0_graph_source_core_valve_core_valve_lower_velocity : + ~ *(min(0.9998, max(0.20, 1.0 - 0.0008 / (max(0.02, 0.3))))); + voice_0_graph_source_core_valve_core_valve_upper_displacement = voice_0_graph_source_core_valve_core_valve_upper_velocity : + ~ *(min(0.9998, max(0.20, 1.0 - 0.0008 / (max(0.02, 0.18))))); + voice_0_graph_source_core_valve_core_valve_collision = (max(0.0, 0.45)) * max(0.0, 0.0 - ((max(0.0, 0.03)) + (max(0.0, patch_param_2)) + voice_0_graph_source_core_valve_core_valve_upper_displacement)); + voice_0_graph_source_core_valve_core_valve_displacement = voice_0_graph_source_core_valve_core_valve_lower_displacement * (1.0 - (clip01(0.42))) + (voice_0_graph_source_core_valve_core_valve_upper_displacement - voice_0_graph_source_core_valve_core_valve_collision) * (clip01(0.42)); + voice_0_graph_source_core_valve_core_valve_aperture_linear = max(0.0, (max(0.0, 0.03)) + (max(0.0, patch_param_2)) + voice_0_graph_source_core_valve_core_valve_displacement - (max(0.0, 0.8)) * pow(voice_0_graph_source_core_valve_core_valve_displacement, 3.0)); + voice_0_graph_source_core_valve_core_valve_aperture = voice_0_graph_source_core_valve_core_valve_aperture_linear * (1.0 - 0.55 * voice_0_graph_source_core_valve_core_valve_aperture_shape) + pow(voice_0_graph_source_core_valve_core_valve_aperture_linear, 2.0) * (0.55 * voice_0_graph_source_core_valve_core_valve_aperture_shape); + voice_0_graph_source_core_valve_core_valve_flow_resistance = 1.0 + voice_0_graph_source_core_valve_core_valve_flow_loss * (0.35 + 1.8 / max(0.035, voice_0_graph_source_core_valve_core_valve_aperture + (max(0.0, 0.03)))); + voice_0_graph_source_core_valve_core_valve_turbulence = no.noise : fi.highpass(2, 1200.0 + 2800.0 * clip01(1.0 - voice_0_graph_source_core_valve_core_valve_aperture)); + voice_0_graph_source_core_valve_core_valve_voicing = voice_0_graph_source_core_valve_core_valve_modal_tissue * (0.18 + 1.45 * (clip01(0.44))); + voice_0_graph_source_core_valve_core_valve_flow = ma.tanh(((voice_0_graph_source_core_valve_core_valve_pressure_drive * voice_0_graph_source_core_valve_core_valve_aperture * (1.5 + 3.5 * voice_0_graph_source_core_valve_core_valve_flow_scale)) + (voice_0_graph_source_core_valve_core_valve_voicing * voice_0_graph_source_core_valve_core_valve_pressure_drive * (0.45 + 1.55 * (clip01(0.44))))) / voice_0_graph_source_core_valve_core_valve_flow_resistance); + voice_0_graph_source_core_valve_core_valve_noise = voice_0_graph_source_core_valve_core_valve_turbulence * (clip01(0.05)) * voice_0_graph_source_core_valve_core_valve_pressure_drive * clip01(voice_0_graph_source_core_valve_core_valve_aperture) * (1.0 - 0.55 * (clip01(0.44))) / voice_0_graph_source_core_valve_core_valve_flow_resistance; + voice_0_graph_source_core_valve_core_valve_out = (voice_0_graph_source_core_valve_core_valve_flow * voice_0_graph_source_core_valve_core_valve_flow_scale * (0.55 + 2.6 * voice_0_graph_source_core_valve_core_valve_pressure_drive) + voice_0_graph_source_core_valve_core_valve_noise) * ((1) * (1.0)); + voice_0_graph_node_incident_pressure_core_valve = (voice_0_graph_in_0_start) / 1; + voice_0_graph_node_source_core_valve = voice_0_graph_source_core_valve_core_valve_out; + voice_0_graph_node_incident_pressure_side_coupler_from = (voice_0_graph_in_0_end + voice_0_graph_in_1_start) / 2; + voice_0_graph_node_source_side_coupler_from = 0.0; + voice_0_graph_node_incident_pressure_aperture = (voice_0_graph_in_1_end) / 1; + voice_0_graph_node_source_aperture = 0.0; + voice_0_graph_source_side_valve_side_valve_load_pressure = voice_0_graph_node_incident_pressure_side_valve; + voice_0_graph_source_side_valve_side_valve_stiffness_hint = max(0.00002, min(0.16, pow(2.0 * ma.PI * max(20.0, ((max(20, 190 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) / ma.SR, 2.0))); + voice_0_graph_source_side_valve_side_valve_flow_scale = max(0.0, 0.95); + voice_0_graph_source_side_valve_side_valve_tissue_loss = clip01(0.22); + voice_0_graph_source_side_valve_side_valve_aperture_shape = clip01(0.4); + voice_0_graph_source_side_valve_side_valve_flow_loss = max(0.0, 0.36); + voice_0_graph_source_side_valve_side_valve_reservoir_pressure = (clip01(patch_param_1)) * (max(0.0, 1)); + voice_0_graph_source_side_valve_side_valve_downstream_pressure = (max(0.0, 0.02)) + (max(0.0, 0.34)) * ma.tanh(voice_0_graph_source_side_valve_side_valve_load_pressure); + voice_0_graph_source_side_valve_side_valve_pressure_drive = max(0.0, voice_0_graph_source_side_valve_side_valve_reservoir_pressure - voice_0_graph_source_side_valve_side_valve_downstream_pressure); + voice_0_graph_source_side_valve_side_valve_stiffness = max(0.00002, (max(0.0, 0.026)) * (0.55 + 1.10 * (clip01(0.34)))); + voice_0_graph_source_side_valve_side_valve_modal_frequency = max(45.0, min(10000.0, (ma.SR / (2.0 * ma.PI)) * sqrt(max(0.00002, voice_0_graph_source_side_valve_side_valve_stiffness) / (max(0.02, 0.22))))); + voice_0_graph_source_side_valve_side_valve_load_detune = 1.0 - 0.035 * ma.tanh(voice_0_graph_source_side_valve_side_valve_load_pressure * (max(0.0, 0.34))); + voice_0_graph_source_side_valve_side_valve_oscillation_threshold = 0.030 + 0.070 * (max(0.0, 0.15)) + 0.080 * voice_0_graph_source_side_valve_side_valve_tissue_loss + 0.18 * clip01(max(0.0, patch_param_3)); + voice_0_graph_source_side_valve_side_valve_oscillation_gate = clip01((voice_0_graph_source_side_valve_side_valve_pressure_drive - voice_0_graph_source_side_valve_side_valve_oscillation_threshold) * (3.0 + 1.6 * max(0.0, 1.0 - (max(0.0, 0.15))))); + voice_0_graph_source_side_valve_side_valve_modal_q = 3.0 + 22.0 * clip01((clip01(patch_param_1)) * (1.0 - 0.45 * (max(0.0, 0.15)) - 0.35 * voice_0_graph_source_side_valve_side_valve_tissue_loss) + 0.35 * (clip01(0.34))); + voice_0_graph_source_side_valve_side_valve_modal_seed = (no.noise * 0.018 + voice_0_graph_source_side_valve_side_valve_pressure_drive * max(0.0, 0.22 - clip01(max(0.0, patch_param_3))) * 0.16); + voice_0_graph_source_side_valve_side_valve_modal_ring = voice_0_graph_source_side_valve_side_valve_modal_seed : fi.resonbp(voice_0_graph_source_side_valve_side_valve_modal_frequency, voice_0_graph_source_side_valve_side_valve_modal_q, 1); + voice_0_graph_source_side_valve_side_valve_modal_oscillator = os.osc(voice_0_graph_source_side_valve_side_valve_modal_frequency * voice_0_graph_source_side_valve_side_valve_load_detune) * voice_0_graph_source_side_valve_side_valve_oscillation_gate; + voice_0_graph_source_side_valve_side_valve_modal_tissue = (voice_0_graph_source_side_valve_side_valve_modal_oscillator * (0.70 + 0.80 * (clip01(0.34))) + voice_0_graph_source_side_valve_side_valve_modal_ring * 0.35) * max(0.0, 1.0 - 0.35 * (max(0.0, 0.15)) - 0.45 * voice_0_graph_source_side_valve_side_valve_tissue_loss); + voice_0_graph_source_side_valve_side_valve_velocity_decay = min(0.9995, max(0.20, 1.0 - ((0.008 + 0.08 * (max(0.0, 0.15)) + 0.055 * voice_0_graph_source_side_valve_side_valve_tissue_loss) / (max(0.02, 0.22))))); + voice_0_graph_source_side_valve_side_valve_displacement_decay = min(0.9998, max(0.20, 1.0 - 0.0008 / (max(0.02, 0.22)))); + voice_0_graph_source_side_valve_side_valve_force = (voice_0_graph_source_side_valve_side_valve_pressure_drive * (0.0004 + 0.0024 * (1.0 - clip01(max(0.0, patch_param_3)))) - (max(0.0, 0.34)) * voice_0_graph_source_side_valve_side_valve_load_pressure * 0.001) / (max(0.02, 0.22)); + voice_0_graph_source_side_valve_side_valve_velocity = voice_0_graph_source_side_valve_side_valve_force : + ~ *(voice_0_graph_source_side_valve_side_valve_velocity_decay / (1.0 + 10.0 * voice_0_graph_source_side_valve_side_valve_stiffness + 0.4 * (max(0.0, 0.8)))); + voice_0_graph_source_side_valve_side_valve_displacement = voice_0_graph_source_side_valve_side_valve_velocity : + ~ *(voice_0_graph_source_side_valve_side_valve_displacement_decay / (1.0 + 1.5 * voice_0_graph_source_side_valve_side_valve_stiffness)); + voice_0_graph_source_side_valve_side_valve_aperture_linear = max(0.0, (max(0.0, 0.04)) + (max(0.0, patch_param_3)) + voice_0_graph_source_side_valve_side_valve_displacement - (max(0.0, 0.8)) * pow(voice_0_graph_source_side_valve_side_valve_displacement, 3.0)); + voice_0_graph_source_side_valve_side_valve_aperture = voice_0_graph_source_side_valve_side_valve_aperture_linear * (1.0 - 0.55 * voice_0_graph_source_side_valve_side_valve_aperture_shape) + pow(voice_0_graph_source_side_valve_side_valve_aperture_linear, 2.0) * (0.55 * voice_0_graph_source_side_valve_side_valve_aperture_shape); + voice_0_graph_source_side_valve_side_valve_flow_resistance = 1.0 + voice_0_graph_source_side_valve_side_valve_flow_loss * (0.35 + 1.8 / max(0.035, voice_0_graph_source_side_valve_side_valve_aperture + (max(0.0, 0.04)))); + voice_0_graph_source_side_valve_side_valve_turbulence = no.noise : fi.highpass(2, 1200.0 + 2800.0 * clip01(1.0 - voice_0_graph_source_side_valve_side_valve_aperture)); + voice_0_graph_source_side_valve_side_valve_voicing = voice_0_graph_source_side_valve_side_valve_modal_tissue * (0.18 + 1.45 * (clip01(0.34))); + voice_0_graph_source_side_valve_side_valve_flow = ma.tanh(((voice_0_graph_source_side_valve_side_valve_pressure_drive * voice_0_graph_source_side_valve_side_valve_aperture * (1.5 + 3.5 * voice_0_graph_source_side_valve_side_valve_flow_scale)) + (voice_0_graph_source_side_valve_side_valve_voicing * voice_0_graph_source_side_valve_side_valve_pressure_drive * (0.45 + 1.55 * (clip01(0.34))))) / voice_0_graph_source_side_valve_side_valve_flow_resistance); + voice_0_graph_source_side_valve_side_valve_noise = voice_0_graph_source_side_valve_side_valve_turbulence * (clip01(0.04)) * voice_0_graph_source_side_valve_side_valve_pressure_drive * clip01(voice_0_graph_source_side_valve_side_valve_aperture) * (1.0 - 0.55 * (clip01(0.34))) / voice_0_graph_source_side_valve_side_valve_flow_resistance; + voice_0_graph_source_side_valve_side_valve_out = (voice_0_graph_source_side_valve_side_valve_flow * voice_0_graph_source_side_valve_side_valve_flow_scale * (0.55 + 2.6 * voice_0_graph_source_side_valve_side_valve_pressure_drive) + voice_0_graph_source_side_valve_side_valve_noise) * ((1) * (1.0)); + voice_0_graph_node_incident_pressure_side_valve = (voice_0_graph_in_2_start) / 1; + voice_0_graph_node_source_side_valve = voice_0_graph_source_side_valve_side_valve_out; + voice_0_graph_node_incident_pressure_side_coupler_to = (voice_0_graph_in_2_end) / 1; + voice_0_graph_node_source_side_coupler_to = 0.0; + voice_0_graph_connection_reflection_side_coupler_connection_side_coupler_from_0_end = (2.0 * ((voice_0_graph_terminal_area_side_coupler_from / 2)) - ((voice_0_graph_terminal_area_side_coupler_from / 2) + (voice_0_graph_terminal_area_side_coupler_from / 2) + (voice_0_graph_terminal_area_side_coupler_to / 1))) / max(0.000001, (voice_0_graph_terminal_area_side_coupler_from / 2) + (voice_0_graph_terminal_area_side_coupler_from / 2) + (voice_0_graph_terminal_area_side_coupler_to / 1)); + voice_0_graph_connection_scattered_side_coupler_connection_side_coupler_from_0_end = voice_0_graph_connection_reflection_side_coupler_connection_side_coupler_from_0_end * voice_0_graph_in_0_end + (1.0 + voice_0_graph_connection_reflection_side_coupler_connection_side_coupler_from_0_end) * (voice_0_graph_in_1_start + voice_0_graph_in_2_end); + voice_0_graph_out_0_end = ((voice_0_graph_connection_scattered_side_coupler_connection_side_coupler_from_0_end) * (voice_0_graph_connection_coupling_side_coupler_connection) + voice_0_graph_in_0_end * (1.0 - (voice_0_graph_connection_coupling_side_coupler_connection)) + (voice_0_graph_node_source_side_coupler_from) / 2) * voice_0_graph_connection_loss_side_coupler_connection; + voice_0_graph_connection_reflection_side_coupler_connection_side_coupler_from_1_start = (2.0 * ((voice_0_graph_terminal_area_side_coupler_from / 2)) - ((voice_0_graph_terminal_area_side_coupler_from / 2) + (voice_0_graph_terminal_area_side_coupler_from / 2) + (voice_0_graph_terminal_area_side_coupler_to / 1))) / max(0.000001, (voice_0_graph_terminal_area_side_coupler_from / 2) + (voice_0_graph_terminal_area_side_coupler_from / 2) + (voice_0_graph_terminal_area_side_coupler_to / 1)); + voice_0_graph_connection_scattered_side_coupler_connection_side_coupler_from_1_start = voice_0_graph_connection_reflection_side_coupler_connection_side_coupler_from_1_start * voice_0_graph_in_1_start + (1.0 + voice_0_graph_connection_reflection_side_coupler_connection_side_coupler_from_1_start) * (voice_0_graph_in_0_end + voice_0_graph_in_2_end); + voice_0_graph_out_1_start = ((voice_0_graph_connection_scattered_side_coupler_connection_side_coupler_from_1_start) * (voice_0_graph_connection_coupling_side_coupler_connection) + voice_0_graph_in_1_start * (1.0 - (voice_0_graph_connection_coupling_side_coupler_connection)) + (voice_0_graph_node_source_side_coupler_from) / 2) * voice_0_graph_connection_loss_side_coupler_connection; + voice_0_graph_connection_reflection_side_coupler_connection_side_coupler_to_2_end = (2.0 * ((voice_0_graph_terminal_area_side_coupler_to / 1)) - ((voice_0_graph_terminal_area_side_coupler_from / 2) + (voice_0_graph_terminal_area_side_coupler_from / 2) + (voice_0_graph_terminal_area_side_coupler_to / 1))) / max(0.000001, (voice_0_graph_terminal_area_side_coupler_from / 2) + (voice_0_graph_terminal_area_side_coupler_from / 2) + (voice_0_graph_terminal_area_side_coupler_to / 1)); + voice_0_graph_connection_scattered_side_coupler_connection_side_coupler_to_2_end = voice_0_graph_connection_reflection_side_coupler_connection_side_coupler_to_2_end * voice_0_graph_in_2_end + (1.0 + voice_0_graph_connection_reflection_side_coupler_connection_side_coupler_to_2_end) * (voice_0_graph_in_0_end + voice_0_graph_in_1_start); + voice_0_graph_out_2_end = ((voice_0_graph_connection_scattered_side_coupler_connection_side_coupler_to_2_end) * (voice_0_graph_connection_coupling_side_coupler_connection) + voice_0_graph_in_2_end * (1.0 - (voice_0_graph_connection_coupling_side_coupler_connection)) + (voice_0_graph_node_source_side_coupler_to) / 1) * voice_0_graph_connection_loss_side_coupler_connection; + voice_0_graph_connection_energy_in_side_coupler_connection = ((voice_0_graph_terminal_area_side_coupler_from / 2)) * pow(voice_0_graph_in_0_end, 2.0) + ((voice_0_graph_terminal_area_side_coupler_from / 2)) * pow(voice_0_graph_in_1_start, 2.0) + ((voice_0_graph_terminal_area_side_coupler_to / 1)) * pow(voice_0_graph_in_2_end, 2.0); + voice_0_graph_connection_energy_out_side_coupler_connection = ((voice_0_graph_terminal_area_side_coupler_from / 2)) * pow(voice_0_graph_out_0_end, 2.0) + ((voice_0_graph_terminal_area_side_coupler_from / 2)) * pow(voice_0_graph_out_1_start, 2.0) + ((voice_0_graph_terminal_area_side_coupler_to / 1)) * pow(voice_0_graph_out_2_end, 2.0); + voice_0_graph_out_0_start = voice_0_graph_in_0_start * voice_0_graph_node_reflection_core_valve + (voice_0_graph_node_source_core_valve) / 1; + voice_0_graph_radiation_boundary_load_aperture = clip01((voice_0_graph_radiation_admittance_aperture) * (voice_0_graph_radiation_differentiation_aperture) * (clip01(0.96))); + voice_0_graph_radiation_reflected_raw_aperture = (voice_0_graph_in_1_end) * (voice_0_graph_terminal_reflection_aperture) + (voice_0_graph_node_source_aperture); + voice_0_graph_radiation_reflected_loaded_aperture = (voice_0_graph_radiation_reflected_raw_aperture) * (1.0 - (voice_0_graph_radiation_boundary_load_aperture)) + ((voice_0_graph_radiation_reflected_raw_aperture) : fi.lowpass(1, voice_0_graph_radiation_highpass_aperture)) * (voice_0_graph_radiation_boundary_load_aperture); + voice_0_graph_out_1_end = voice_0_graph_radiation_reflected_loaded_aperture; + voice_0_graph_radiation_model_aperture = 4; + voice_0_graph_radiation_reference_area_aperture = 0.35; + voice_0_graph_radiation_differentiation_aperture = 0.18; + voice_0_graph_radiation_highpass_aperture = 15.0; + voice_0_graph_radiation_admittance_aperture = sqrt(clip01((voice_0_graph_terminal_area_aperture) / max(0.000001, (voice_0_graph_terminal_area_aperture) + (voice_0_graph_radiation_reference_area_aperture)))); + voice_0_graph_radiation_flow_aperture = ((voice_0_graph_in_1_end - voice_0_graph_out_1_end)); + voice_0_graph_out_2_start = voice_0_graph_in_2_start * voice_0_graph_node_reflection_side_valve + (voice_0_graph_node_source_side_valve) / 1; + voice_0_graph_delay_0 = max(0.000001, 0.00033819 * ma.SR); + voice_0_graph_segment_loss_0 = clip01((0.996) * (sqrt(clip01((voice_0_graph_segment_area_0) / max(0.000001, (voice_0_graph_segment_area_0) + 0.012))) * (0.998 - 0.010 * clip01(0.080 / max(0.000001, (voice_0_graph_segment_area_0) + 0.080))))); + voice_0_graph_next_r0 = voice_0_graph_out_0_start : de.fdelay(4096, min(4095, max(0.000001, voice_0_graph_delay_0))) * voice_0_graph_segment_loss_0; + voice_0_graph_next_l0 = voice_0_graph_out_0_end : de.fdelay(4096, min(4095, max(0.000001, voice_0_graph_delay_0))) * voice_0_graph_segment_loss_0; + voice_0_graph_delay_1 = max(0.000001, 0.0002449 * ma.SR); + voice_0_graph_segment_loss_1 = clip01((0.996) * (sqrt(clip01((voice_0_graph_segment_area_1) / max(0.000001, (voice_0_graph_segment_area_1) + 0.012))) * (0.998 - 0.010 * clip01(0.080 / max(0.000001, (voice_0_graph_segment_area_1) + 0.080))))); + voice_0_graph_next_r1 = voice_0_graph_out_1_start : de.fdelay(4096, min(4095, max(0.000001, voice_0_graph_delay_1))) * voice_0_graph_segment_loss_1; + voice_0_graph_next_l1 = voice_0_graph_out_1_end : de.fdelay(4096, min(4095, max(0.000001, voice_0_graph_delay_1))) * voice_0_graph_segment_loss_1; + voice_0_graph_delay_2 = max(0.000001, 0.00026239 * ma.SR); + voice_0_graph_segment_loss_2 = clip01((0.994) * ((0.996 - 0.018 * clip01(0.050 / max(0.000001, (voice_0_graph_segment_area_2) + 0.050))))); + voice_0_graph_next_r2 = voice_0_graph_out_2_start : de.fdelay(4096, min(4095, max(0.000001, voice_0_graph_delay_2))) * voice_0_graph_segment_loss_2; + voice_0_graph_next_l2 = voice_0_graph_out_2_end : de.fdelay(4096, min(4095, max(0.000001, voice_0_graph_delay_2))) * voice_0_graph_segment_loss_2; + voice_0_graph_out = (((voice_0_graph_radiation_flow_aperture * (1.0 - (voice_0_graph_radiation_differentiation_aperture)) + (voice_0_graph_radiation_flow_aperture : fi.highpass(1, voice_0_graph_radiation_highpass_aperture)) * (voice_0_graph_radiation_differentiation_aperture)) * clip01(0.96) * voice_0_graph_radiation_admittance_aperture)) * voice_0_graph_radiation_gain; + }; +}; +voice_0_acoustic_graph_radiated = voice_0_graph(voice_0_graph_drive); +voice_0_freq = ((max(20, 190 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = voice_0_acoustic_graph_radiated; +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.12, 0.9) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.2); + +process = softclip((voice_0) * 0.36); diff --git a/tools/aqua-playground/lowered/advanced-aurora-pad.dsp b/tools/aqua-playground/lowered/advanced-aurora-pad.dsp new file mode 100644 index 0000000..c28862e --- /dev/null +++ b/tools/aqua-playground/lowered/advanced-aurora-pad.dsp @@ -0,0 +1,87 @@ +import("stdfaust.lib"); +declare name "advanced-aurora-pad"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0 + 0.08 * lfo_sin(0.21, 0); +patch_mod_pitch = 0 + 0.012 * lfo_sin(0.21, 0) + 0 + 0.004 * lfo_tri(4.6, 0); +patch_mod_duty = 0.0; +patch_mod_lpf = 0 + 0.09 * lfo_sin(0.21, 0); +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0 + 0.035 * lfo_tri(4.6, 0); +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0 + 0.16 * lfo_sin(0.21, 0); +patch_mod_fm_index = 0 + 0.35 * lfo_sin(0.21, 0); + +voice_0_age = age; +voice_0_freq = ((max(20, 220 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 220 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 220 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 2.414))) * (max(0.0, 1.4 + patch_mod_fm_index + 0.0) * exp(-voice_0_age / max(0.8, 0.0001))) / ma.PI)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.05 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.05 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.86 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.018 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.018 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = ((voice_0_phased : fi.resonbp(420, 5.25, 1.0)) * 0.25 + (voice_0_phased : fi.resonbp(1180, 6.555555, 1.0)) * 0.75 + (voice_0_phased : fi.resonbp(2450, 6.805555, 1.0)) * 0.42) / 1.42; +voice_0 = ((voice_0_phased * (1.0 - clip01(0.18 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0.18 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0.018, 0, 1, 1.6, 1.15) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.12); + +voice_1_age = age; +voice_1_freq = ((max(20, 330 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 330 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 330 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 3.01))) * (max(0.0, 0.9 + patch_mod_fm_index + 0.0) * exp(-voice_1_age / max(0.8, 0.0001))) / ma.PI)); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.05 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.05 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.86 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.018 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.018 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = ((voice_1_phased : fi.resonbp(420, 5.25, 1.0)) * 0.25 + (voice_1_phased : fi.resonbp(1180, 6.555555, 1.0)) * 0.75 + (voice_1_phased : fi.resonbp(2450, 6.805555, 1.0)) * 0.42) / 1.42; +voice_1 = ((voice_1_phased * (1.0 - clip01(0.18 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0.18 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0.018, 0, 1, 1.6, 1.15) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.08); + +voice_2_age = age; +voice_2_freq = ((max(20, 440 * pow(2.0, 0 * voice_2_age + 0.5 * 0 * voice_2_age * voice_2_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_2_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 440 * pow(2.0, 0 * voice_2_age + 0.5 * 0 * voice_2_age * voice_2_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 440 * pow(2.0, 0 * voice_2_age + 0.5 * 0 * voice_2_age * voice_2_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 1.618))) * (max(0.0, 0.7 + patch_mod_fm_index + 0.0) * exp(-voice_2_age / max(0.8, 0.0001))) / ma.PI)); +voice_2_colored = (voice_2_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_2_driven = ma.tanh(voice_2_colored * (1.0 + clip01(0.05 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.05 + patch_mod_drive + 0.0) * 12.0); +voice_2_folded = voice_2_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_2_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_2_filtered = voice_2_folded : fi.lowpass(1, max(20.0, clip01(0.86 * (1.0 + 0 * voice_2_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.018 * (1.0 + 0 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.018 * (1.0 + 0 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_2_phased = voice_2_filtered; +voice_2_formants = ((voice_2_phased : fi.resonbp(420, 5.25, 1.0)) * 0.25 + (voice_2_phased : fi.resonbp(1180, 6.555555, 1.0)) * 0.75 + (voice_2_phased : fi.resonbp(2450, 6.805555, 1.0)) * 0.42) / 1.42; +voice_2 = ((voice_2_phased * (1.0 - clip01(0.26 + patch_mod_formant_mix + 0.0)) + voice_2_formants * clip01(0.26 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_2_age, 0.018, 0, 1, 1.6, 1.15) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.06); + +voice_3_age = age; +voice_3_freq = ((max(20, 1600 * pow(2.0, 0 * voice_3_age + 0.5 * 0 * voice_3_age * voice_3_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_3_osc = no.noise; +voice_3_colored = (voice_3_osc * (1.0 - clip01(0.72 + patch_mod_noise + 0.0)) + no.noise * clip01(0.72 + patch_mod_noise + 0.0)); +voice_3_driven = ma.tanh(voice_3_colored * (1.0 + clip01(0.05 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.05 + patch_mod_drive + 0.0) * 12.0); +voice_3_folded = voice_3_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_3_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_3_filtered = voice_3_folded : fi.lowpass(1, max(20.0, clip01(0.38 * (1.0 + 0 * voice_3_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.62 * (1.0 + 0 * voice_3_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.62 * (1.0 + 0 * voice_3_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_3_phased = voice_3_filtered; +voice_3_formants = voice_3_phased; +voice_3 = ((voice_3_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_3_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_3_age, 0.018, 0, 1, 2, 1.4) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.018); + +process = softclip((voice_0 + voice_1 + voice_2 + voice_3) * 0.58); diff --git a/tools/aqua-playground/lowered/advanced-bird-syrinx-graph.dsp b/tools/aqua-playground/lowered/advanced-bird-syrinx-graph.dsp new file mode 100644 index 0000000..7234e76 --- /dev/null +++ b/tools/aqua-playground/lowered/advanced-bird-syrinx-graph.dsp @@ -0,0 +1,238 @@ +import("stdfaust.lib"); +declare name "advanced-bird-syrinx-graph"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_param_0_base = hslider("/bird/left/pressure", 0.84, 0, 1.5, 0.001) : si.smoo; +patch_param_0_curve_time = max(0.0, age * 1 - 0); +patch_param_0_curve_value = select2(patch_param_0_curve_time < 0.025, select2(patch_param_0_curve_time < 0.22, select2(patch_param_0_curve_time < 0.54, select2(patch_param_0_curve_time < 0.82, 0.18, seg(patch_param_0_curve_time, 0.54, 0.28, 0.88, 0.18)), seg(patch_param_0_curve_time, 0.22, 0.32, 0.78, 0.88)), seg(patch_param_0_curve_time, 0.025, 0.195, 0.92, 0.78)), seg(patch_param_0_curve_time, 0, 0.025, 0.04, 0.92)); +patch_param_0_curve_depth = hslider("/curves/left_air/depth", 0.95, 0, 1, 0.001) : si.smoo; +patch_param_0 = min(1.5, max(0, patch_param_0_base * (1.0 - patch_param_0_curve_depth) + patch_param_0_curve_value * patch_param_0_curve_depth)); +patch_param_1_base = hslider("/bird/right/pressure", 0.72, 0, 1.5, 0.001) : si.smoo; +patch_param_1_curve_time = max(0.0, age * 1 - 0); +patch_param_1_curve_value = select2(patch_param_1_curve_time < 0.035, select2(patch_param_1_curve_time < 0.18, select2(patch_param_1_curve_time < 0.48, select2(patch_param_1_curve_time < 0.82, 0.12, seg(patch_param_1_curve_time, 0.48, 0.34, 0.62, 0.12)), seg(patch_param_1_curve_time, 0.18, 0.3, 0.82, 0.62)), seg(patch_param_1_curve_time, 0.035, 0.145, 0.75, 0.82)), seg(patch_param_1_curve_time, 0, 0.035, 0.02, 0.75)); +patch_param_1_curve_depth = hslider("/curves/right_air/depth", 0.95, 0, 1, 0.001) : si.smoo; +patch_param_1 = min(1.5, max(0, patch_param_1_base * (1.0 - patch_param_1_curve_depth) + patch_param_1_curve_value * patch_param_1_curve_depth)); +patch_param_2_base = hslider("/bird/left/opening", 0.2, 0, 1, 0.001) : si.smoo; +patch_param_2_curve_time = max(0.0, age * 1 - 0); +patch_param_2_curve_value = select2(patch_param_2_curve_time < 0.03, select2(patch_param_2_curve_time < 0.62, select2(patch_param_2_curve_time < 0.82, 0.02, seg(patch_param_2_curve_time, 0.62, 0.2, 0.18, 0.02)), seg(patch_param_2_curve_time, 0.03, 0.59, 0.21, 0.18)), seg(patch_param_2_curve_time, 0, 0.03, 0.01, 0.21)); +patch_param_2_curve_depth = hslider("/curves/left_labium_gate/depth", 0.9, 0, 1, 0.001) : si.smoo; +patch_param_2 = min(1, max(0, patch_param_2_base * (1.0 - patch_param_2_curve_depth) + patch_param_2_curve_value * patch_param_2_curve_depth)); +patch_param_3_base = hslider("/bird/right/opening", 0.18, 0, 1, 0.001) : si.smoo; +patch_param_3_curve_time = max(0.0, age * 1 - 0); +patch_param_3_curve_value = select2(patch_param_3_curve_time < 0.035, select2(patch_param_3_curve_time < 0.54, select2(patch_param_3_curve_time < 0.82, 0.02, seg(patch_param_3_curve_time, 0.54, 0.28, 0.15, 0.02)), seg(patch_param_3_curve_time, 0.035, 0.505, 0.18, 0.15)), seg(patch_param_3_curve_time, 0, 0.035, 0.01, 0.18)); +patch_param_3_curve_depth = hslider("/curves/right_labium_gate/depth", 0.9, 0, 1, 0.001) : si.smoo; +patch_param_3 = min(1, max(0, patch_param_3_base * (1.0 - patch_param_3_curve_depth) + patch_param_3_curve_value * patch_param_3_curve_depth)); +patch_param_4 = hslider("/bird/left/tension", 0.46, 0, 1, 0.001) : si.smoo; +patch_param_5 = hslider("/bird/right/tension", 0.52, 0, 1, 0.001) : si.smoo; +patch_param_6_base = hslider("/bird/beak/opening", 0.92, 0, 1.5, 0.001) : si.smoo; +patch_param_6_curve_time = max(0.0, age * 1 - 0); +patch_param_6_curve_value = select2(patch_param_6_curve_time < 0.04, select2(patch_param_6_curve_time < 0.44, select2(patch_param_6_curve_time < 0.82, 0.35, seg(patch_param_6_curve_time, 0.44, 0.38, 1.08, 0.35)), seg(patch_param_6_curve_time, 0.04, 0.4, 0.92, 1.08)), seg(patch_param_6_curve_time, 0, 0.04, 0.22, 0.92)); +patch_param_6_curve_depth = hslider("/curves/beak_gate/depth", 0.75, 0, 1, 0.001) : si.smoo; +patch_param_6 = min(1.5, max(0, patch_param_6_base * (1.0 - patch_param_6_curve_depth) + patch_param_6_curve_value * patch_param_6_curve_depth)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_graph_drive = 1.0; +voice_0_graph_terminal_area_left_merge = max(0.000001, 0.1444 * max(0.0, 1)); +voice_0_graph_terminal_reflection_left_merge = 0; +voice_0_graph_terminal_area_right_merge = max(0.000001, 0.1296 * max(0.0, 1)); +voice_0_graph_terminal_reflection_right_merge = 0; +voice_0_graph_terminal_area_trachea_base = max(0.000001, 0.1296 * max(0.0, 1)); +voice_0_graph_terminal_reflection_trachea_base = 0; +voice_0_graph_terminal_area_left_labium = max(0.000001, 0.0324 * max(0.0, 1)); +voice_0_graph_terminal_reflection_left_labium = 0; +voice_0_graph_terminal_area_right_labium = max(0.000001, 0.0289 * max(0.0, 1)); +voice_0_graph_terminal_reflection_right_labium = 0; +voice_0_graph_terminal_area_beak = max(0.000001, 0.1444 * max(0.0, 0.92)); +voice_0_graph_terminal_reflection_beak = ((0.96) * (1.0 - clip01(pow(clip01((max(0.0, patch_param_6)) / 1.5), 2.0))) + (-0.72) * clip01(pow(clip01((max(0.0, patch_param_6)) / 1.5), 2.0))); +voice_0_graph_node_area_left_labium = max(0.000001, voice_0_graph_terminal_area_left_labium); +voice_0_graph_node_reflection_left_labium = (voice_0_graph_terminal_reflection_left_labium) / 1; +voice_0_graph_node_area_left_merge = max(0.000001, voice_0_graph_terminal_area_left_merge); +voice_0_graph_node_reflection_left_merge = (voice_0_graph_terminal_reflection_left_merge) / 1; +voice_0_graph_node_area_right_labium = max(0.000001, voice_0_graph_terminal_area_right_labium); +voice_0_graph_node_reflection_right_labium = (voice_0_graph_terminal_reflection_right_labium) / 1; +voice_0_graph_node_area_right_merge = max(0.000001, voice_0_graph_terminal_area_right_merge); +voice_0_graph_node_reflection_right_merge = (voice_0_graph_terminal_reflection_right_merge) / 1; +voice_0_graph_node_area_trachea_base = max(0.000001, voice_0_graph_terminal_area_trachea_base); +voice_0_graph_node_reflection_trachea_base = (voice_0_graph_terminal_reflection_trachea_base) / 1; +voice_0_graph_node_area_beak = max(0.000001, voice_0_graph_terminal_area_beak); +voice_0_graph_node_reflection_beak = (voice_0_graph_terminal_reflection_beak) / 1; +voice_0_graph_segment_area_0 = max(0.000001, 0.075625); +voice_0_graph_segment_area_1 = max(0.000001, 0.07022501); +voice_0_graph_segment_area_2 = max(0.000001, 0.2916); +voice_0_graph_connection_coupling_syrinx_merge = clip01(1); +voice_0_graph_connection_loss_syrinx_merge = clip01(1); +voice_0_graph_radiation_gain = 1.0; +voice_0_graph_source_left_labium = 0.0; +voice_0_graph_source_right_labium = 0.0; +voice_0_graph(x) = voice_0_graph_loop ~ si.bus(6) : (si.block(6), _) with { + voice_0_graph_loop(r0, r1, r2, l0, l1, l2) = voice_0_graph_next_r0, voice_0_graph_next_r1, voice_0_graph_next_r2, voice_0_graph_next_l0, voice_0_graph_next_l1, voice_0_graph_next_l2, voice_0_graph_out with { + voice_0_graph_in_0_start = l0; + voice_0_graph_in_0_end = r0; + voice_0_graph_in_1_start = l1; + voice_0_graph_in_1_end = r1; + voice_0_graph_in_2_start = l2; + voice_0_graph_in_2_end = r2; + voice_0_graph_source_left_labium_left_labium_load_pressure = voice_0_graph_node_incident_pressure_left_labium; + voice_0_graph_source_left_labium_left_labium_stiffness_hint = max(0.00002, min(0.16, pow(2.0 * ma.PI * max(20.0, ((max(20, 980 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) / ma.SR, 2.0))); + voice_0_graph_source_left_labium_left_labium_flow_scale = max(0.0, 1.22); + voice_0_graph_source_left_labium_left_labium_tissue_loss = clip01(0.16); + voice_0_graph_source_left_labium_left_labium_aperture_shape = clip01(0.38); + voice_0_graph_source_left_labium_left_labium_flow_loss = max(0.0, 0.32); + voice_0_graph_source_left_labium_left_labium_reservoir_pressure = (clip01(patch_param_0)) * (max(0.0, 1)); + voice_0_graph_source_left_labium_left_labium_downstream_pressure = (max(0.0, 0.02)) + (max(0.0, 0.46)) * ma.tanh(voice_0_graph_source_left_labium_left_labium_load_pressure); + voice_0_graph_source_left_labium_left_labium_pressure_drive = max(0.0, voice_0_graph_source_left_labium_left_labium_reservoir_pressure - voice_0_graph_source_left_labium_left_labium_downstream_pressure); + voice_0_graph_source_left_labium_left_labium_stiffness = max(0.00002, (max(0.0, 0.032)) * (0.55 + 1.10 * (clip01(patch_param_4)))); + voice_0_graph_source_left_labium_left_labium_modal_frequency = max(45.0, min(10000.0, (ma.SR / (2.0 * ma.PI)) * sqrt(max(0.00002, voice_0_graph_source_left_labium_left_labium_stiffness) / (max(0.02, 0.24))))); + voice_0_graph_source_left_labium_left_labium_load_detune = 1.0 - 0.035 * ma.tanh(voice_0_graph_source_left_labium_left_labium_load_pressure * (max(0.0, 0.46))); + voice_0_graph_source_left_labium_left_labium_oscillation_threshold = 0.030 + 0.070 * (max(0.0, 0.11)) + 0.080 * voice_0_graph_source_left_labium_left_labium_tissue_loss + 0.18 * clip01(max(0.0, patch_param_2)); + voice_0_graph_source_left_labium_left_labium_oscillation_gate = clip01((voice_0_graph_source_left_labium_left_labium_pressure_drive - voice_0_graph_source_left_labium_left_labium_oscillation_threshold) * (3.0 + 1.6 * max(0.0, 1.0 - (max(0.0, 0.11))))); + voice_0_graph_source_left_labium_left_labium_modal_q = 3.0 + 22.0 * clip01((clip01(patch_param_0)) * (1.0 - 0.45 * (max(0.0, 0.11)) - 0.35 * voice_0_graph_source_left_labium_left_labium_tissue_loss) + 0.35 * (clip01(patch_param_4))); + voice_0_graph_source_left_labium_left_labium_modal_seed = (no.noise * 0.018 + voice_0_graph_source_left_labium_left_labium_pressure_drive * max(0.0, 0.22 - clip01(max(0.0, patch_param_2))) * 0.16); + voice_0_graph_source_left_labium_left_labium_modal_ring = voice_0_graph_source_left_labium_left_labium_modal_seed : fi.resonbp(voice_0_graph_source_left_labium_left_labium_modal_frequency, voice_0_graph_source_left_labium_left_labium_modal_q, 1); + voice_0_graph_source_left_labium_left_labium_modal_oscillator = os.osc(voice_0_graph_source_left_labium_left_labium_modal_frequency * voice_0_graph_source_left_labium_left_labium_load_detune) * voice_0_graph_source_left_labium_left_labium_oscillation_gate; + voice_0_graph_source_left_labium_left_labium_modal_tissue = (voice_0_graph_source_left_labium_left_labium_modal_oscillator * (0.70 + 0.80 * (clip01(patch_param_4))) + voice_0_graph_source_left_labium_left_labium_modal_ring * 0.35) * max(0.0, 1.0 - 0.35 * (max(0.0, 0.11)) - 0.45 * voice_0_graph_source_left_labium_left_labium_tissue_loss); + voice_0_graph_source_left_labium_left_labium_velocity_decay = min(0.9995, max(0.20, 1.0 - ((0.008 + 0.08 * (max(0.0, 0.11)) + 0.055 * voice_0_graph_source_left_labium_left_labium_tissue_loss) / (max(0.02, 0.24))))); + voice_0_graph_source_left_labium_left_labium_displacement_decay = min(0.9998, max(0.20, 1.0 - 0.0008 / (max(0.02, 0.24)))); + voice_0_graph_source_left_labium_left_labium_force = (voice_0_graph_source_left_labium_left_labium_pressure_drive * (0.0004 + 0.0024 * (1.0 - clip01(max(0.0, patch_param_2)))) - (max(0.0, 0.46)) * voice_0_graph_source_left_labium_left_labium_load_pressure * 0.001) / (max(0.02, 0.24)); + voice_0_graph_source_left_labium_left_labium_velocity = voice_0_graph_source_left_labium_left_labium_force : + ~ *(voice_0_graph_source_left_labium_left_labium_velocity_decay / (1.0 + 10.0 * voice_0_graph_source_left_labium_left_labium_stiffness + 0.4 * (max(0.0, 0.82)))); + voice_0_graph_source_left_labium_left_labium_displacement = voice_0_graph_source_left_labium_left_labium_velocity : + ~ *(voice_0_graph_source_left_labium_left_labium_displacement_decay / (1.0 + 1.5 * voice_0_graph_source_left_labium_left_labium_stiffness)); + voice_0_graph_source_left_labium_left_labium_aperture_linear = max(0.0, (max(0.0, 0.018)) + (max(0.0, patch_param_2)) + voice_0_graph_source_left_labium_left_labium_displacement - (max(0.0, 0.82)) * pow(voice_0_graph_source_left_labium_left_labium_displacement, 3.0)); + voice_0_graph_source_left_labium_left_labium_aperture = voice_0_graph_source_left_labium_left_labium_aperture_linear * (1.0 - 0.55 * voice_0_graph_source_left_labium_left_labium_aperture_shape) + pow(voice_0_graph_source_left_labium_left_labium_aperture_linear, 2.0) * (0.55 * voice_0_graph_source_left_labium_left_labium_aperture_shape); + voice_0_graph_source_left_labium_left_labium_flow_resistance = 1.0 + voice_0_graph_source_left_labium_left_labium_flow_loss * (0.35 + 1.8 / max(0.035, voice_0_graph_source_left_labium_left_labium_aperture + (max(0.0, 0.018)))); + voice_0_graph_source_left_labium_left_labium_turbulence = no.noise : fi.highpass(2, 1200.0 + 2800.0 * clip01(1.0 - voice_0_graph_source_left_labium_left_labium_aperture)); + voice_0_graph_source_left_labium_left_labium_voicing = voice_0_graph_source_left_labium_left_labium_modal_tissue * (0.18 + 1.45 * (clip01(patch_param_4))); + voice_0_graph_source_left_labium_left_labium_flow = ma.tanh(((voice_0_graph_source_left_labium_left_labium_pressure_drive * voice_0_graph_source_left_labium_left_labium_aperture * (1.5 + 3.5 * voice_0_graph_source_left_labium_left_labium_flow_scale)) + (voice_0_graph_source_left_labium_left_labium_voicing * voice_0_graph_source_left_labium_left_labium_pressure_drive * (0.45 + 1.55 * (clip01(patch_param_4))))) / voice_0_graph_source_left_labium_left_labium_flow_resistance); + voice_0_graph_source_left_labium_left_labium_noise = voice_0_graph_source_left_labium_left_labium_turbulence * (clip01(0.018)) * voice_0_graph_source_left_labium_left_labium_pressure_drive * clip01(voice_0_graph_source_left_labium_left_labium_aperture) * (1.0 - 0.55 * (clip01(patch_param_4))) / voice_0_graph_source_left_labium_left_labium_flow_resistance; + voice_0_graph_source_left_labium_left_labium_out = (voice_0_graph_source_left_labium_left_labium_flow * voice_0_graph_source_left_labium_left_labium_flow_scale * (0.55 + 2.6 * voice_0_graph_source_left_labium_left_labium_pressure_drive) + voice_0_graph_source_left_labium_left_labium_noise) * ((1) * (1.0)); + voice_0_graph_node_incident_pressure_left_labium = (voice_0_graph_in_0_start) / 1; + voice_0_graph_node_source_left_labium = voice_0_graph_source_left_labium_left_labium_out; + voice_0_graph_node_incident_pressure_left_merge = (voice_0_graph_in_0_end) / 1; + voice_0_graph_node_source_left_merge = 0.0; + voice_0_graph_source_right_labium_right_labium_load_pressure = voice_0_graph_node_incident_pressure_right_labium; + voice_0_graph_source_right_labium_right_labium_stiffness_hint = max(0.00002, min(0.16, pow(2.0 * ma.PI * max(20.0, ((max(20, 980 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) / ma.SR, 2.0))); + voice_0_graph_source_right_labium_right_labium_flow_scale = max(0.0, 1.18); + voice_0_graph_source_right_labium_right_labium_tissue_loss = clip01(0.18); + voice_0_graph_source_right_labium_right_labium_aperture_shape = clip01(0.38); + voice_0_graph_source_right_labium_right_labium_flow_loss = max(0.0, 0.32); + voice_0_graph_source_right_labium_right_labium_reservoir_pressure = (clip01(patch_param_1)) * (max(0.0, 1)); + voice_0_graph_source_right_labium_right_labium_downstream_pressure = (max(0.0, 0.02)) + (max(0.0, 0.46)) * ma.tanh(voice_0_graph_source_right_labium_right_labium_load_pressure); + voice_0_graph_source_right_labium_right_labium_pressure_drive = max(0.0, voice_0_graph_source_right_labium_right_labium_reservoir_pressure - voice_0_graph_source_right_labium_right_labium_downstream_pressure); + voice_0_graph_source_right_labium_right_labium_stiffness = max(0.00002, (max(0.0, 0.036)) * (0.55 + 1.10 * (clip01(patch_param_5)))); + voice_0_graph_source_right_labium_right_labium_modal_frequency = max(45.0, min(10000.0, (ma.SR / (2.0 * ma.PI)) * sqrt(max(0.00002, voice_0_graph_source_right_labium_right_labium_stiffness) / (max(0.02, 0.25))))); + voice_0_graph_source_right_labium_right_labium_load_detune = 1.0 - 0.035 * ma.tanh(voice_0_graph_source_right_labium_right_labium_load_pressure * (max(0.0, 0.46))); + voice_0_graph_source_right_labium_right_labium_oscillation_threshold = 0.030 + 0.070 * (max(0.0, 0.12)) + 0.080 * voice_0_graph_source_right_labium_right_labium_tissue_loss + 0.18 * clip01(max(0.0, patch_param_3)); + voice_0_graph_source_right_labium_right_labium_oscillation_gate = clip01((voice_0_graph_source_right_labium_right_labium_pressure_drive - voice_0_graph_source_right_labium_right_labium_oscillation_threshold) * (3.0 + 1.6 * max(0.0, 1.0 - (max(0.0, 0.12))))); + voice_0_graph_source_right_labium_right_labium_modal_q = 3.0 + 22.0 * clip01((clip01(patch_param_1)) * (1.0 - 0.45 * (max(0.0, 0.12)) - 0.35 * voice_0_graph_source_right_labium_right_labium_tissue_loss) + 0.35 * (clip01(patch_param_5))); + voice_0_graph_source_right_labium_right_labium_modal_seed = (no.noise * 0.018 + voice_0_graph_source_right_labium_right_labium_pressure_drive * max(0.0, 0.22 - clip01(max(0.0, patch_param_3))) * 0.16); + voice_0_graph_source_right_labium_right_labium_modal_ring = voice_0_graph_source_right_labium_right_labium_modal_seed : fi.resonbp(voice_0_graph_source_right_labium_right_labium_modal_frequency, voice_0_graph_source_right_labium_right_labium_modal_q, 1); + voice_0_graph_source_right_labium_right_labium_modal_oscillator = os.osc(voice_0_graph_source_right_labium_right_labium_modal_frequency * voice_0_graph_source_right_labium_right_labium_load_detune) * voice_0_graph_source_right_labium_right_labium_oscillation_gate; + voice_0_graph_source_right_labium_right_labium_modal_tissue = (voice_0_graph_source_right_labium_right_labium_modal_oscillator * (0.70 + 0.80 * (clip01(patch_param_5))) + voice_0_graph_source_right_labium_right_labium_modal_ring * 0.35) * max(0.0, 1.0 - 0.35 * (max(0.0, 0.12)) - 0.45 * voice_0_graph_source_right_labium_right_labium_tissue_loss); + voice_0_graph_source_right_labium_right_labium_velocity_decay = min(0.9995, max(0.20, 1.0 - ((0.008 + 0.08 * (max(0.0, 0.12)) + 0.055 * voice_0_graph_source_right_labium_right_labium_tissue_loss) / (max(0.02, 0.25))))); + voice_0_graph_source_right_labium_right_labium_displacement_decay = min(0.9998, max(0.20, 1.0 - 0.0008 / (max(0.02, 0.25)))); + voice_0_graph_source_right_labium_right_labium_force = (voice_0_graph_source_right_labium_right_labium_pressure_drive * (0.0004 + 0.0024 * (1.0 - clip01(max(0.0, patch_param_3)))) - (max(0.0, 0.46)) * voice_0_graph_source_right_labium_right_labium_load_pressure * 0.001) / (max(0.02, 0.25)); + voice_0_graph_source_right_labium_right_labium_velocity = voice_0_graph_source_right_labium_right_labium_force : + ~ *(voice_0_graph_source_right_labium_right_labium_velocity_decay / (1.0 + 10.0 * voice_0_graph_source_right_labium_right_labium_stiffness + 0.4 * (max(0.0, 0.84)))); + voice_0_graph_source_right_labium_right_labium_displacement = voice_0_graph_source_right_labium_right_labium_velocity : + ~ *(voice_0_graph_source_right_labium_right_labium_displacement_decay / (1.0 + 1.5 * voice_0_graph_source_right_labium_right_labium_stiffness)); + voice_0_graph_source_right_labium_right_labium_aperture_linear = max(0.0, (max(0.0, 0.018)) + (max(0.0, patch_param_3)) + voice_0_graph_source_right_labium_right_labium_displacement - (max(0.0, 0.84)) * pow(voice_0_graph_source_right_labium_right_labium_displacement, 3.0)); + voice_0_graph_source_right_labium_right_labium_aperture = voice_0_graph_source_right_labium_right_labium_aperture_linear * (1.0 - 0.55 * voice_0_graph_source_right_labium_right_labium_aperture_shape) + pow(voice_0_graph_source_right_labium_right_labium_aperture_linear, 2.0) * (0.55 * voice_0_graph_source_right_labium_right_labium_aperture_shape); + voice_0_graph_source_right_labium_right_labium_flow_resistance = 1.0 + voice_0_graph_source_right_labium_right_labium_flow_loss * (0.35 + 1.8 / max(0.035, voice_0_graph_source_right_labium_right_labium_aperture + (max(0.0, 0.018)))); + voice_0_graph_source_right_labium_right_labium_turbulence = no.noise : fi.highpass(2, 1200.0 + 2800.0 * clip01(1.0 - voice_0_graph_source_right_labium_right_labium_aperture)); + voice_0_graph_source_right_labium_right_labium_voicing = voice_0_graph_source_right_labium_right_labium_modal_tissue * (0.18 + 1.45 * (clip01(patch_param_5))); + voice_0_graph_source_right_labium_right_labium_flow = ma.tanh(((voice_0_graph_source_right_labium_right_labium_pressure_drive * voice_0_graph_source_right_labium_right_labium_aperture * (1.5 + 3.5 * voice_0_graph_source_right_labium_right_labium_flow_scale)) + (voice_0_graph_source_right_labium_right_labium_voicing * voice_0_graph_source_right_labium_right_labium_pressure_drive * (0.45 + 1.55 * (clip01(patch_param_5))))) / voice_0_graph_source_right_labium_right_labium_flow_resistance); + voice_0_graph_source_right_labium_right_labium_noise = voice_0_graph_source_right_labium_right_labium_turbulence * (clip01(0.016)) * voice_0_graph_source_right_labium_right_labium_pressure_drive * clip01(voice_0_graph_source_right_labium_right_labium_aperture) * (1.0 - 0.55 * (clip01(patch_param_5))) / voice_0_graph_source_right_labium_right_labium_flow_resistance; + voice_0_graph_source_right_labium_right_labium_out = (voice_0_graph_source_right_labium_right_labium_flow * voice_0_graph_source_right_labium_right_labium_flow_scale * (0.55 + 2.6 * voice_0_graph_source_right_labium_right_labium_pressure_drive) + voice_0_graph_source_right_labium_right_labium_noise) * ((0.94) * (1.0)); + voice_0_graph_node_incident_pressure_right_labium = (voice_0_graph_in_1_start) / 1; + voice_0_graph_node_source_right_labium = voice_0_graph_source_right_labium_right_labium_out; + voice_0_graph_node_incident_pressure_right_merge = (voice_0_graph_in_1_end) / 1; + voice_0_graph_node_source_right_merge = 0.0; + voice_0_graph_node_incident_pressure_trachea_base = (voice_0_graph_in_2_start) / 1; + voice_0_graph_node_source_trachea_base = 0.0; + voice_0_graph_node_incident_pressure_beak = (voice_0_graph_in_2_end) / 1; + voice_0_graph_node_source_beak = 0.0; + voice_0_graph_connection_reflection_syrinx_merge_left_merge_0_end = (2.0 * (voice_0_graph_segment_area_0) - (voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2)) / max(0.000001, voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2); + voice_0_graph_connection_scattered_syrinx_merge_left_merge_0_end = voice_0_graph_connection_reflection_syrinx_merge_left_merge_0_end * voice_0_graph_in_0_end + (1.0 + voice_0_graph_connection_reflection_syrinx_merge_left_merge_0_end) * (voice_0_graph_in_1_end + voice_0_graph_in_2_start); + voice_0_graph_out_0_end = ((voice_0_graph_connection_scattered_syrinx_merge_left_merge_0_end) * (voice_0_graph_connection_coupling_syrinx_merge) + voice_0_graph_in_0_end * (1.0 - (voice_0_graph_connection_coupling_syrinx_merge)) + (voice_0_graph_node_source_left_merge) / 1) * voice_0_graph_connection_loss_syrinx_merge; + voice_0_graph_connection_reflection_syrinx_merge_right_merge_1_end = (2.0 * (voice_0_graph_segment_area_1) - (voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2)) / max(0.000001, voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2); + voice_0_graph_connection_scattered_syrinx_merge_right_merge_1_end = voice_0_graph_connection_reflection_syrinx_merge_right_merge_1_end * voice_0_graph_in_1_end + (1.0 + voice_0_graph_connection_reflection_syrinx_merge_right_merge_1_end) * (voice_0_graph_in_0_end + voice_0_graph_in_2_start); + voice_0_graph_out_1_end = ((voice_0_graph_connection_scattered_syrinx_merge_right_merge_1_end) * (voice_0_graph_connection_coupling_syrinx_merge) + voice_0_graph_in_1_end * (1.0 - (voice_0_graph_connection_coupling_syrinx_merge)) + (voice_0_graph_node_source_right_merge) / 1) * voice_0_graph_connection_loss_syrinx_merge; + voice_0_graph_connection_reflection_syrinx_merge_trachea_base_2_start = (2.0 * (voice_0_graph_segment_area_2) - (voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2)) / max(0.000001, voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2); + voice_0_graph_connection_scattered_syrinx_merge_trachea_base_2_start = voice_0_graph_connection_reflection_syrinx_merge_trachea_base_2_start * voice_0_graph_in_2_start + (1.0 + voice_0_graph_connection_reflection_syrinx_merge_trachea_base_2_start) * (voice_0_graph_in_0_end + voice_0_graph_in_1_end); + voice_0_graph_out_2_start = ((voice_0_graph_connection_scattered_syrinx_merge_trachea_base_2_start) * (voice_0_graph_connection_coupling_syrinx_merge) + voice_0_graph_in_2_start * (1.0 - (voice_0_graph_connection_coupling_syrinx_merge)) + (voice_0_graph_node_source_trachea_base) / 1) * voice_0_graph_connection_loss_syrinx_merge; + voice_0_graph_connection_energy_in_syrinx_merge = (voice_0_graph_segment_area_0) * pow(voice_0_graph_in_0_end, 2.0) + (voice_0_graph_segment_area_1) * pow(voice_0_graph_in_1_end, 2.0) + (voice_0_graph_segment_area_2) * pow(voice_0_graph_in_2_start, 2.0); + voice_0_graph_connection_energy_out_syrinx_merge = (voice_0_graph_segment_area_0) * pow(voice_0_graph_out_0_end, 2.0) + (voice_0_graph_segment_area_1) * pow(voice_0_graph_out_1_end, 2.0) + (voice_0_graph_segment_area_2) * pow(voice_0_graph_out_2_start, 2.0); + voice_0_graph_out_0_start = voice_0_graph_in_0_start * voice_0_graph_node_reflection_left_labium + (voice_0_graph_node_source_left_labium) / 1; + voice_0_graph_out_1_start = voice_0_graph_in_1_start * voice_0_graph_node_reflection_right_labium + (voice_0_graph_node_source_right_labium) / 1; + voice_0_graph_radiation_boundary_load_beak = clip01((voice_0_graph_radiation_admittance_beak) * (voice_0_graph_radiation_differentiation_beak) * (clip01(0.98))); + voice_0_graph_radiation_reflected_raw_beak = (voice_0_graph_in_2_end) * (voice_0_graph_terminal_reflection_beak) + (voice_0_graph_node_source_beak); + voice_0_graph_radiation_reflected_loaded_beak = (voice_0_graph_radiation_reflected_raw_beak) * (1.0 - (voice_0_graph_radiation_boundary_load_beak)) + ((voice_0_graph_radiation_reflected_raw_beak) : fi.lowpass(1, voice_0_graph_radiation_highpass_beak)) * (voice_0_graph_radiation_boundary_load_beak); + voice_0_graph_out_2_end = voice_0_graph_radiation_reflected_loaded_beak; + voice_0_graph_radiation_model_beak = 2; + voice_0_graph_radiation_reference_area_beak = max(0.10, 1.10 * 1.10 * (0.25 + 0.75 * clip01(pow(clip01((max(0.0, patch_param_6)) / 1.5), 2.0)))); + voice_0_graph_radiation_differentiation_beak = (0.50 + 0.22 * clip01(pow(clip01((max(0.0, patch_param_6)) / 1.5), 2.0))); + voice_0_graph_radiation_highpass_beak = (180.0 + 220.0 * clip01(pow(clip01((max(0.0, patch_param_6)) / 1.5), 2.0))); + voice_0_graph_radiation_admittance_beak = sqrt(clip01((voice_0_graph_terminal_area_beak) / max(0.000001, (voice_0_graph_terminal_area_beak) + (voice_0_graph_radiation_reference_area_beak)))); + voice_0_graph_radiation_flow_beak = ((voice_0_graph_in_2_end - voice_0_graph_out_2_end)); + voice_0_graph_delay_0 = max(0.000001, 0.00010496 * ma.SR); + voice_0_graph_segment_loss_0 = clip01((0.996) * ((0.996 - 0.018 * clip01(0.050 / max(0.000001, (voice_0_graph_segment_area_0) + 0.050))))); + voice_0_graph_next_r0 = voice_0_graph_out_0_start : de.fdelay(2048, min(2047, max(0.000001, voice_0_graph_delay_0))) * voice_0_graph_segment_loss_0; + voice_0_graph_next_l0 = voice_0_graph_out_0_end : de.fdelay(2048, min(2047, max(0.000001, voice_0_graph_delay_0))) * voice_0_graph_segment_loss_0; + voice_0_graph_delay_1 = max(0.000001, 0.00009913 * ma.SR); + voice_0_graph_segment_loss_1 = clip01((0.996) * ((0.996 - 0.018 * clip01(0.050 / max(0.000001, (voice_0_graph_segment_area_1) + 0.050))))); + voice_0_graph_next_r1 = voice_0_graph_out_1_start : de.fdelay(2048, min(2047, max(0.000001, voice_0_graph_delay_1))) * voice_0_graph_segment_loss_1; + voice_0_graph_next_l1 = voice_0_graph_out_1_end : de.fdelay(2048, min(2047, max(0.000001, voice_0_graph_delay_1))) * voice_0_graph_segment_loss_1; + voice_0_graph_delay_2 = max(0.000001, 0.00023907 * ma.SR); + voice_0_graph_segment_loss_2 = clip01((0.997) * (sqrt(clip01((voice_0_graph_segment_area_2) / max(0.000001, (voice_0_graph_segment_area_2) + 0.020))))); + voice_0_graph_next_r2 = voice_0_graph_out_2_start : de.fdelay(2048, min(2047, max(0.000001, voice_0_graph_delay_2))) * voice_0_graph_segment_loss_2; + voice_0_graph_next_l2 = voice_0_graph_out_2_end : de.fdelay(2048, min(2047, max(0.000001, voice_0_graph_delay_2))) * voice_0_graph_segment_loss_2; + voice_0_graph_out = (((voice_0_graph_radiation_flow_beak * (1.0 - (voice_0_graph_radiation_differentiation_beak)) + (voice_0_graph_radiation_flow_beak : fi.highpass(1, voice_0_graph_radiation_highpass_beak)) * (voice_0_graph_radiation_differentiation_beak)) * clip01(0.98) * voice_0_graph_radiation_admittance_beak)) * voice_0_graph_radiation_gain; + }; +}; +voice_0_acoustic_graph_radiated = voice_0_graph(voice_0_graph_drive); +voice_0_freq = ((max(20, 980 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = voice_0_acoustic_graph_radiated; +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.06, 0.82) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.24); + +process = softclip((voice_0) * 0.4); diff --git a/tools/aqua-playground/lowered/advanced-bird-syrinx.dsp b/tools/aqua-playground/lowered/advanced-bird-syrinx.dsp new file mode 100644 index 0000000..a1e8dd2 --- /dev/null +++ b/tools/aqua-playground/lowered/advanced-bird-syrinx.dsp @@ -0,0 +1,253 @@ +import("stdfaust.lib"); +declare name "advanced-bird-syrinx"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_param_0_base = hslider("/bird/left/pressure", 0.82, 0, 1, 0.001) : si.smoo; +patch_param_0_curve_time = max(0.0, age * 1 - 0); +patch_param_0_curve_value = select2(patch_param_0_curve_time < 0.035, select2(patch_param_0_curve_time < 0.32, select2(patch_param_0_curve_time < 0.78, select2(patch_param_0_curve_time < 1.08, 0.38, seg(patch_param_0_curve_time, 0.78, 0.3000001, 0.74, 0.38)), seg(patch_param_0_curve_time, 0.32, 0.46, 0.88, 0.74)), seg(patch_param_0_curve_time, 0.035, 0.285, 0.82, 0.88)), seg(patch_param_0_curve_time, 0, 0.035, 0.08, 0.82)); +patch_param_0_curve_depth = hslider("/curves/left_pressure/depth", 1, 0, 1, 0.001) : si.smoo; +patch_param_0 = min(1, max(0, patch_param_0_base * (1.0 - patch_param_0_curve_depth) + patch_param_0_curve_value * patch_param_0_curve_depth)); +patch_param_1_base = hslider("/bird/right/pressure", 0.7, 0, 1, 0.001) : si.smoo; +patch_param_1_curve_time = max(0.0, age * 1 - 0); +patch_param_1_curve_value = select2(patch_param_1_curve_time < 0.04, select2(patch_param_1_curve_time < 0.28, select2(patch_param_1_curve_time < 0.72, select2(patch_param_1_curve_time < 1.08, 0.28, seg(patch_param_1_curve_time, 0.72, 0.36, 0.62, 0.28)), seg(patch_param_1_curve_time, 0.28, 0.44, 0.74, 0.62)), seg(patch_param_1_curve_time, 0.04, 0.24, 0.68, 0.74)), seg(patch_param_1_curve_time, 0, 0.04, 0.04, 0.68)); +patch_param_1_curve_depth = hslider("/curves/right_pressure/depth", 1, 0, 1, 0.001) : si.smoo; +patch_param_1 = min(1, max(0, patch_param_1_base * (1.0 - patch_param_1_curve_depth) + patch_param_1_curve_value * patch_param_1_curve_depth)); +patch_param_2_base = hslider("/bird/left/opening", 0.24, 0, 1, 0.001) : si.smoo; +patch_param_2_curve_time = max(0.0, age * 1 - 0); +patch_param_2_curve_value = select2(patch_param_2_curve_time < 0.03, select2(patch_param_2_curve_time < 0.76, select2(patch_param_2_curve_time < 1.08, 0.04, seg(patch_param_2_curve_time, 0.76, 0.3200001, 0.2, 0.04)), seg(patch_param_2_curve_time, 0.03, 0.73, 0.24, 0.2)), seg(patch_param_2_curve_time, 0, 0.03, 0.02, 0.24)); +patch_param_2_curve_depth = hslider("/curves/left_opening/depth", 0.85, 0, 1, 0.001) : si.smoo; +patch_param_2 = min(1, max(0, patch_param_2_base * (1.0 - patch_param_2_curve_depth) + patch_param_2_curve_value * patch_param_2_curve_depth)); +patch_param_3_base = hslider("/bird/right/opening", 0.21, 0, 1, 0.001) : si.smoo; +patch_param_3_curve_time = max(0.0, age * 1 - 0); +patch_param_3_curve_value = select2(patch_param_3_curve_time < 0.035, select2(patch_param_3_curve_time < 0.7, select2(patch_param_3_curve_time < 1.08, 0.04, seg(patch_param_3_curve_time, 0.7, 0.3800001, 0.18, 0.04)), seg(patch_param_3_curve_time, 0.035, 0.665, 0.21, 0.18)), seg(patch_param_3_curve_time, 0, 0.035, 0.02, 0.21)); +patch_param_3_curve_depth = hslider("/curves/right_opening/depth", 0.85, 0, 1, 0.001) : si.smoo; +patch_param_3 = min(1, max(0, patch_param_3_base * (1.0 - patch_param_3_curve_depth) + patch_param_3_curve_value * patch_param_3_curve_depth)); +patch_param_4 = hslider("/bird/left/tension", 0.38, 0, 1, 0.001) : si.smoo; +patch_param_5 = hslider("/bird/right/tension", 0.45, 0, 1, 0.001) : si.smoo; +patch_param_6 = hslider("/bird/left/mass", 0.32, 0.02, 2, 0.001) : si.smoo; +patch_param_7 = hslider("/bird/right/mass", 0.34, 0.02, 2, 0.001) : si.smoo; +patch_param_8 = hslider("/bird/left/damping", 0.14, 0, 2, 0.001) : si.smoo; +patch_param_9 = hslider("/bird/right/damping", 0.16, 0, 2, 0.001) : si.smoo; +patch_param_10 = hslider("/bird/left/stiffness", 0.025, 0, 1, 0.001) : si.smoo; +patch_param_11 = hslider("/bird/right/stiffness", 0.03, 0, 1, 0.001) : si.smoo; +patch_param_12 = hslider("/bird/left/flow_scale", 1.2, 0, 4, 0.001) : si.smoo; +patch_param_13 = hslider("/bird/right/flow_scale", 1.1, 0, 4, 0.001) : si.smoo; +patch_param_14 = hslider("/bird/left/tissue_loss", 0.18, 0, 1, 0.001) : si.smoo; +patch_param_15 = hslider("/bird/right/tissue_loss", 0.2, 0, 1, 0.001) : si.smoo; +patch_param_16 = hslider("/bird/left/load_coupling", 0.42, 0, 2, 0.001) : si.smoo; +patch_param_17 = hslider("/bird/right/load_coupling", 0.42, 0, 2, 0.001) : si.smoo; +patch_param_18 = hslider("/bird/left/rest_opening", 0.025, 0, 1, 0.001) : si.smoo; +patch_param_19 = hslider("/bird/right/rest_opening", 0.025, 0, 1, 0.001) : si.smoo; +patch_param_20 = hslider("/bird/load", 0.85, 0, 2, 0.001) : si.smoo; +patch_param_21_base = hslider("/bird/beak/opening", 0.95, 0, 1.5, 0.001) : si.smoo; +patch_param_21_curve_time = max(0.0, age * 1 - 0); +patch_param_21_curve_value = select2(patch_param_21_curve_time < 0.06, select2(patch_param_21_curve_time < 0.82, select2(patch_param_21_curve_time < 1.08, 0.55, seg(patch_param_21_curve_time, 0.82, 0.2600001, 1.05, 0.55)), seg(patch_param_21_curve_time, 0.06, 0.76, 0.92, 1.05)), seg(patch_param_21_curve_time, 0, 0.06, 0.35, 0.92)); +patch_param_21_curve_depth = hslider("/curves/beak_opening/depth", 0.7, 0, 1, 0.001) : si.smoo; +patch_param_21 = min(1.5, max(0, patch_param_21_base * (1.0 - patch_param_21_curve_depth) + patch_param_21_curve_value * patch_param_21_curve_depth)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_graph_drive = 1.0; +voice_0_graph_terminal_area_left_merge = max(0.000001, 0.1764 * max(0.0, 1)); +voice_0_graph_terminal_reflection_left_merge = 0; +voice_0_graph_terminal_area_right_merge = max(0.000001, 0.16 * max(0.0, 1)); +voice_0_graph_terminal_reflection_right_merge = 0; +voice_0_graph_terminal_area_trachea_base = max(0.000001, 0.1444 * max(0.0, 1)); +voice_0_graph_terminal_reflection_trachea_base = 0; +voice_0_graph_terminal_area_left_labium = max(0.000001, 0.0484 * max(0.0, 1)); +voice_0_graph_terminal_reflection_left_labium = 0; +voice_0_graph_terminal_area_right_labium = max(0.000001, 0.04 * max(0.0, 1)); +voice_0_graph_terminal_reflection_right_labium = 0; +voice_0_graph_terminal_area_beak = max(0.000001, 0.2116 * max(0.0, 0.95)); +voice_0_graph_terminal_reflection_beak = ((0.96) * (1.0 - clip01(pow(clip01((max(0.0, patch_param_21)) / 1.5), 2.0))) + (-0.72) * clip01(pow(clip01((max(0.0, patch_param_21)) / 1.5), 2.0))); +voice_0_graph_node_area_left_labium = max(0.000001, voice_0_graph_terminal_area_left_labium); +voice_0_graph_node_reflection_left_labium = (voice_0_graph_terminal_reflection_left_labium) / 1; +voice_0_graph_node_area_left_merge = max(0.000001, voice_0_graph_terminal_area_left_merge); +voice_0_graph_node_reflection_left_merge = (voice_0_graph_terminal_reflection_left_merge) / 1; +voice_0_graph_node_area_right_labium = max(0.000001, voice_0_graph_terminal_area_right_labium); +voice_0_graph_node_reflection_right_labium = (voice_0_graph_terminal_reflection_right_labium) / 1; +voice_0_graph_node_area_right_merge = max(0.000001, voice_0_graph_terminal_area_right_merge); +voice_0_graph_node_reflection_right_merge = (voice_0_graph_terminal_reflection_right_merge) / 1; +voice_0_graph_node_area_trachea_base = max(0.000001, voice_0_graph_terminal_area_trachea_base); +voice_0_graph_node_reflection_trachea_base = (voice_0_graph_terminal_reflection_trachea_base) / 1; +voice_0_graph_node_area_beak = max(0.000001, voice_0_graph_terminal_area_beak); +voice_0_graph_node_reflection_beak = (voice_0_graph_terminal_reflection_beak) / 1; +voice_0_graph_segment_area_0 = max(0.000001, 0.1089); +voice_0_graph_segment_area_1 = max(0.000001, 0.0961); +voice_0_graph_segment_area_2 = max(0.000001, 0.2704); +voice_0_graph_connection_coupling_syrinx_merge = clip01(1); +voice_0_graph_connection_loss_syrinx_merge = clip01(1); +voice_0_graph_radiation_gain = 1.0; +voice_0_graph_source_left_labium = 0.0; +voice_0_graph_source_right_labium = 0.0; +voice_0_graph(x) = voice_0_graph_loop ~ si.bus(6) : (si.block(6), _) with { + voice_0_graph_loop(r0, r1, r2, l0, l1, l2) = voice_0_graph_next_r0, voice_0_graph_next_r1, voice_0_graph_next_r2, voice_0_graph_next_l0, voice_0_graph_next_l1, voice_0_graph_next_l2, voice_0_graph_out with { + voice_0_graph_in_0_start = l0; + voice_0_graph_in_0_end = r0; + voice_0_graph_in_1_start = l1; + voice_0_graph_in_1_end = r1; + voice_0_graph_in_2_start = l2; + voice_0_graph_in_2_end = r2; + voice_0_graph_source_left_labium_left_labium_load_pressure = voice_0_graph_node_incident_pressure_left_labium; + voice_0_graph_source_left_labium_left_labium_stiffness_hint = max(0.00002, min(0.16, pow(2.0 * ma.PI * max(20.0, ((max(20, 1120 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) / ma.SR, 2.0))); + voice_0_graph_source_left_labium_left_labium_flow_scale = max(0.0, patch_param_12); + voice_0_graph_source_left_labium_left_labium_tissue_loss = clip01(patch_param_14); + voice_0_graph_source_left_labium_left_labium_aperture_shape = clip01(0.4); + voice_0_graph_source_left_labium_left_labium_flow_loss = max(0.0, 0.35); + voice_0_graph_source_left_labium_left_labium_reservoir_pressure = (clip01(patch_param_0)) * (max(0.0, 1)); + voice_0_graph_source_left_labium_left_labium_downstream_pressure = (max(0.0, 0)) + (max(0.0, patch_param_16)) * ma.tanh(voice_0_graph_source_left_labium_left_labium_load_pressure); + voice_0_graph_source_left_labium_left_labium_pressure_drive = max(0.0, voice_0_graph_source_left_labium_left_labium_reservoir_pressure - voice_0_graph_source_left_labium_left_labium_downstream_pressure); + voice_0_graph_source_left_labium_left_labium_stiffness = max(0.00002, (max(0.0, patch_param_10)) * (0.55 + 1.10 * (clip01(patch_param_4)))); + voice_0_graph_source_left_labium_left_labium_modal_frequency = max(45.0, min(10000.0, (ma.SR / (2.0 * ma.PI)) * sqrt(max(0.00002, voice_0_graph_source_left_labium_left_labium_stiffness) / (max(0.02, patch_param_6))))); + voice_0_graph_source_left_labium_left_labium_load_detune = 1.0 - 0.035 * ma.tanh(voice_0_graph_source_left_labium_left_labium_load_pressure * (max(0.0, patch_param_16))); + voice_0_graph_source_left_labium_left_labium_oscillation_threshold = 0.030 + 0.070 * (max(0.0, patch_param_8)) + 0.080 * voice_0_graph_source_left_labium_left_labium_tissue_loss + 0.18 * clip01(max(0.0, patch_param_2)); + voice_0_graph_source_left_labium_left_labium_oscillation_gate = clip01((voice_0_graph_source_left_labium_left_labium_pressure_drive - voice_0_graph_source_left_labium_left_labium_oscillation_threshold) * (3.0 + 1.6 * max(0.0, 1.0 - (max(0.0, patch_param_8))))); + voice_0_graph_source_left_labium_left_labium_modal_q = 3.0 + 22.0 * clip01((clip01(patch_param_0)) * (1.0 - 0.45 * (max(0.0, patch_param_8)) - 0.35 * voice_0_graph_source_left_labium_left_labium_tissue_loss) + 0.35 * (clip01(patch_param_4))); + voice_0_graph_source_left_labium_left_labium_modal_seed = (no.noise * 0.018 + voice_0_graph_source_left_labium_left_labium_pressure_drive * max(0.0, 0.22 - clip01(max(0.0, patch_param_2))) * 0.16); + voice_0_graph_source_left_labium_left_labium_modal_ring = voice_0_graph_source_left_labium_left_labium_modal_seed : fi.resonbp(voice_0_graph_source_left_labium_left_labium_modal_frequency, voice_0_graph_source_left_labium_left_labium_modal_q, 1); + voice_0_graph_source_left_labium_left_labium_modal_oscillator = os.osc(voice_0_graph_source_left_labium_left_labium_modal_frequency * voice_0_graph_source_left_labium_left_labium_load_detune) * voice_0_graph_source_left_labium_left_labium_oscillation_gate; + voice_0_graph_source_left_labium_left_labium_modal_tissue = (voice_0_graph_source_left_labium_left_labium_modal_oscillator * (0.70 + 0.80 * (clip01(patch_param_4))) + voice_0_graph_source_left_labium_left_labium_modal_ring * 0.35) * max(0.0, 1.0 - 0.35 * (max(0.0, patch_param_8)) - 0.45 * voice_0_graph_source_left_labium_left_labium_tissue_loss); + voice_0_graph_source_left_labium_left_labium_velocity_decay = min(0.9995, max(0.20, 1.0 - ((0.008 + 0.08 * (max(0.0, patch_param_8)) + 0.055 * voice_0_graph_source_left_labium_left_labium_tissue_loss) / (max(0.02, patch_param_6))))); + voice_0_graph_source_left_labium_left_labium_displacement_decay = min(0.9998, max(0.20, 1.0 - 0.0008 / (max(0.02, patch_param_6)))); + voice_0_graph_source_left_labium_left_labium_force = (voice_0_graph_source_left_labium_left_labium_pressure_drive * (0.0004 + 0.0024 * (1.0 - clip01(max(0.0, patch_param_2)))) - (max(0.0, patch_param_16)) * voice_0_graph_source_left_labium_left_labium_load_pressure * 0.001) / (max(0.02, patch_param_6)); + voice_0_graph_source_left_labium_left_labium_velocity = voice_0_graph_source_left_labium_left_labium_force : + ~ *(voice_0_graph_source_left_labium_left_labium_velocity_decay / (1.0 + 10.0 * voice_0_graph_source_left_labium_left_labium_stiffness + 0.4 * (max(0.0, 0.9)))); + voice_0_graph_source_left_labium_left_labium_displacement = voice_0_graph_source_left_labium_left_labium_velocity : + ~ *(voice_0_graph_source_left_labium_left_labium_displacement_decay / (1.0 + 1.5 * voice_0_graph_source_left_labium_left_labium_stiffness)); + voice_0_graph_source_left_labium_left_labium_aperture_linear = max(0.0, (max(0.0, patch_param_18)) + (max(0.0, patch_param_2)) + voice_0_graph_source_left_labium_left_labium_displacement - (max(0.0, 0.9)) * pow(voice_0_graph_source_left_labium_left_labium_displacement, 3.0)); + voice_0_graph_source_left_labium_left_labium_aperture = voice_0_graph_source_left_labium_left_labium_aperture_linear * (1.0 - 0.55 * voice_0_graph_source_left_labium_left_labium_aperture_shape) + pow(voice_0_graph_source_left_labium_left_labium_aperture_linear, 2.0) * (0.55 * voice_0_graph_source_left_labium_left_labium_aperture_shape); + voice_0_graph_source_left_labium_left_labium_flow_resistance = 1.0 + voice_0_graph_source_left_labium_left_labium_flow_loss * (0.35 + 1.8 / max(0.035, voice_0_graph_source_left_labium_left_labium_aperture + (max(0.0, patch_param_18)))); + voice_0_graph_source_left_labium_left_labium_turbulence = no.noise : fi.highpass(2, 1200.0 + 2800.0 * clip01(1.0 - voice_0_graph_source_left_labium_left_labium_aperture)); + voice_0_graph_source_left_labium_left_labium_voicing = voice_0_graph_source_left_labium_left_labium_modal_tissue * (0.18 + 1.45 * (clip01(patch_param_4))); + voice_0_graph_source_left_labium_left_labium_flow = ma.tanh(((voice_0_graph_source_left_labium_left_labium_pressure_drive * voice_0_graph_source_left_labium_left_labium_aperture * (1.5 + 3.5 * voice_0_graph_source_left_labium_left_labium_flow_scale)) + (voice_0_graph_source_left_labium_left_labium_voicing * voice_0_graph_source_left_labium_left_labium_pressure_drive * (0.45 + 1.55 * (clip01(patch_param_4))))) / voice_0_graph_source_left_labium_left_labium_flow_resistance); + voice_0_graph_source_left_labium_left_labium_noise = voice_0_graph_source_left_labium_left_labium_turbulence * (clip01(0.025)) * voice_0_graph_source_left_labium_left_labium_pressure_drive * clip01(voice_0_graph_source_left_labium_left_labium_aperture) * (1.0 - 0.55 * (clip01(patch_param_4))) / voice_0_graph_source_left_labium_left_labium_flow_resistance; + voice_0_graph_source_left_labium_left_labium_out = (voice_0_graph_source_left_labium_left_labium_flow * voice_0_graph_source_left_labium_left_labium_flow_scale * (0.55 + 2.6 * voice_0_graph_source_left_labium_left_labium_pressure_drive) + voice_0_graph_source_left_labium_left_labium_noise) * ((1) * (1.0)); + voice_0_graph_node_incident_pressure_left_labium = (voice_0_graph_in_0_start) / 1; + voice_0_graph_node_source_left_labium = voice_0_graph_source_left_labium_left_labium_out; + voice_0_graph_node_incident_pressure_left_merge = (voice_0_graph_in_0_end) / 1; + voice_0_graph_node_source_left_merge = 0.0; + voice_0_graph_source_right_labium_right_labium_load_pressure = voice_0_graph_node_incident_pressure_right_labium; + voice_0_graph_source_right_labium_right_labium_stiffness_hint = max(0.00002, min(0.16, pow(2.0 * ma.PI * max(20.0, ((max(20, 1120 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) / ma.SR, 2.0))); + voice_0_graph_source_right_labium_right_labium_flow_scale = max(0.0, patch_param_13); + voice_0_graph_source_right_labium_right_labium_tissue_loss = clip01(patch_param_15); + voice_0_graph_source_right_labium_right_labium_aperture_shape = clip01(0.4); + voice_0_graph_source_right_labium_right_labium_flow_loss = max(0.0, 0.35); + voice_0_graph_source_right_labium_right_labium_reservoir_pressure = (clip01(patch_param_1)) * (max(0.0, 1)); + voice_0_graph_source_right_labium_right_labium_downstream_pressure = (max(0.0, 0)) + (max(0.0, patch_param_17)) * ma.tanh(voice_0_graph_source_right_labium_right_labium_load_pressure); + voice_0_graph_source_right_labium_right_labium_pressure_drive = max(0.0, voice_0_graph_source_right_labium_right_labium_reservoir_pressure - voice_0_graph_source_right_labium_right_labium_downstream_pressure); + voice_0_graph_source_right_labium_right_labium_stiffness = max(0.00002, (max(0.0, patch_param_11)) * (0.55 + 1.10 * (clip01(patch_param_5)))); + voice_0_graph_source_right_labium_right_labium_modal_frequency = max(45.0, min(10000.0, (ma.SR / (2.0 * ma.PI)) * sqrt(max(0.00002, voice_0_graph_source_right_labium_right_labium_stiffness) / (max(0.02, patch_param_7))))); + voice_0_graph_source_right_labium_right_labium_load_detune = 1.0 - 0.035 * ma.tanh(voice_0_graph_source_right_labium_right_labium_load_pressure * (max(0.0, patch_param_17))); + voice_0_graph_source_right_labium_right_labium_oscillation_threshold = 0.030 + 0.070 * (max(0.0, patch_param_9)) + 0.080 * voice_0_graph_source_right_labium_right_labium_tissue_loss + 0.18 * clip01(max(0.0, patch_param_3)); + voice_0_graph_source_right_labium_right_labium_oscillation_gate = clip01((voice_0_graph_source_right_labium_right_labium_pressure_drive - voice_0_graph_source_right_labium_right_labium_oscillation_threshold) * (3.0 + 1.6 * max(0.0, 1.0 - (max(0.0, patch_param_9))))); + voice_0_graph_source_right_labium_right_labium_modal_q = 3.0 + 22.0 * clip01((clip01(patch_param_1)) * (1.0 - 0.45 * (max(0.0, patch_param_9)) - 0.35 * voice_0_graph_source_right_labium_right_labium_tissue_loss) + 0.35 * (clip01(patch_param_5))); + voice_0_graph_source_right_labium_right_labium_modal_seed = (no.noise * 0.018 + voice_0_graph_source_right_labium_right_labium_pressure_drive * max(0.0, 0.22 - clip01(max(0.0, patch_param_3))) * 0.16); + voice_0_graph_source_right_labium_right_labium_modal_ring = voice_0_graph_source_right_labium_right_labium_modal_seed : fi.resonbp(voice_0_graph_source_right_labium_right_labium_modal_frequency, voice_0_graph_source_right_labium_right_labium_modal_q, 1); + voice_0_graph_source_right_labium_right_labium_modal_oscillator = os.osc(voice_0_graph_source_right_labium_right_labium_modal_frequency * voice_0_graph_source_right_labium_right_labium_load_detune) * voice_0_graph_source_right_labium_right_labium_oscillation_gate; + voice_0_graph_source_right_labium_right_labium_modal_tissue = (voice_0_graph_source_right_labium_right_labium_modal_oscillator * (0.70 + 0.80 * (clip01(patch_param_5))) + voice_0_graph_source_right_labium_right_labium_modal_ring * 0.35) * max(0.0, 1.0 - 0.35 * (max(0.0, patch_param_9)) - 0.45 * voice_0_graph_source_right_labium_right_labium_tissue_loss); + voice_0_graph_source_right_labium_right_labium_velocity_decay = min(0.9995, max(0.20, 1.0 - ((0.008 + 0.08 * (max(0.0, patch_param_9)) + 0.055 * voice_0_graph_source_right_labium_right_labium_tissue_loss) / (max(0.02, patch_param_7))))); + voice_0_graph_source_right_labium_right_labium_displacement_decay = min(0.9998, max(0.20, 1.0 - 0.0008 / (max(0.02, patch_param_7)))); + voice_0_graph_source_right_labium_right_labium_force = (voice_0_graph_source_right_labium_right_labium_pressure_drive * (0.0004 + 0.0024 * (1.0 - clip01(max(0.0, patch_param_3)))) - (max(0.0, patch_param_17)) * voice_0_graph_source_right_labium_right_labium_load_pressure * 0.001) / (max(0.02, patch_param_7)); + voice_0_graph_source_right_labium_right_labium_velocity = voice_0_graph_source_right_labium_right_labium_force : + ~ *(voice_0_graph_source_right_labium_right_labium_velocity_decay / (1.0 + 10.0 * voice_0_graph_source_right_labium_right_labium_stiffness + 0.4 * (max(0.0, 0.9)))); + voice_0_graph_source_right_labium_right_labium_displacement = voice_0_graph_source_right_labium_right_labium_velocity : + ~ *(voice_0_graph_source_right_labium_right_labium_displacement_decay / (1.0 + 1.5 * voice_0_graph_source_right_labium_right_labium_stiffness)); + voice_0_graph_source_right_labium_right_labium_aperture_linear = max(0.0, (max(0.0, patch_param_19)) + (max(0.0, patch_param_3)) + voice_0_graph_source_right_labium_right_labium_displacement - (max(0.0, 0.9)) * pow(voice_0_graph_source_right_labium_right_labium_displacement, 3.0)); + voice_0_graph_source_right_labium_right_labium_aperture = voice_0_graph_source_right_labium_right_labium_aperture_linear * (1.0 - 0.55 * voice_0_graph_source_right_labium_right_labium_aperture_shape) + pow(voice_0_graph_source_right_labium_right_labium_aperture_linear, 2.0) * (0.55 * voice_0_graph_source_right_labium_right_labium_aperture_shape); + voice_0_graph_source_right_labium_right_labium_flow_resistance = 1.0 + voice_0_graph_source_right_labium_right_labium_flow_loss * (0.35 + 1.8 / max(0.035, voice_0_graph_source_right_labium_right_labium_aperture + (max(0.0, patch_param_19)))); + voice_0_graph_source_right_labium_right_labium_turbulence = no.noise : fi.highpass(2, 1200.0 + 2800.0 * clip01(1.0 - voice_0_graph_source_right_labium_right_labium_aperture)); + voice_0_graph_source_right_labium_right_labium_voicing = voice_0_graph_source_right_labium_right_labium_modal_tissue * (0.18 + 1.45 * (clip01(patch_param_5))); + voice_0_graph_source_right_labium_right_labium_flow = ma.tanh(((voice_0_graph_source_right_labium_right_labium_pressure_drive * voice_0_graph_source_right_labium_right_labium_aperture * (1.5 + 3.5 * voice_0_graph_source_right_labium_right_labium_flow_scale)) + (voice_0_graph_source_right_labium_right_labium_voicing * voice_0_graph_source_right_labium_right_labium_pressure_drive * (0.45 + 1.55 * (clip01(patch_param_5))))) / voice_0_graph_source_right_labium_right_labium_flow_resistance); + voice_0_graph_source_right_labium_right_labium_noise = voice_0_graph_source_right_labium_right_labium_turbulence * (clip01(0.02)) * voice_0_graph_source_right_labium_right_labium_pressure_drive * clip01(voice_0_graph_source_right_labium_right_labium_aperture) * (1.0 - 0.55 * (clip01(patch_param_5))) / voice_0_graph_source_right_labium_right_labium_flow_resistance; + voice_0_graph_source_right_labium_right_labium_out = (voice_0_graph_source_right_labium_right_labium_flow * voice_0_graph_source_right_labium_right_labium_flow_scale * (0.55 + 2.6 * voice_0_graph_source_right_labium_right_labium_pressure_drive) + voice_0_graph_source_right_labium_right_labium_noise) * ((0.96) * (1.0)); + voice_0_graph_node_incident_pressure_right_labium = (voice_0_graph_in_1_start) / 1; + voice_0_graph_node_source_right_labium = voice_0_graph_source_right_labium_right_labium_out; + voice_0_graph_node_incident_pressure_right_merge = (voice_0_graph_in_1_end) / 1; + voice_0_graph_node_source_right_merge = 0.0; + voice_0_graph_node_incident_pressure_trachea_base = (voice_0_graph_in_2_start) / 1; + voice_0_graph_node_source_trachea_base = 0.0; + voice_0_graph_node_incident_pressure_beak = (voice_0_graph_in_2_end) / 1; + voice_0_graph_node_source_beak = 0.0; + voice_0_graph_connection_reflection_syrinx_merge_left_merge_0_end = (2.0 * (voice_0_graph_segment_area_0) - (voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2)) / max(0.000001, voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2); + voice_0_graph_connection_scattered_syrinx_merge_left_merge_0_end = voice_0_graph_connection_reflection_syrinx_merge_left_merge_0_end * voice_0_graph_in_0_end + (1.0 + voice_0_graph_connection_reflection_syrinx_merge_left_merge_0_end) * (voice_0_graph_in_1_end + voice_0_graph_in_2_start); + voice_0_graph_out_0_end = ((voice_0_graph_connection_scattered_syrinx_merge_left_merge_0_end) * (voice_0_graph_connection_coupling_syrinx_merge) + voice_0_graph_in_0_end * (1.0 - (voice_0_graph_connection_coupling_syrinx_merge)) + (voice_0_graph_node_source_left_merge) / 1) * voice_0_graph_connection_loss_syrinx_merge; + voice_0_graph_connection_reflection_syrinx_merge_right_merge_1_end = (2.0 * (voice_0_graph_segment_area_1) - (voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2)) / max(0.000001, voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2); + voice_0_graph_connection_scattered_syrinx_merge_right_merge_1_end = voice_0_graph_connection_reflection_syrinx_merge_right_merge_1_end * voice_0_graph_in_1_end + (1.0 + voice_0_graph_connection_reflection_syrinx_merge_right_merge_1_end) * (voice_0_graph_in_0_end + voice_0_graph_in_2_start); + voice_0_graph_out_1_end = ((voice_0_graph_connection_scattered_syrinx_merge_right_merge_1_end) * (voice_0_graph_connection_coupling_syrinx_merge) + voice_0_graph_in_1_end * (1.0 - (voice_0_graph_connection_coupling_syrinx_merge)) + (voice_0_graph_node_source_right_merge) / 1) * voice_0_graph_connection_loss_syrinx_merge; + voice_0_graph_connection_reflection_syrinx_merge_trachea_base_2_start = (2.0 * (voice_0_graph_segment_area_2) - (voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2)) / max(0.000001, voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2); + voice_0_graph_connection_scattered_syrinx_merge_trachea_base_2_start = voice_0_graph_connection_reflection_syrinx_merge_trachea_base_2_start * voice_0_graph_in_2_start + (1.0 + voice_0_graph_connection_reflection_syrinx_merge_trachea_base_2_start) * (voice_0_graph_in_0_end + voice_0_graph_in_1_end); + voice_0_graph_out_2_start = ((voice_0_graph_connection_scattered_syrinx_merge_trachea_base_2_start) * (voice_0_graph_connection_coupling_syrinx_merge) + voice_0_graph_in_2_start * (1.0 - (voice_0_graph_connection_coupling_syrinx_merge)) + (voice_0_graph_node_source_trachea_base) / 1) * voice_0_graph_connection_loss_syrinx_merge; + voice_0_graph_connection_energy_in_syrinx_merge = (voice_0_graph_segment_area_0) * pow(voice_0_graph_in_0_end, 2.0) + (voice_0_graph_segment_area_1) * pow(voice_0_graph_in_1_end, 2.0) + (voice_0_graph_segment_area_2) * pow(voice_0_graph_in_2_start, 2.0); + voice_0_graph_connection_energy_out_syrinx_merge = (voice_0_graph_segment_area_0) * pow(voice_0_graph_out_0_end, 2.0) + (voice_0_graph_segment_area_1) * pow(voice_0_graph_out_1_end, 2.0) + (voice_0_graph_segment_area_2) * pow(voice_0_graph_out_2_start, 2.0); + voice_0_graph_out_0_start = voice_0_graph_in_0_start * voice_0_graph_node_reflection_left_labium + (voice_0_graph_node_source_left_labium) / 1; + voice_0_graph_out_1_start = voice_0_graph_in_1_start * voice_0_graph_node_reflection_right_labium + (voice_0_graph_node_source_right_labium) / 1; + voice_0_graph_radiation_boundary_load_beak = clip01((voice_0_graph_radiation_admittance_beak) * (voice_0_graph_radiation_differentiation_beak) * (clip01(1))); + voice_0_graph_radiation_reflected_raw_beak = (voice_0_graph_in_2_end) * (voice_0_graph_terminal_reflection_beak) + (voice_0_graph_node_source_beak); + voice_0_graph_radiation_reflected_loaded_beak = (voice_0_graph_radiation_reflected_raw_beak) * (1.0 - (voice_0_graph_radiation_boundary_load_beak)) + ((voice_0_graph_radiation_reflected_raw_beak) : fi.lowpass(1, voice_0_graph_radiation_highpass_beak)) * (voice_0_graph_radiation_boundary_load_beak); + voice_0_graph_out_2_end = voice_0_graph_radiation_reflected_loaded_beak; + voice_0_graph_radiation_model_beak = 2; + voice_0_graph_radiation_reference_area_beak = max(0.10, 1.10 * 1.10 * (0.25 + 0.75 * clip01(pow(clip01((max(0.0, patch_param_21)) / 1.5), 2.0)))); + voice_0_graph_radiation_differentiation_beak = (0.50 + 0.22 * clip01(pow(clip01((max(0.0, patch_param_21)) / 1.5), 2.0))); + voice_0_graph_radiation_highpass_beak = (180.0 + 220.0 * clip01(pow(clip01((max(0.0, patch_param_21)) / 1.5), 2.0))); + voice_0_graph_radiation_admittance_beak = sqrt(clip01((voice_0_graph_terminal_area_beak) / max(0.000001, (voice_0_graph_terminal_area_beak) + (voice_0_graph_radiation_reference_area_beak)))); + voice_0_graph_radiation_flow_beak = ((voice_0_graph_in_2_end - voice_0_graph_out_2_end)); + voice_0_graph_delay_0 = max(0.000001, 0.00011079 * ma.SR); + voice_0_graph_segment_loss_0 = clip01((0.999) * (sqrt(clip01((voice_0_graph_segment_area_0) / max(0.000001, (voice_0_graph_segment_area_0) + 0.02))))); + voice_0_graph_next_r0 = voice_0_graph_out_0_start : de.fdelay(1024, min(1023, max(0.000001, voice_0_graph_delay_0))) * voice_0_graph_segment_loss_0; + voice_0_graph_next_l0 = voice_0_graph_out_0_end : de.fdelay(1024, min(1023, max(0.000001, voice_0_graph_delay_0))) * voice_0_graph_segment_loss_0; + voice_0_graph_delay_1 = max(0.000001, 0.00010496 * ma.SR); + voice_0_graph_segment_loss_1 = clip01((0.999) * (sqrt(clip01((voice_0_graph_segment_area_1) / max(0.000001, (voice_0_graph_segment_area_1) + 0.02))))); + voice_0_graph_next_r1 = voice_0_graph_out_1_start : de.fdelay(1024, min(1023, max(0.000001, voice_0_graph_delay_1))) * voice_0_graph_segment_loss_1; + voice_0_graph_next_l1 = voice_0_graph_out_1_end : de.fdelay(1024, min(1023, max(0.000001, voice_0_graph_delay_1))) * voice_0_graph_segment_loss_1; + voice_0_graph_delay_2 = max(0.000001, 0.0002449 * ma.SR); + voice_0_graph_segment_loss_2 = clip01((0.999) * (sqrt(clip01((voice_0_graph_segment_area_2) / max(0.000001, (voice_0_graph_segment_area_2) + 0.02))))); + voice_0_graph_next_r2 = voice_0_graph_out_2_start : de.fdelay(1024, min(1023, max(0.000001, voice_0_graph_delay_2))) * voice_0_graph_segment_loss_2; + voice_0_graph_next_l2 = voice_0_graph_out_2_end : de.fdelay(1024, min(1023, max(0.000001, voice_0_graph_delay_2))) * voice_0_graph_segment_loss_2; + voice_0_graph_out = (((voice_0_graph_radiation_flow_beak * (1.0 - (voice_0_graph_radiation_differentiation_beak)) + (voice_0_graph_radiation_flow_beak : fi.highpass(1, voice_0_graph_radiation_highpass_beak)) * (voice_0_graph_radiation_differentiation_beak)) * clip01(1) * voice_0_graph_radiation_admittance_beak)) * voice_0_graph_radiation_gain; + }; +}; +voice_0_acoustic_graph_radiated = voice_0_graph(voice_0_graph_drive); +voice_0_freq = ((max(20, 1120 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = voice_0_acoustic_graph_radiated; +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.08, 1.08) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.32); + +process = softclip((voice_0) * 0.42); diff --git a/tools/aqua-playground/lowered/advanced-glass-creature.dsp b/tools/aqua-playground/lowered/advanced-glass-creature.dsp new file mode 100644 index 0000000..23ffaa6 --- /dev/null +++ b/tools/aqua-playground/lowered/advanced-glass-creature.dsp @@ -0,0 +1,98 @@ +import("stdfaust.lib"); +declare name "advanced-glass-creature"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0 + 0.18 * lfo_sin(1.8, 0); +patch_mod_pitch = 0 + 0.02 * lfo_sin(1.8, 0); +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0 + 0.8 * lfo_sin(1.8, 0); + +voice_0_age = age; +voice_0_freq = ((max(20, 523.25 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age))) * (1.0 + select2(voice_0_age < 0, 0.0, sin(2.0 * ma.PI * (voice_0_age - 0) * 6.4) * 0.018))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = 1.0 - 4.0 * abs(wrap01(os.phasor(1.0, ((max(20, 523.25 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age))) * (1.0 + select2(voice_0_age < 0, 0.0, sin(2.0 * ma.PI * (voice_0_age - 0) * 6.4) * 0.018))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 523.25 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age))) * (1.0 + select2(voice_0_age < 0, 0.0, sin(2.0 * ma.PI * (voice_0_age - 0) * 6.4) * 0.018))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 3.5))) * (max(0.0, 2.8 + patch_mod_fm_index + 0.0) * exp(-voice_0_age / max(0.5, 0.0001))) / ma.PI) - 0.5); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.92 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.03 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.03 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0.002, 0, 0.8928571, 1.05, 0.18) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.1344); + +voice_1_age = age; +voice_1_freq = ((max(20, 659.25 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age))) * (1.0 + select2(voice_1_age < 0, 0.0, sin(2.0 * ma.PI * (voice_1_age - 0) * 6.4) * 0.018))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = 1.0 - 4.0 * abs(wrap01(os.phasor(1.0, ((max(20, 659.25 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age))) * (1.0 + select2(voice_1_age < 0, 0.0, sin(2.0 * ma.PI * (voice_1_age - 0) * 6.4) * 0.018))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 659.25 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age))) * (1.0 + select2(voice_1_age < 0, 0.0, sin(2.0 * ma.PI * (voice_1_age - 0) * 6.4) * 0.018))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 4.2))) * (max(0.0, 2.8 + patch_mod_fm_index + 0.0) * exp(-voice_1_age / max(0.5, 0.0001))) / ma.PI) - 0.5); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.92 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.03 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.03 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0.002, 0, 1, 0.84, 0.11) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.08); + +voice_2_age = age; +voice_2_freq = ((max(20, 783.99 * pow(2.0, 0 * voice_2_age + 0.5 * 0 * voice_2_age * voice_2_age))) * (1.0 + select2(voice_2_age < 0, 0.0, sin(2.0 * ma.PI * (voice_2_age - 0) * 6.4) * 0.018))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_2_osc = 1.0 - 4.0 * abs(wrap01(os.phasor(1.0, ((max(20, 783.99 * pow(2.0, 0 * voice_2_age + 0.5 * 0 * voice_2_age * voice_2_age))) * (1.0 + select2(voice_2_age < 0, 0.0, sin(2.0 * ma.PI * (voice_2_age - 0) * 6.4) * 0.018))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 783.99 * pow(2.0, 0 * voice_2_age + 0.5 * 0 * voice_2_age * voice_2_age))) * (1.0 + select2(voice_2_age < 0, 0.0, sin(2.0 * ma.PI * (voice_2_age - 0) * 6.4) * 0.018))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 3.5))) * (max(0.0, 1.9 + patch_mod_fm_index + 0.0) * exp(-voice_2_age / max(0.5, 0.0001))) / ma.PI) - 0.5); +voice_2_colored = (voice_2_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_2_driven = ma.tanh(voice_2_colored * (1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0); +voice_2_folded = voice_2_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_2_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_2_filtered = voice_2_folded : fi.lowpass(1, max(20.0, clip01(0.92 * (1.0 + 0 * voice_2_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.03 * (1.0 + 0 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.03 * (1.0 + 0 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_2_phased = voice_2_filtered; +voice_2_formants = voice_2_phased; +voice_2 = ((voice_2_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_2_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_2_age, 0.002, 0, 1, 0.72, 0.08) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.07); + +voice_3_age = age; +voice_3_freq = ((max(20, 261.63 * pow(2.0, 0 * voice_3_age + 0.5 * 0 * voice_3_age * voice_3_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_3_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 261.63 * pow(2.0, 0 * voice_3_age + 0.5 * 0 * voice_3_age * voice_3_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 261.63 * pow(2.0, 0 * voice_3_age + 0.5 * 0 * voice_3_age * voice_3_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 1.5))) * (max(0.0, 0.65 + patch_mod_fm_index + 0.0) * exp(-voice_3_age / max(1.2, 0.0001))) / ma.PI)); +voice_3_colored = (voice_3_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_3_driven = ma.tanh(voice_3_colored * (1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0); +voice_3_folded = voice_3_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_3_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_3_filtered = voice_3_folded : fi.lowpass(1, max(20.0, clip01(0.92 * (1.0 + 0 * voice_3_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.03 * (1.0 + 0 * voice_3_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.03 * (1.0 + 0 * voice_3_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_3_phased = voice_3_filtered; +voice_3_formants = voice_3_phased; +voice_3 = ((voice_3_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_3_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_3_age, 0.002, 0, 1, 1.3, 0.7) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.045); + +voice_4_age = age; +voice_4_freq = ((max(20, 2400 * pow(2.0, 0 * voice_4_age + 0.5 * 0 * voice_4_age * voice_4_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_4_osc = no.noise; +voice_4_colored = (voice_4_osc * (1.0 - clip01(0.9 + patch_mod_noise + 0.0)) + no.noise * clip01(0.9 + patch_mod_noise + 0.0)); +voice_4_driven = ma.tanh(voice_4_colored * (1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0); +voice_4_folded = voice_4_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_4_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_4_filtered = voice_4_folded : fi.lowpass(1, max(20.0, clip01(0.5 * (1.0 + 0 * voice_4_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.72 * (1.0 + 0 * voice_4_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.72 * (1.0 + 0 * voice_4_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_4_phased = voice_4_filtered; +voice_4_formants = voice_4_phased; +voice_4 = ((voice_4_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_4_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_4_age, 0.002, 0, 1, 0.55, 0.04) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.012); + +process = softclip((voice_0 + voice_1 + voice_2 + voice_3 + voice_4) * 0.52); diff --git a/tools/aqua-playground/lowered/advanced-human-larynx-graph.dsp b/tools/aqua-playground/lowered/advanced-human-larynx-graph.dsp new file mode 100644 index 0000000..1373aa3 --- /dev/null +++ b/tools/aqua-playground/lowered/advanced-human-larynx-graph.dsp @@ -0,0 +1,185 @@ +import("stdfaust.lib"); +declare name "advanced-human-larynx-graph"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_param_0_base = hslider("/human/subglottal", 0.78, 0, 1.5, 0.001) : si.smoo; +patch_param_0_curve_time = max(0.0, age * 1 - 0); +patch_param_0_curve_value = select2(patch_param_0_curve_time < 0.08, select2(patch_param_0_curve_time < 0.72, select2(patch_param_0_curve_time < 1.1, 0.18, seg(patch_param_0_curve_time, 0.72, 0.38, 0.76, 0.18)), seg(patch_param_0_curve_time, 0.08, 0.64, 0.8, 0.76)), seg(patch_param_0_curve_time, 0, 0.08, 0.05, 0.8)); +patch_param_0_curve_depth = hslider("/curves/breath_phrase/depth", 0.9, 0, 1, 0.001) : si.smoo; +patch_param_0 = min(1.5, max(0, patch_param_0_base * (1.0 - patch_param_0_curve_depth) + patch_param_0_curve_value * patch_param_0_curve_depth)); +patch_param_1_base = hslider("/human/fold/opening", 0.16, 0, 1, 0.001) : si.smoo; +patch_param_1_curve_time = max(0.0, age * 1 - 0); +patch_param_1_curve_value = select2(patch_param_1_curve_time < 0.06, select2(patch_param_1_curve_time < 0.88, select2(patch_param_1_curve_time < 1.1, 0.03, seg(patch_param_1_curve_time, 0.88, 0.22, 0.14, 0.03)), seg(patch_param_1_curve_time, 0.06, 0.82, 0.18, 0.14)), seg(patch_param_1_curve_time, 0, 0.06, 0.02, 0.18)); +patch_param_1_curve_depth = hslider("/curves/fold_onset/depth", 0.8, 0, 1, 0.001) : si.smoo; +patch_param_1 = min(1, max(0, patch_param_1_base * (1.0 - patch_param_1_curve_depth) + patch_param_1_curve_value * patch_param_1_curve_depth)); +patch_param_2 = hslider("/human/fold/tension", 0.58, 0, 1, 0.001) : si.smoo; +patch_param_3 = hslider("/human/tongue/index", 3.3, 0, 6, 0.001) : si.smoo; +patch_param_4 = hslider("/human/tongue/diameter", 1.25, 0.05, 3, 0.001) : si.smoo; +patch_param_5 = hslider("/human/constriction/index", 4.8, 0, 6, 0.001) : si.smoo; +patch_param_6 = hslider("/human/constriction/diameter", 0.95, 0.02, 3, 0.001) : si.smoo; +patch_param_7_base = hslider("/human/lip/opening", 1.2, 0, 2, 0.001) : si.smoo; +patch_param_7_curve_time = max(0.0, age * 1 - 0); +patch_param_7_curve_value = select2(patch_param_7_curve_time < 0.35, select2(patch_param_7_curve_time < 0.75, select2(patch_param_7_curve_time < 1.1, 1.05, seg(patch_param_7_curve_time, 0.75, 0.35, 0.72, 1.05)), seg(patch_param_7_curve_time, 0.35, 0.4, 1.25, 0.72)), seg(patch_param_7_curve_time, 0, 0.35, 0.8, 1.25)); +patch_param_7_curve_depth = hslider("/curves/lip_vowel/depth", 0.65, 0, 1, 0.001) : si.smoo; +patch_param_7 = min(2, max(0, patch_param_7_base * (1.0 - patch_param_7_curve_depth) + patch_param_7_curve_value * patch_param_7_curve_depth)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_graph_drive = 1.0; +voice_0_graph_terminal_area_subglottal_wall = max(0.000001, 0.1024 * max(0.0, 1)); +voice_0_graph_terminal_reflection_subglottal_wall = 0.78; +voice_0_graph_terminal_area_trachea_top = max(0.000001, 0.49 * max(0.0, 1)); +voice_0_graph_terminal_reflection_trachea_top = 0; +voice_0_graph_terminal_area_oral_back = max(0.000001, ((max(0.0, min((0.55 + ((patch_param_4) - 0.55) * (exp(0.0 - pow((0 - (patch_param_3)) / (max(0.001, 0.18 * 7)), 2.0))) + ((patch_param_7) - 0.55) * 0), (patch_param_6) + max(0.0, ((0.55 + ((patch_param_4) - 0.55) * (exp(0.0 - pow((0 - (patch_param_3)) / (max(0.001, 0.18 * 7)), 2.0))) + ((patch_param_7) - 0.55) * 0)) - (patch_param_6)) * (1.0 - (exp(0.0 - pow((0 - (patch_param_5)) / (max(0.001, 0.09 * 7)), 2.0))))))) * (max(0.0, min((0.55 + ((patch_param_4) - 0.55) * (exp(0.0 - pow((0 - (patch_param_3)) / (max(0.001, 0.18 * 7)), 2.0))) + ((patch_param_7) - 0.55) * 0), (patch_param_6) + max(0.0, ((0.55 + ((patch_param_4) - 0.55) * (exp(0.0 - pow((0 - (patch_param_3)) / (max(0.001, 0.18 * 7)), 2.0))) + ((patch_param_7) - 0.55) * 0)) - (patch_param_6)) * (1.0 - (exp(0.0 - pow((0 - (patch_param_5)) / (max(0.001, 0.09 * 7)), 2.0)))))))) * max(0.0, 1)); +voice_0_graph_terminal_reflection_oral_back = 0; +voice_0_graph_terminal_area_folds = max(0.000001, 0.49 * max(0.0, 1)); +voice_0_graph_terminal_reflection_folds = 0; +voice_0_graph_terminal_area_mouth = max(0.000001, ((max(0.0, min((0.82 + ((patch_param_4) - 0.82) * (exp(0.0 - pow((6 - (patch_param_3)) / (max(0.001, 0.18 * 7)), 2.0))) + ((patch_param_7) - 0.82) * 1), (patch_param_6) + max(0.0, ((0.82 + ((patch_param_4) - 0.82) * (exp(0.0 - pow((6 - (patch_param_3)) / (max(0.001, 0.18 * 7)), 2.0))) + ((patch_param_7) - 0.82) * 1)) - (patch_param_6)) * (1.0 - (exp(0.0 - pow((6 - (patch_param_5)) / (max(0.001, 0.09 * 7)), 2.0))))))) * (max(0.0, min((0.82 + ((patch_param_4) - 0.82) * (exp(0.0 - pow((6 - (patch_param_3)) / (max(0.001, 0.18 * 7)), 2.0))) + ((patch_param_7) - 0.82) * 1), (patch_param_6) + max(0.0, ((0.82 + ((patch_param_4) - 0.82) * (exp(0.0 - pow((6 - (patch_param_3)) / (max(0.001, 0.18 * 7)), 2.0))) + ((patch_param_7) - 0.82) * 1)) - (patch_param_6)) * (1.0 - (exp(0.0 - pow((6 - (patch_param_5)) / (max(0.001, 0.09 * 7)), 2.0)))))))) * max(0.0, 1.2)); +voice_0_graph_terminal_reflection_mouth = ((0.96) * (1.0 - clip01(pow(clip01((max(0.0, patch_param_7)) / 1.5), 2.0))) + (-0.82) * clip01(pow(clip01((max(0.0, patch_param_7)) / 1.5), 2.0))); +voice_0_graph_node_area_subglottal_wall = max(0.000001, voice_0_graph_terminal_area_subglottal_wall); +voice_0_graph_node_reflection_subglottal_wall = (voice_0_graph_terminal_reflection_subglottal_wall) / 1; +voice_0_graph_node_area_folds_trachea_top = max(0.000001, voice_0_graph_terminal_area_trachea_top); +voice_0_graph_node_reflection_folds_trachea_top = (voice_0_graph_terminal_reflection_trachea_top) / 1; +voice_0_graph_node_area_oral_back = max(0.000001, voice_0_graph_terminal_area_oral_back); +voice_0_graph_node_reflection_oral_back = (voice_0_graph_terminal_reflection_oral_back) / 1; +voice_0_graph_node_area_mouth = max(0.000001, voice_0_graph_terminal_area_mouth); +voice_0_graph_node_reflection_mouth = (voice_0_graph_terminal_reflection_mouth) / 1; +voice_0_graph_segment_area_0 = max(0.000001, 0.3364); +voice_0_graph_segment_area_1 = max(0.000001, ((max(0.0, min((1.45 + ((patch_param_4) - 1.45) * (exp(0.0 - pow((3 - (patch_param_3)) / (max(0.001, 0.18 * 7)), 2.0))) + ((patch_param_7) - 1.45) * 0), (patch_param_6) + max(0.0, ((1.45 + ((patch_param_4) - 1.45) * (exp(0.0 - pow((3 - (patch_param_3)) / (max(0.001, 0.18 * 7)), 2.0))) + ((patch_param_7) - 1.45) * 0)) - (patch_param_6)) * (1.0 - (exp(0.0 - pow((3 - (patch_param_5)) / (max(0.001, 0.09 * 7)), 2.0))))))) * (max(0.0, min((1.45 + ((patch_param_4) - 1.45) * (exp(0.0 - pow((3 - (patch_param_3)) / (max(0.001, 0.18 * 7)), 2.0))) + ((patch_param_7) - 1.45) * 0), (patch_param_6) + max(0.0, ((1.45 + ((patch_param_4) - 1.45) * (exp(0.0 - pow((3 - (patch_param_3)) / (max(0.001, 0.18 * 7)), 2.0))) + ((patch_param_7) - 1.45) * 0)) - (patch_param_6)) * (1.0 - (exp(0.0 - pow((3 - (patch_param_5)) / (max(0.001, 0.09 * 7)), 2.0))))))))); +voice_0_graph_connection_coupling_larynx_to_tract = clip01(0.92); +voice_0_graph_connection_loss_larynx_to_tract = clip01(1); +voice_0_graph_radiation_gain = 1.0; +voice_0_graph_source_folds = 0.0; +voice_0_graph(x) = voice_0_graph_loop ~ si.bus(4) : (si.block(4), _) with { + voice_0_graph_loop(r0, r1, l0, l1) = voice_0_graph_next_r0, voice_0_graph_next_r1, voice_0_graph_next_l0, voice_0_graph_next_l1, voice_0_graph_out with { + voice_0_graph_in_0_start = l0; + voice_0_graph_in_0_end = r0; + voice_0_graph_in_1_start = l1; + voice_0_graph_in_1_end = r1; + voice_0_graph_node_incident_pressure_subglottal_wall = (voice_0_graph_in_0_start) / 1; + voice_0_graph_node_source_subglottal_wall = 0.0; + voice_0_graph_source_folds_folds_trachea_top_load_pressure = voice_0_graph_node_incident_pressure_folds_trachea_top; + voice_0_graph_source_folds_folds_trachea_top_stiffness_hint = max(0.00002, min(0.16, pow(2.0 * ma.PI * max(20.0, ((max(20, 145 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) / ma.SR, 2.0))); + voice_0_graph_source_folds_folds_trachea_top_flow_scale = max(0.0, 1.05); + voice_0_graph_source_folds_folds_trachea_top_tissue_loss = clip01(0.2); + voice_0_graph_source_folds_folds_trachea_top_aperture_shape = clip01(0.48); + voice_0_graph_source_folds_folds_trachea_top_flow_loss = max(0.0, 0.4); + voice_0_graph_source_folds_folds_trachea_top_reservoir_pressure = (clip01(patch_param_0)) * (max(0.0, 1)); + voice_0_graph_source_folds_folds_trachea_top_downstream_pressure = (max(0.0, 0.05)) + (max(0.0, 0.42)) * ma.tanh(voice_0_graph_source_folds_folds_trachea_top_load_pressure); + voice_0_graph_source_folds_folds_trachea_top_pressure_drive = max(0.0, voice_0_graph_source_folds_folds_trachea_top_reservoir_pressure - voice_0_graph_source_folds_folds_trachea_top_downstream_pressure); + voice_0_graph_source_folds_folds_trachea_top_stiffness = voice_0_graph_source_folds_folds_trachea_top_stiffness_hint * (0.35 + 1.65 * (clip01(patch_param_2))); + voice_0_graph_source_folds_folds_trachea_top_modal_frequency = max(45.0, min(10000.0, (ma.SR / (2.0 * ma.PI)) * sqrt(max(0.00002, voice_0_graph_source_folds_folds_trachea_top_stiffness) / (max(0.02, 0.35))))); + voice_0_graph_source_folds_folds_trachea_top_load_detune = 1.0 - 0.035 * ma.tanh(voice_0_graph_source_folds_folds_trachea_top_load_pressure * (max(0.0, 0.42))); + voice_0_graph_source_folds_folds_trachea_top_oscillation_threshold = 0.030 + 0.070 * (max(0.0, 0.18)) + 0.080 * voice_0_graph_source_folds_folds_trachea_top_tissue_loss + 0.18 * clip01(max(0.0, patch_param_1)); + voice_0_graph_source_folds_folds_trachea_top_oscillation_gate = clip01((voice_0_graph_source_folds_folds_trachea_top_pressure_drive - voice_0_graph_source_folds_folds_trachea_top_oscillation_threshold) * (3.0 + 1.6 * max(0.0, 1.0 - (max(0.0, 0.18))))); + voice_0_graph_source_folds_folds_trachea_top_modal_q = 3.0 + 22.0 * clip01((clip01(patch_param_0)) * (1.0 - 0.45 * (max(0.0, 0.18)) - 0.35 * voice_0_graph_source_folds_folds_trachea_top_tissue_loss) + 0.35 * (clip01(patch_param_2))); + voice_0_graph_source_folds_folds_trachea_top_modal_seed = (no.noise * 0.018 + voice_0_graph_source_folds_folds_trachea_top_pressure_drive * max(0.0, 0.22 - clip01(max(0.0, patch_param_1))) * 0.16); + voice_0_graph_source_folds_folds_trachea_top_modal_ring = voice_0_graph_source_folds_folds_trachea_top_modal_seed : fi.resonbp(voice_0_graph_source_folds_folds_trachea_top_modal_frequency, voice_0_graph_source_folds_folds_trachea_top_modal_q, 1); + voice_0_graph_source_folds_folds_trachea_top_modal_oscillator = os.osc(voice_0_graph_source_folds_folds_trachea_top_modal_frequency * voice_0_graph_source_folds_folds_trachea_top_load_detune) * voice_0_graph_source_folds_folds_trachea_top_oscillation_gate; + voice_0_graph_source_folds_folds_trachea_top_modal_tissue = (voice_0_graph_source_folds_folds_trachea_top_modal_oscillator * (0.70 + 0.80 * (clip01(patch_param_2))) + voice_0_graph_source_folds_folds_trachea_top_modal_ring * 0.35) * max(0.0, 1.0 - 0.35 * (max(0.0, 0.18)) - 0.45 * voice_0_graph_source_folds_folds_trachea_top_tissue_loss); + voice_0_graph_source_folds_folds_trachea_top_upper_stiffness_effective = max((max(0.0, 0.04)), voice_0_graph_source_folds_folds_trachea_top_stiffness * (0.80 + 0.45 * (clip01(patch_param_2)))); + voice_0_graph_source_folds_folds_trachea_top_lower_stiffness_effective = max((max(0.0, 0.06)), voice_0_graph_source_folds_folds_trachea_top_stiffness * (1.05 + 0.55 * (clip01(patch_param_2)))); + voice_0_graph_source_folds_folds_trachea_top_coupling_stiffness = (max(0.0, 0.09)) * (1.0 + 1.5 * (clip01(patch_param_2))); + voice_0_graph_source_folds_folds_trachea_top_lower_velocity_decay = min(0.9995, max(0.20, 1.0 - ((0.010 + 0.090 * (max(0.0, 0.18)) + 0.040 * (max(0.0, 0.18)) + 0.055 * voice_0_graph_source_folds_folds_trachea_top_tissue_loss) / (max(0.02, 0.36))))); + voice_0_graph_source_folds_folds_trachea_top_upper_velocity_decay = min(0.9995, max(0.20, 1.0 - ((0.012 + 0.105 * (max(0.0, 0.18)) + 0.030 * (max(0.0, 0.18)) + 0.055 * voice_0_graph_source_folds_folds_trachea_top_tissue_loss) / (max(0.02, 0.22))))); + voice_0_graph_source_folds_folds_trachea_top_lower_force = (voice_0_graph_source_folds_folds_trachea_top_pressure_drive * (0.0005 + 0.0028 * (1.0 - clip01(max(0.0, patch_param_1)))) - (max(0.0, 0.42)) * voice_0_graph_source_folds_folds_trachea_top_load_pressure * 0.0012) / (max(0.02, 0.36)); + voice_0_graph_source_folds_folds_trachea_top_upper_force = (voice_0_graph_source_folds_folds_trachea_top_pressure_drive * (0.0003 + 0.0018 * (1.0 - clip01(max(0.0, patch_param_1)))) - (max(0.0, 0.42)) * voice_0_graph_source_folds_folds_trachea_top_load_pressure * 0.0008) / (max(0.02, 0.22)); + voice_0_graph_source_folds_folds_trachea_top_lower_velocity = voice_0_graph_source_folds_folds_trachea_top_lower_force : + ~ *(voice_0_graph_source_folds_folds_trachea_top_lower_velocity_decay / (1.0 + 10.0 * voice_0_graph_source_folds_folds_trachea_top_lower_stiffness_effective + voice_0_graph_source_folds_folds_trachea_top_coupling_stiffness + 0.4 * (max(0.0, 0.8)))); + voice_0_graph_source_folds_folds_trachea_top_upper_velocity = (voice_0_graph_source_folds_folds_trachea_top_upper_force + voice_0_graph_source_folds_folds_trachea_top_lower_velocity * voice_0_graph_source_folds_folds_trachea_top_coupling_stiffness * 0.35) : + ~ *(voice_0_graph_source_folds_folds_trachea_top_upper_velocity_decay / (1.0 + 10.0 * voice_0_graph_source_folds_folds_trachea_top_upper_stiffness_effective + voice_0_graph_source_folds_folds_trachea_top_coupling_stiffness + 0.4 * (max(0.0, 0.8)))); + voice_0_graph_source_folds_folds_trachea_top_lower_displacement = voice_0_graph_source_folds_folds_trachea_top_lower_velocity : + ~ *(min(0.9998, max(0.20, 1.0 - 0.0008 / (max(0.02, 0.36))))); + voice_0_graph_source_folds_folds_trachea_top_upper_displacement = voice_0_graph_source_folds_folds_trachea_top_upper_velocity : + ~ *(min(0.9998, max(0.20, 1.0 - 0.0008 / (max(0.02, 0.22))))); + voice_0_graph_source_folds_folds_trachea_top_collision = (max(0.0, 0.62)) * max(0.0, 0.0 - ((max(0.0, 0.012)) + (max(0.0, patch_param_1)) + voice_0_graph_source_folds_folds_trachea_top_upper_displacement)); + voice_0_graph_source_folds_folds_trachea_top_displacement = voice_0_graph_source_folds_folds_trachea_top_lower_displacement * (1.0 - (clip01(0.24))) + (voice_0_graph_source_folds_folds_trachea_top_upper_displacement - voice_0_graph_source_folds_folds_trachea_top_collision) * (clip01(0.24)); + voice_0_graph_source_folds_folds_trachea_top_aperture_linear = max(0.0, (max(0.0, 0.012)) + (max(0.0, patch_param_1)) + voice_0_graph_source_folds_folds_trachea_top_displacement - (max(0.0, 0.8)) * pow(voice_0_graph_source_folds_folds_trachea_top_displacement, 3.0)); + voice_0_graph_source_folds_folds_trachea_top_aperture = voice_0_graph_source_folds_folds_trachea_top_aperture_linear * (1.0 - 0.55 * voice_0_graph_source_folds_folds_trachea_top_aperture_shape) + pow(voice_0_graph_source_folds_folds_trachea_top_aperture_linear, 2.0) * (0.55 * voice_0_graph_source_folds_folds_trachea_top_aperture_shape); + voice_0_graph_source_folds_folds_trachea_top_flow_resistance = 1.0 + voice_0_graph_source_folds_folds_trachea_top_flow_loss * (0.35 + 1.8 / max(0.035, voice_0_graph_source_folds_folds_trachea_top_aperture + (max(0.0, 0.012)))); + voice_0_graph_source_folds_folds_trachea_top_turbulence = no.noise : fi.highpass(2, 1200.0 + 2800.0 * clip01(1.0 - voice_0_graph_source_folds_folds_trachea_top_aperture)); + voice_0_graph_source_folds_folds_trachea_top_voicing = voice_0_graph_source_folds_folds_trachea_top_modal_tissue * (0.18 + 1.45 * (clip01(patch_param_2))); + voice_0_graph_source_folds_folds_trachea_top_flow = ma.tanh(((voice_0_graph_source_folds_folds_trachea_top_pressure_drive * voice_0_graph_source_folds_folds_trachea_top_aperture * (1.5 + 3.5 * voice_0_graph_source_folds_folds_trachea_top_flow_scale)) + (voice_0_graph_source_folds_folds_trachea_top_voicing * voice_0_graph_source_folds_folds_trachea_top_pressure_drive * (0.45 + 1.55 * (clip01(patch_param_2))))) / voice_0_graph_source_folds_folds_trachea_top_flow_resistance); + voice_0_graph_source_folds_folds_trachea_top_noise = voice_0_graph_source_folds_folds_trachea_top_turbulence * (clip01(0.035)) * voice_0_graph_source_folds_folds_trachea_top_pressure_drive * clip01(voice_0_graph_source_folds_folds_trachea_top_aperture) * (1.0 - 0.55 * (clip01(patch_param_2))) / voice_0_graph_source_folds_folds_trachea_top_flow_resistance; + voice_0_graph_source_folds_folds_trachea_top_out = (voice_0_graph_source_folds_folds_trachea_top_flow * voice_0_graph_source_folds_folds_trachea_top_flow_scale * (0.55 + 2.6 * voice_0_graph_source_folds_folds_trachea_top_pressure_drive) + voice_0_graph_source_folds_folds_trachea_top_noise) * ((1) * (1.0)); + voice_0_graph_node_incident_pressure_folds_trachea_top = (voice_0_graph_in_0_end) / 1; + voice_0_graph_node_source_folds_trachea_top = voice_0_graph_source_folds_folds_trachea_top_out; + voice_0_graph_node_incident_pressure_oral_back = (voice_0_graph_in_1_start) / 1; + voice_0_graph_node_source_oral_back = 0.0; + voice_0_graph_node_incident_pressure_mouth = (voice_0_graph_in_1_end) / 1; + voice_0_graph_node_source_mouth = 0.0; + voice_0_graph_connection_reflection_larynx_to_tract_trachea_top_0_end = (2.0 * ((voice_0_graph_terminal_area_trachea_top / 1)) - ((voice_0_graph_terminal_area_trachea_top / 1) + voice_0_graph_segment_area_1)) / max(0.000001, (voice_0_graph_terminal_area_trachea_top / 1) + voice_0_graph_segment_area_1); + voice_0_graph_connection_scattered_larynx_to_tract_trachea_top_0_end = voice_0_graph_connection_reflection_larynx_to_tract_trachea_top_0_end * voice_0_graph_in_0_end + (1.0 + voice_0_graph_connection_reflection_larynx_to_tract_trachea_top_0_end) * (voice_0_graph_in_1_start); + voice_0_graph_out_0_end = ((voice_0_graph_connection_scattered_larynx_to_tract_trachea_top_0_end) * (voice_0_graph_connection_coupling_larynx_to_tract) + voice_0_graph_in_0_end * (1.0 - (voice_0_graph_connection_coupling_larynx_to_tract)) + (voice_0_graph_node_source_folds_trachea_top) / 1) * voice_0_graph_connection_loss_larynx_to_tract; + voice_0_graph_connection_reflection_larynx_to_tract_oral_back_1_start = (2.0 * (voice_0_graph_segment_area_1) - ((voice_0_graph_terminal_area_trachea_top / 1) + voice_0_graph_segment_area_1)) / max(0.000001, (voice_0_graph_terminal_area_trachea_top / 1) + voice_0_graph_segment_area_1); + voice_0_graph_connection_scattered_larynx_to_tract_oral_back_1_start = voice_0_graph_connection_reflection_larynx_to_tract_oral_back_1_start * voice_0_graph_in_1_start + (1.0 + voice_0_graph_connection_reflection_larynx_to_tract_oral_back_1_start) * (voice_0_graph_in_0_end); + voice_0_graph_out_1_start = ((voice_0_graph_connection_scattered_larynx_to_tract_oral_back_1_start) * (voice_0_graph_connection_coupling_larynx_to_tract) + voice_0_graph_in_1_start * (1.0 - (voice_0_graph_connection_coupling_larynx_to_tract)) + (voice_0_graph_node_source_oral_back) / 1) * voice_0_graph_connection_loss_larynx_to_tract; + voice_0_graph_connection_energy_in_larynx_to_tract = ((voice_0_graph_terminal_area_trachea_top / 1)) * pow(voice_0_graph_in_0_end, 2.0) + (voice_0_graph_segment_area_1) * pow(voice_0_graph_in_1_start, 2.0); + voice_0_graph_connection_energy_out_larynx_to_tract = ((voice_0_graph_terminal_area_trachea_top / 1)) * pow(voice_0_graph_out_0_end, 2.0) + (voice_0_graph_segment_area_1) * pow(voice_0_graph_out_1_start, 2.0); + voice_0_graph_out_0_start = voice_0_graph_in_0_start * voice_0_graph_node_reflection_subglottal_wall + (voice_0_graph_node_source_subglottal_wall) / 1; + voice_0_graph_radiation_boundary_load_mouth = clip01((voice_0_graph_radiation_admittance_mouth) * (voice_0_graph_radiation_differentiation_mouth) * (clip01(0.98))); + voice_0_graph_radiation_reflected_raw_mouth = (voice_0_graph_in_1_end) * (voice_0_graph_terminal_reflection_mouth) + (voice_0_graph_node_source_mouth); + voice_0_graph_radiation_reflected_loaded_mouth = (voice_0_graph_radiation_reflected_raw_mouth) * (1.0 - (voice_0_graph_radiation_boundary_load_mouth)) + ((voice_0_graph_radiation_reflected_raw_mouth) : fi.lowpass(1, voice_0_graph_radiation_highpass_mouth)) * (voice_0_graph_radiation_boundary_load_mouth); + voice_0_graph_out_1_end = voice_0_graph_radiation_reflected_loaded_mouth; + voice_0_graph_radiation_model_mouth = 1; + voice_0_graph_radiation_reference_area_mouth = max(0.18, 1.90 * 1.90 * (0.30 + 0.70 * clip01(pow(clip01((max(0.0, patch_param_7)) / 1.5), 2.0)))); + voice_0_graph_radiation_differentiation_mouth = (0.62 + 0.24 * clip01(pow(clip01((max(0.0, patch_param_7)) / 1.5), 2.0))); + voice_0_graph_radiation_highpass_mouth = (120.0 + 180.0 * clip01(pow(clip01((max(0.0, patch_param_7)) / 1.5), 2.0))); + voice_0_graph_radiation_admittance_mouth = sqrt(clip01((voice_0_graph_terminal_area_mouth) / max(0.000001, (voice_0_graph_terminal_area_mouth) + (voice_0_graph_radiation_reference_area_mouth)))); + voice_0_graph_radiation_flow_mouth = ((voice_0_graph_in_1_end - voice_0_graph_out_1_end)); + voice_0_graph_delay_0 = max(0.000001, 0.00034985 * ma.SR); + voice_0_graph_segment_loss_0 = clip01((0.998) * (sqrt(clip01((voice_0_graph_segment_area_0) / max(0.000001, (voice_0_graph_segment_area_0) + 0.020))))); + voice_0_graph_next_r0 = voice_0_graph_out_0_start : de.fdelay(4096, min(4095, max(0.000001, voice_0_graph_delay_0))) * voice_0_graph_segment_loss_0; + voice_0_graph_next_l0 = voice_0_graph_out_0_end : de.fdelay(4096, min(4095, max(0.000001, voice_0_graph_delay_0))) * voice_0_graph_segment_loss_0; + voice_0_graph_delay_1 = max(0.000001, 0.00049563 * ma.SR); + voice_0_graph_segment_loss_1 = clip01((0.997) * (sqrt(clip01((voice_0_graph_segment_area_1) / max(0.000001, (voice_0_graph_segment_area_1) + 0.012))) * (0.998 - 0.010 * clip01(0.080 / max(0.000001, (voice_0_graph_segment_area_1) + 0.080))))); + voice_0_graph_next_r1 = voice_0_graph_out_1_start : de.fdelay(4096, min(4095, max(0.000001, voice_0_graph_delay_1))) * voice_0_graph_segment_loss_1; + voice_0_graph_next_l1 = voice_0_graph_out_1_end : de.fdelay(4096, min(4095, max(0.000001, voice_0_graph_delay_1))) * voice_0_graph_segment_loss_1; + voice_0_graph_out = (((voice_0_graph_radiation_flow_mouth * (1.0 - (voice_0_graph_radiation_differentiation_mouth)) + (voice_0_graph_radiation_flow_mouth : fi.highpass(1, voice_0_graph_radiation_highpass_mouth)) * (voice_0_graph_radiation_differentiation_mouth)) * clip01(0.98) * voice_0_graph_radiation_admittance_mouth)) * voice_0_graph_radiation_gain; + }; +}; +voice_0_acoustic_graph_radiated = voice_0_graph(voice_0_graph_drive); +voice_0_freq = ((max(20, 145 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = voice_0_acoustic_graph_radiated; +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.08, 1.1) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.18); + +process = softclip((voice_0) * 0.34); diff --git a/tools/aqua-playground/lowered/advanced-machine-breath.dsp b/tools/aqua-playground/lowered/advanced-machine-breath.dsp new file mode 100644 index 0000000..6453aa3 --- /dev/null +++ b/tools/aqua-playground/lowered/advanced-machine-breath.dsp @@ -0,0 +1,87 @@ +import("stdfaust.lib"); +declare name "advanced-machine-breath"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0 + 0.16 * lfo_hold(5.5, 0); +patch_mod_pitch = 0 + 0.028 * lfo_hold(5.5, 0); +patch_mod_duty = 0.0; +patch_mod_lpf = 0 + 0.24 * lfo_hold(5.5, 0); +patch_mod_hpf = 0 + 0.12 * lfo_sq(2.75, 0); +patch_mod_noise = 0 + 0.18 * lfo_sq(2.75, 0); +patch_mod_drive = 0 + 0.18 * lfo_hold(5.5, 0); +patch_mod_fold = 0 + 0.16 * lfo_hold(5.5, 0); +patch_mod_formant_mix = 0 + 0.25 * lfo_sq(2.75, 0); +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 72 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = 2.0 * wrap01(os.phasor(1.0, ((max(20, 72 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 72 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 1.5))) * (max(0.0, 0.8 + patch_mod_fm_index + 0.0) * exp(-voice_0_age / max(0.45, 0.0001))) / ma.PI) - 1.0; +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.34 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.34 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0.12 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0.12 + patch_mod_fold + 0.0) * 3.5)) * clip01(0.12 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.28 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.025 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.025 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = ((voice_0_phased : fi.resonbp(290, 5.272727, 1.0)) * 0.55 + (voice_0_phased : fi.resonbp(760, 6.333333, 1.0)) * 1 + (voice_0_phased : fi.resonbp(1780, 6.846154, 1.0)) * 0.5) / 2.05; +voice_0 = ((voice_0_phased * (1.0 - clip01(0.22 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0.22 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0.004, 0, 1, 0.55, 0.72) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.1); + +voice_1_age = age; +voice_1_freq = ((max(20, 36 * pow(2.0, -0.18 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = select2(wrap01(os.phasor(1.0, ((max(20, 36 * pow(2.0, -0.18 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 36 * pow(2.0, -0.18 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 1.5))) * (max(0.0, 0.8 + patch_mod_fm_index + 0.0) * exp(-voice_1_age / max(0.45, 0.0001))) / ma.PI) < clip01(0.37 + 0 * voice_1_age + patch_mod_duty + 0.0), -0.5, 0.5); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.34 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.34 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0.12 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0.12 + patch_mod_fold + 0.0) * 3.5)) * clip01(0.12 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.28 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.025 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.025 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0.004, 0, 1, 0.55, 0.72) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.13); + +voice_2_age = age; +voice_2_freq = ((max(20, 700 * pow(2.0, 0 * voice_2_age + 0.5 * 0 * voice_2_age * voice_2_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_2_osc = no.noise; +voice_2_colored = (voice_2_osc * (1.0 - clip01(0.8 + patch_mod_noise + 0.0)) + no.noise * clip01(0.8 + patch_mod_noise + 0.0)); +voice_2_driven = ma.tanh(voice_2_colored * (1.0 + clip01(0.34 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.34 + patch_mod_drive + 0.0) * 12.0); +voice_2_folded = voice_2_driven * (1.0 - clip01(0.12 + patch_mod_fold + 0.0)) + fold(voice_2_driven * (1.0 + clip01(0.12 + patch_mod_fold + 0.0) * 3.5)) * clip01(0.12 + patch_mod_fold + 0.0); +voice_2_filtered = voice_2_folded : fi.lowpass(1, max(20.0, clip01(0.45 * (1.0 + 0 * voice_2_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.42 * (1.0 + 0 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.42 * (1.0 + 0 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_2_phased = voice_2_filtered; +voice_2_formants = voice_2_phased; +voice_2 = ((voice_2_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_2_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_2_age, 0.004, 0, 1, 0.35, 0.5) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.055); + +voice_3_age = age; +voice_3_freq = ((max(20, 144 * pow(2.0, 0 * voice_3_age + 0.5 * 0 * voice_3_age * voice_3_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_3_osc = 1.0 - 4.0 * abs(wrap01(os.phasor(1.0, ((max(20, 144 * pow(2.0, 0 * voice_3_age + 0.5 * 0 * voice_3_age * voice_3_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 144 * pow(2.0, 0 * voice_3_age + 0.5 * 0 * voice_3_age * voice_3_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 2.25))) * (max(0.0, 1.1 + patch_mod_fm_index + 0.0) * exp(-voice_3_age / max(0.5, 0.0001))) / ma.PI) - 0.5); +voice_3_colored = (voice_3_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_3_driven = ma.tanh(voice_3_colored * (1.0 + clip01(0.34 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.34 + patch_mod_drive + 0.0) * 12.0); +voice_3_folded = voice_3_driven * (1.0 - clip01(0.12 + patch_mod_fold + 0.0)) + fold(voice_3_driven * (1.0 + clip01(0.12 + patch_mod_fold + 0.0) * 3.5)) * clip01(0.12 + patch_mod_fold + 0.0); +voice_3_filtered = voice_3_folded : fi.lowpass(1, max(20.0, clip01(0.28 * (1.0 + 0 * voice_3_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.025 * (1.0 + 0 * voice_3_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.025 * (1.0 + 0 * voice_3_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_3_phased = voice_3_filtered; +voice_3_formants = ((voice_3_phased : fi.resonbp(510, 5.666667, 1.0)) * 0.35 + (voice_3_phased : fi.resonbp(1320, 7.764706, 1.0)) * 0.9 + (voice_3_phased : fi.resonbp(2100, 7, 1.0)) * 0.45) / 1.7; +voice_3 = ((voice_3_phased * (1.0 - clip01(0.18 + patch_mod_formant_mix + 0.0)) + voice_3_formants * clip01(0.18 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_3_age, 0.004, 0, 1, 0.48, 0.62) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.045); + +process = softclip((voice_0 + voice_1 + voice_2 + voice_3) * 0.7); diff --git a/tools/aqua-playground/lowered/advanced-ritual-sequence.dsp b/tools/aqua-playground/lowered/advanced-ritual-sequence.dsp new file mode 100644 index 0000000..b59626c --- /dev/null +++ b/tools/aqua-playground/lowered/advanced-ritual-sequence.dsp @@ -0,0 +1,87 @@ +import("stdfaust.lib"); +declare name "advanced-ritual-sequence"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time - floor(time / 0.42) * 0.42; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0 + 0.2 * lfo_tri(2.38, 0); +patch_mod_pitch = 0 + 0.018 * lfo_tri(2.38, 0); +patch_mod_duty = 0.0; +patch_mod_lpf = 0 + 0.12 * lfo_tri(2.38, 0); +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0 + 0.75 * lfo_tri(2.38, 0); + +voice_0_age = age; +voice_0_freq = ((max(20, 196 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * select2(voice_0_age < 0.065, 1.4983, 1.0) * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 196 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * select2(voice_0_age < 0.065, 1.4983, 1.0) * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 196 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * select2(voice_0_age < 0.065, 1.4983, 1.0) * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 2))) * (max(0.0, 1.8 + patch_mod_fm_index + 0.0) * exp(-voice_0_age / max(0.32, 0.0001))) / ma.PI)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.82 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.035 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.035 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0.001, 0, 0.8474576, 0.5, 0.045) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.1534); + +voice_1_age = age; +voice_1_freq = ((max(20, 293.66 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * select2(voice_1_age < 0.065, 1.3348, 1.0) * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 293.66 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * select2(voice_1_age < 0.065, 1.3348, 1.0) * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 293.66 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * select2(voice_1_age < 0.065, 1.3348, 1.0) * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 2))) * (max(0.0, 1.8 + patch_mod_fm_index + 0.0) * exp(-voice_1_age / max(0.32, 0.0001))) / ma.PI)); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.82 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.035 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.035 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0.001, 0, 0.8474576, 0.38, 0.035) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.09); + +voice_2_age = age; +voice_2_freq = ((max(20, 392 * pow(2.0, 0 * voice_2_age + 0.5 * 0 * voice_2_age * voice_2_age)))) * select2(voice_2_age < 0.065, 1.2599, 1.0) * pow(2.0, patch_mod_pitch + 0.0); +voice_2_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 392 * pow(2.0, 0 * voice_2_age + 0.5 * 0 * voice_2_age * voice_2_age)))) * select2(voice_2_age < 0.065, 1.2599, 1.0) * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 392 * pow(2.0, 0 * voice_2_age + 0.5 * 0 * voice_2_age * voice_2_age)))) * select2(voice_2_age < 0.065, 1.2599, 1.0) * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 2))) * (max(0.0, 1.8 + patch_mod_fm_index + 0.0) * exp(-voice_2_age / max(0.32, 0.0001))) / ma.PI)); +voice_2_colored = (voice_2_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_2_driven = ma.tanh(voice_2_colored * (1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0); +voice_2_folded = voice_2_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_2_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_2_filtered = voice_2_folded : fi.lowpass(1, max(20.0, clip01(0.82 * (1.0 + 0 * voice_2_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.035 * (1.0 + 0 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.035 * (1.0 + 0 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_2_phased = voice_2_filtered; +voice_2_formants = voice_2_phased; +voice_2 = ((voice_2_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_2_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_2_age, 0.001, 0, 0.8474576, 0.32, 0.028) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.07); + +voice_3_age = age; +voice_3_freq = ((max(20, 3100 * pow(2.0, 0 * voice_3_age + 0.5 * 0 * voice_3_age * voice_3_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_3_osc = no.noise; +voice_3_colored = (voice_3_osc * (1.0 - clip01(1 + patch_mod_noise + 0.0)) + no.noise * clip01(1 + patch_mod_noise + 0.0)); +voice_3_driven = ma.tanh(voice_3_colored * (1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0); +voice_3_folded = voice_3_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_3_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_3_filtered = voice_3_folded : fi.lowpass(1, max(20.0, clip01(0.46 * (1.0 + 0 * voice_3_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.68 * (1.0 + 0 * voice_3_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.68 * (1.0 + 0 * voice_3_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_3_phased = voice_3_filtered; +voice_3_formants = voice_3_phased; +voice_3 = ((voice_3_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_3_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_3_age, 0.001, 0, 0.8474576, 0.16, 0.018) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.025); + +process = softclip((voice_0 + voice_1 + voice_2 + voice_3) * 0.62); diff --git a/tools/aqua-playground/lowered/advanced-subtractive-drums.dsp b/tools/aqua-playground/lowered/advanced-subtractive-drums.dsp new file mode 100644 index 0000000..e0bcd34 --- /dev/null +++ b/tools/aqua-playground/lowered/advanced-subtractive-drums.dsp @@ -0,0 +1,98 @@ +import("stdfaust.lib"); +declare name "advanced-subtractive-drums"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(32, 58 * pow(2.0, -3.6 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(32, 58 * pow(2.0, -3.6 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.14 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.14 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.resonlp(max(20.0, clip01(0.78 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0), max(0.1, 0.28), 1.0) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 0.62, 0.38, 0.038) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.82); + +voice_1_age = age; +voice_1_freq = ((max(20, 1700 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = no.noise; +voice_1_colored = (voice_1_osc * (1.0 - clip01(0.95 + patch_mod_noise + 0.0)) + no.noise * clip01(0.95 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.14 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.14 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.48 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.48 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)) : fi.resonbp(max(20.0, clip01(0.38) * 18000.0), max(0.1, 2.2), 1.0); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0, 0, 0.62, 0.18, 0.018) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.26); + +voice_2_age = age; +voice_2_freq = ((max(20, 188 * pow(2.0, -1.05 * voice_2_age + 0.5 * 0 * voice_2_age * voice_2_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_2_osc = 1.0 - 4.0 * abs(wrap01(os.phasor(1.0, ((max(20, 188 * pow(2.0, -1.05 * voice_2_age + 0.5 * 0 * voice_2_age * voice_2_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0) - 0.5); +voice_2_colored = (voice_2_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_2_driven = ma.tanh(voice_2_colored * (1.0 + clip01(0.14 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.14 + patch_mod_drive + 0.0) * 12.0); +voice_2_folded = voice_2_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_2_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_2_filtered = voice_2_folded : fi.lowpass(1, max(20.0, clip01(0.52 * (1.0 + 0 * voice_2_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_2_phased = voice_2_filtered; +voice_2_formants = voice_2_phased; +voice_2 = ((voice_2_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_2_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_2_age, 0, 0, 0.62, 0.13, 0.026) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.12); + +voice_3_age = age; +voice_3_freq = ((max(20, 8200 * pow(2.0, 0 * voice_3_age + 0.5 * 0 * voice_3_age * voice_3_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_3_osc = no.noise; +voice_3_colored = (voice_3_osc * (1.0 - clip01(1 + patch_mod_noise + 0.0)) + no.noise * clip01(1 + patch_mod_noise + 0.0)); +voice_3_driven = ma.tanh(voice_3_colored * (1.0 + clip01(0.14 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.14 + patch_mod_drive + 0.0) * 12.0); +voice_3_folded = voice_3_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_3_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_3_filtered = voice_3_folded : fi.lowpass(1, max(20.0, clip01(0.2 * (1.0 + 0 * voice_3_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.88 * (1.0 + 0 * voice_3_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.88 * (1.0 + 0 * voice_3_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_3_phased = voice_3_filtered; +voice_3_formants = voice_3_phased; +voice_3 = ((voice_3_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_3_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_3_age, 0, 0, 0.62, 0.052, 0.005) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.11); + +voice_4_age = age; +voice_4_freq = ((max(20, 540 * pow(2.0, 0 * voice_4_age + 0.5 * 0 * voice_4_age * voice_4_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_4_osc = select2(wrap01(os.phasor(1.0, ((max(20, 540 * pow(2.0, 0 * voice_4_age + 0.5 * 0 * voice_4_age * voice_4_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0) < clip01(0.42 + 0 * voice_4_age + patch_mod_duty + 0.0), -0.5, 0.5); +voice_4_colored = (voice_4_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_4_driven = ma.tanh(voice_4_colored * (1.0 + clip01(0.14 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.14 + patch_mod_drive + 0.0) * 12.0); +voice_4_folded = voice_4_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_4_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_4_filtered = voice_4_folded : fi.lowpass(1, max(20.0, clip01(0.72 * (1.0 + 0 * voice_4_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.18 * (1.0 + 0 * voice_4_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.18 * (1.0 + 0 * voice_4_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_4_phased = voice_4_filtered; +voice_4_formants = voice_4_phased; +voice_4 = ((voice_4_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_4_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_4_age, 0, 0, 0.62, 0.16, 0.035) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.08); + +process = softclip((voice_0 + voice_1 + voice_2 + voice_3 + voice_4) * 0.72); diff --git a/tools/aqua-playground/lowered/advanced-syrinx-voice.dsp b/tools/aqua-playground/lowered/advanced-syrinx-voice.dsp new file mode 100644 index 0000000..f7102ab --- /dev/null +++ b/tools/aqua-playground/lowered/advanced-syrinx-voice.dsp @@ -0,0 +1,238 @@ +import("stdfaust.lib"); +declare name "advanced-syrinx-voice"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_param_0_base = hslider("/voice/left/pressure", 0.78, 0, 1.5, 0.001) : si.smoo; +patch_param_0_curve_time = max(0.0, age * 1 - 0); +patch_param_0_curve_value = select2(patch_param_0_curve_time < 0.04, select2(patch_param_0_curve_time < 0.28, select2(patch_param_0_curve_time < 0.56, select2(patch_param_0_curve_time < 0.92, 0.24, seg(patch_param_0_curve_time, 0.56, 0.36, 0.88, 0.24)), seg(patch_param_0_curve_time, 0.28, 0.28, 0.76, 0.88)), seg(patch_param_0_curve_time, 0.04, 0.24, 0.82, 0.76)), seg(patch_param_0_curve_time, 0, 0.04, 0.05, 0.82)); +patch_param_0_curve_depth = hslider("/curves/left_phrase_pressure/depth", 0.92, 0, 1, 0.001) : si.smoo; +patch_param_0 = min(1.5, max(0, patch_param_0_base * (1.0 - patch_param_0_curve_depth) + patch_param_0_curve_value * patch_param_0_curve_depth)); +patch_param_1_base = hslider("/voice/right/pressure", 0.66, 0, 1.5, 0.001) : si.smoo; +patch_param_1_curve_time = max(0.0, age * 1 - 0); +patch_param_1_curve_value = select2(patch_param_1_curve_time < 0.06, select2(patch_param_1_curve_time < 0.24, select2(patch_param_1_curve_time < 0.5, select2(patch_param_1_curve_time < 0.92, 0.18, seg(patch_param_1_curve_time, 0.5, 0.42, 0.58, 0.18)), seg(patch_param_1_curve_time, 0.24, 0.26, 0.74, 0.58)), seg(patch_param_1_curve_time, 0.06, 0.18, 0.68, 0.74)), seg(patch_param_1_curve_time, 0, 0.06, 0.03, 0.68)); +patch_param_1_curve_depth = hslider("/curves/right_phrase_pressure/depth", 0.92, 0, 1, 0.001) : si.smoo; +patch_param_1 = min(1.5, max(0, patch_param_1_base * (1.0 - patch_param_1_curve_depth) + patch_param_1_curve_value * patch_param_1_curve_depth)); +patch_param_2_base = hslider("/voice/left/opening", 0.23, 0, 1, 0.001) : si.smoo; +patch_param_2_curve_time = max(0.0, age * 1 - 0); +patch_param_2_curve_value = select2(patch_param_2_curve_time < 0.035, select2(patch_param_2_curve_time < 0.46, select2(patch_param_2_curve_time < 0.92, 0.05, seg(patch_param_2_curve_time, 0.46, 0.46, 0.18, 0.05)), seg(patch_param_2_curve_time, 0.035, 0.425, 0.24, 0.18)), seg(patch_param_2_curve_time, 0, 0.035, 0.02, 0.24)); +patch_param_2_curve_depth = hslider("/curves/left_phrase_opening/depth", 0.85, 0, 1, 0.001) : si.smoo; +patch_param_2 = min(1, max(0, patch_param_2_base * (1.0 - patch_param_2_curve_depth) + patch_param_2_curve_value * patch_param_2_curve_depth)); +patch_param_3_base = hslider("/voice/right/opening", 0.19, 0, 1, 0.001) : si.smoo; +patch_param_3_curve_time = max(0.0, age * 1 - 0); +patch_param_3_curve_value = select2(patch_param_3_curve_time < 0.04, select2(patch_param_3_curve_time < 0.42, select2(patch_param_3_curve_time < 0.92, 0.05, seg(patch_param_3_curve_time, 0.42, 0.5, 0.15, 0.05)), seg(patch_param_3_curve_time, 0.04, 0.38, 0.2, 0.15)), seg(patch_param_3_curve_time, 0, 0.04, 0.02, 0.2)); +patch_param_3_curve_depth = hslider("/curves/right_phrase_opening/depth", 0.85, 0, 1, 0.001) : si.smoo; +patch_param_3 = min(1, max(0, patch_param_3_base * (1.0 - patch_param_3_curve_depth) + patch_param_3_curve_value * patch_param_3_curve_depth)); +patch_param_4 = hslider("/voice/left/tension", 0.43, 0, 1, 0.001) : si.smoo; +patch_param_5 = hslider("/voice/right/tension", 0.5, 0, 1, 0.001) : si.smoo; +patch_param_6_base = hslider("/voice/beak/opening", 0.88, 0, 1.5, 0.001) : si.smoo; +patch_param_6_curve_time = max(0.0, age * 1 - 0); +patch_param_6_curve_value = select2(patch_param_6_curve_time < 0.08, select2(patch_param_6_curve_time < 0.52, select2(patch_param_6_curve_time < 0.92, 0.58, seg(patch_param_6_curve_time, 0.52, 0.4, 1.08, 0.58)), seg(patch_param_6_curve_time, 0.08, 0.44, 0.94, 1.08)), seg(patch_param_6_curve_time, 0, 0.08, 0.34, 0.94)); +patch_param_6_curve_depth = hslider("/curves/beak_phrase/depth", 0.72, 0, 1, 0.001) : si.smoo; +patch_param_6 = min(1.5, max(0, patch_param_6_base * (1.0 - patch_param_6_curve_depth) + patch_param_6_curve_value * patch_param_6_curve_depth)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_graph_drive = 1.0; +voice_0_graph_terminal_area_left_merge = max(0.000001, 0.1764 * max(0.0, 1)); +voice_0_graph_terminal_reflection_left_merge = 0; +voice_0_graph_terminal_area_right_merge = max(0.000001, 0.16 * max(0.0, 1)); +voice_0_graph_terminal_reflection_right_merge = 0; +voice_0_graph_terminal_area_trachea_base = max(0.000001, 0.1444 * max(0.0, 1)); +voice_0_graph_terminal_reflection_trachea_base = 0; +voice_0_graph_terminal_area_left_labium = max(0.000001, 0.0484 * max(0.0, 1)); +voice_0_graph_terminal_reflection_left_labium = 0; +voice_0_graph_terminal_area_right_labium = max(0.000001, 0.04 * max(0.0, 1)); +voice_0_graph_terminal_reflection_right_labium = 0; +voice_0_graph_terminal_area_beak = max(0.000001, 0.2116 * max(0.0, 0.88)); +voice_0_graph_terminal_reflection_beak = ((0.96) * (1.0 - clip01(pow(clip01((max(0.0, patch_param_6)) / 1.5), 2.0))) + (-0.72) * clip01(pow(clip01((max(0.0, patch_param_6)) / 1.5), 2.0))); +voice_0_graph_node_area_left_labium = max(0.000001, voice_0_graph_terminal_area_left_labium); +voice_0_graph_node_reflection_left_labium = (voice_0_graph_terminal_reflection_left_labium) / 1; +voice_0_graph_node_area_left_merge = max(0.000001, voice_0_graph_terminal_area_left_merge); +voice_0_graph_node_reflection_left_merge = (voice_0_graph_terminal_reflection_left_merge) / 1; +voice_0_graph_node_area_right_labium = max(0.000001, voice_0_graph_terminal_area_right_labium); +voice_0_graph_node_reflection_right_labium = (voice_0_graph_terminal_reflection_right_labium) / 1; +voice_0_graph_node_area_right_merge = max(0.000001, voice_0_graph_terminal_area_right_merge); +voice_0_graph_node_reflection_right_merge = (voice_0_graph_terminal_reflection_right_merge) / 1; +voice_0_graph_node_area_trachea_base = max(0.000001, voice_0_graph_terminal_area_trachea_base); +voice_0_graph_node_reflection_trachea_base = (voice_0_graph_terminal_reflection_trachea_base) / 1; +voice_0_graph_node_area_beak = max(0.000001, voice_0_graph_terminal_area_beak); +voice_0_graph_node_reflection_beak = (voice_0_graph_terminal_reflection_beak) / 1; +voice_0_graph_segment_area_0 = max(0.000001, 0.1089); +voice_0_graph_segment_area_1 = max(0.000001, 0.0961); +voice_0_graph_segment_area_2 = max(0.000001, 0.2704); +voice_0_graph_connection_coupling_syrinx_merge = clip01(1); +voice_0_graph_connection_loss_syrinx_merge = clip01(1); +voice_0_graph_radiation_gain = 1.0; +voice_0_graph_source_left_labium = 0.0; +voice_0_graph_source_right_labium = 0.0; +voice_0_graph(x) = voice_0_graph_loop ~ si.bus(6) : (si.block(6), _) with { + voice_0_graph_loop(r0, r1, r2, l0, l1, l2) = voice_0_graph_next_r0, voice_0_graph_next_r1, voice_0_graph_next_r2, voice_0_graph_next_l0, voice_0_graph_next_l1, voice_0_graph_next_l2, voice_0_graph_out with { + voice_0_graph_in_0_start = l0; + voice_0_graph_in_0_end = r0; + voice_0_graph_in_1_start = l1; + voice_0_graph_in_1_end = r1; + voice_0_graph_in_2_start = l2; + voice_0_graph_in_2_end = r2; + voice_0_graph_source_left_labium_left_labium_load_pressure = voice_0_graph_node_incident_pressure_left_labium; + voice_0_graph_source_left_labium_left_labium_stiffness_hint = max(0.00002, min(0.16, pow(2.0 * ma.PI * max(20.0, ((max(20, 920 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age))) * (1.0 + select2(voice_0_age < 0, 0.0, sin(2.0 * ma.PI * (voice_0_age - 0) * 5.2) * 0.008))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) / ma.SR, 2.0))); + voice_0_graph_source_left_labium_left_labium_flow_scale = max(0.0, 1.15); + voice_0_graph_source_left_labium_left_labium_tissue_loss = clip01(0.18); + voice_0_graph_source_left_labium_left_labium_aperture_shape = clip01(0.4); + voice_0_graph_source_left_labium_left_labium_flow_loss = max(0.0, 0.35); + voice_0_graph_source_left_labium_left_labium_reservoir_pressure = (clip01(patch_param_0)) * (max(0.0, 1)); + voice_0_graph_source_left_labium_left_labium_downstream_pressure = (max(0.0, 0)) + (max(0.0, 0.42)) * ma.tanh(voice_0_graph_source_left_labium_left_labium_load_pressure); + voice_0_graph_source_left_labium_left_labium_pressure_drive = max(0.0, voice_0_graph_source_left_labium_left_labium_reservoir_pressure - voice_0_graph_source_left_labium_left_labium_downstream_pressure); + voice_0_graph_source_left_labium_left_labium_stiffness = max(0.00002, (max(0.0, 0.028)) * (0.55 + 1.10 * (clip01(patch_param_4)))); + voice_0_graph_source_left_labium_left_labium_modal_frequency = max(45.0, min(10000.0, (ma.SR / (2.0 * ma.PI)) * sqrt(max(0.00002, voice_0_graph_source_left_labium_left_labium_stiffness) / (max(0.02, 0.3))))); + voice_0_graph_source_left_labium_left_labium_load_detune = 1.0 - 0.035 * ma.tanh(voice_0_graph_source_left_labium_left_labium_load_pressure * (max(0.0, 0.42))); + voice_0_graph_source_left_labium_left_labium_oscillation_threshold = 0.030 + 0.070 * (max(0.0, 0.14)) + 0.080 * voice_0_graph_source_left_labium_left_labium_tissue_loss + 0.18 * clip01(max(0.0, patch_param_2)); + voice_0_graph_source_left_labium_left_labium_oscillation_gate = clip01((voice_0_graph_source_left_labium_left_labium_pressure_drive - voice_0_graph_source_left_labium_left_labium_oscillation_threshold) * (3.0 + 1.6 * max(0.0, 1.0 - (max(0.0, 0.14))))); + voice_0_graph_source_left_labium_left_labium_modal_q = 3.0 + 22.0 * clip01((clip01(patch_param_0)) * (1.0 - 0.45 * (max(0.0, 0.14)) - 0.35 * voice_0_graph_source_left_labium_left_labium_tissue_loss) + 0.35 * (clip01(patch_param_4))); + voice_0_graph_source_left_labium_left_labium_modal_seed = (no.noise * 0.018 + voice_0_graph_source_left_labium_left_labium_pressure_drive * max(0.0, 0.22 - clip01(max(0.0, patch_param_2))) * 0.16); + voice_0_graph_source_left_labium_left_labium_modal_ring = voice_0_graph_source_left_labium_left_labium_modal_seed : fi.resonbp(voice_0_graph_source_left_labium_left_labium_modal_frequency, voice_0_graph_source_left_labium_left_labium_modal_q, 1); + voice_0_graph_source_left_labium_left_labium_modal_oscillator = os.osc(voice_0_graph_source_left_labium_left_labium_modal_frequency * voice_0_graph_source_left_labium_left_labium_load_detune) * voice_0_graph_source_left_labium_left_labium_oscillation_gate; + voice_0_graph_source_left_labium_left_labium_modal_tissue = (voice_0_graph_source_left_labium_left_labium_modal_oscillator * (0.70 + 0.80 * (clip01(patch_param_4))) + voice_0_graph_source_left_labium_left_labium_modal_ring * 0.35) * max(0.0, 1.0 - 0.35 * (max(0.0, 0.14)) - 0.45 * voice_0_graph_source_left_labium_left_labium_tissue_loss); + voice_0_graph_source_left_labium_left_labium_velocity_decay = min(0.9995, max(0.20, 1.0 - ((0.008 + 0.08 * (max(0.0, 0.14)) + 0.055 * voice_0_graph_source_left_labium_left_labium_tissue_loss) / (max(0.02, 0.3))))); + voice_0_graph_source_left_labium_left_labium_displacement_decay = min(0.9998, max(0.20, 1.0 - 0.0008 / (max(0.02, 0.3)))); + voice_0_graph_source_left_labium_left_labium_force = (voice_0_graph_source_left_labium_left_labium_pressure_drive * (0.0004 + 0.0024 * (1.0 - clip01(max(0.0, patch_param_2)))) - (max(0.0, 0.42)) * voice_0_graph_source_left_labium_left_labium_load_pressure * 0.001) / (max(0.02, 0.3)); + voice_0_graph_source_left_labium_left_labium_velocity = voice_0_graph_source_left_labium_left_labium_force : + ~ *(voice_0_graph_source_left_labium_left_labium_velocity_decay / (1.0 + 10.0 * voice_0_graph_source_left_labium_left_labium_stiffness + 0.4 * (max(0.0, 0.88)))); + voice_0_graph_source_left_labium_left_labium_displacement = voice_0_graph_source_left_labium_left_labium_velocity : + ~ *(voice_0_graph_source_left_labium_left_labium_displacement_decay / (1.0 + 1.5 * voice_0_graph_source_left_labium_left_labium_stiffness)); + voice_0_graph_source_left_labium_left_labium_aperture_linear = max(0.0, (max(0.0, 0.024)) + (max(0.0, patch_param_2)) + voice_0_graph_source_left_labium_left_labium_displacement - (max(0.0, 0.88)) * pow(voice_0_graph_source_left_labium_left_labium_displacement, 3.0)); + voice_0_graph_source_left_labium_left_labium_aperture = voice_0_graph_source_left_labium_left_labium_aperture_linear * (1.0 - 0.55 * voice_0_graph_source_left_labium_left_labium_aperture_shape) + pow(voice_0_graph_source_left_labium_left_labium_aperture_linear, 2.0) * (0.55 * voice_0_graph_source_left_labium_left_labium_aperture_shape); + voice_0_graph_source_left_labium_left_labium_flow_resistance = 1.0 + voice_0_graph_source_left_labium_left_labium_flow_loss * (0.35 + 1.8 / max(0.035, voice_0_graph_source_left_labium_left_labium_aperture + (max(0.0, 0.024)))); + voice_0_graph_source_left_labium_left_labium_turbulence = no.noise : fi.highpass(2, 1200.0 + 2800.0 * clip01(1.0 - voice_0_graph_source_left_labium_left_labium_aperture)); + voice_0_graph_source_left_labium_left_labium_voicing = voice_0_graph_source_left_labium_left_labium_modal_tissue * (0.18 + 1.45 * (clip01(patch_param_4))); + voice_0_graph_source_left_labium_left_labium_flow = ma.tanh(((voice_0_graph_source_left_labium_left_labium_pressure_drive * voice_0_graph_source_left_labium_left_labium_aperture * (1.5 + 3.5 * voice_0_graph_source_left_labium_left_labium_flow_scale)) + (voice_0_graph_source_left_labium_left_labium_voicing * voice_0_graph_source_left_labium_left_labium_pressure_drive * (0.45 + 1.55 * (clip01(patch_param_4))))) / voice_0_graph_source_left_labium_left_labium_flow_resistance); + voice_0_graph_source_left_labium_left_labium_noise = voice_0_graph_source_left_labium_left_labium_turbulence * (clip01(0.018)) * voice_0_graph_source_left_labium_left_labium_pressure_drive * clip01(voice_0_graph_source_left_labium_left_labium_aperture) * (1.0 - 0.55 * (clip01(patch_param_4))) / voice_0_graph_source_left_labium_left_labium_flow_resistance; + voice_0_graph_source_left_labium_left_labium_out = (voice_0_graph_source_left_labium_left_labium_flow * voice_0_graph_source_left_labium_left_labium_flow_scale * (0.55 + 2.6 * voice_0_graph_source_left_labium_left_labium_pressure_drive) + voice_0_graph_source_left_labium_left_labium_noise) * ((1) * (1.0)); + voice_0_graph_node_incident_pressure_left_labium = (voice_0_graph_in_0_start) / 1; + voice_0_graph_node_source_left_labium = voice_0_graph_source_left_labium_left_labium_out; + voice_0_graph_node_incident_pressure_left_merge = (voice_0_graph_in_0_end) / 1; + voice_0_graph_node_source_left_merge = 0.0; + voice_0_graph_source_right_labium_right_labium_load_pressure = voice_0_graph_node_incident_pressure_right_labium; + voice_0_graph_source_right_labium_right_labium_stiffness_hint = max(0.00002, min(0.16, pow(2.0 * ma.PI * max(20.0, ((max(20, 920 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age))) * (1.0 + select2(voice_0_age < 0, 0.0, sin(2.0 * ma.PI * (voice_0_age - 0) * 5.2) * 0.008))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) / ma.SR, 2.0))); + voice_0_graph_source_right_labium_right_labium_flow_scale = max(0.0, 1.08); + voice_0_graph_source_right_labium_right_labium_tissue_loss = clip01(0.2); + voice_0_graph_source_right_labium_right_labium_aperture_shape = clip01(0.4); + voice_0_graph_source_right_labium_right_labium_flow_loss = max(0.0, 0.35); + voice_0_graph_source_right_labium_right_labium_reservoir_pressure = (clip01(patch_param_1)) * (max(0.0, 1)); + voice_0_graph_source_right_labium_right_labium_downstream_pressure = (max(0.0, 0)) + (max(0.0, 0.42)) * ma.tanh(voice_0_graph_source_right_labium_right_labium_load_pressure); + voice_0_graph_source_right_labium_right_labium_pressure_drive = max(0.0, voice_0_graph_source_right_labium_right_labium_reservoir_pressure - voice_0_graph_source_right_labium_right_labium_downstream_pressure); + voice_0_graph_source_right_labium_right_labium_stiffness = max(0.00002, (max(0.0, 0.032)) * (0.55 + 1.10 * (clip01(patch_param_5)))); + voice_0_graph_source_right_labium_right_labium_modal_frequency = max(45.0, min(10000.0, (ma.SR / (2.0 * ma.PI)) * sqrt(max(0.00002, voice_0_graph_source_right_labium_right_labium_stiffness) / (max(0.02, 0.32))))); + voice_0_graph_source_right_labium_right_labium_load_detune = 1.0 - 0.035 * ma.tanh(voice_0_graph_source_right_labium_right_labium_load_pressure * (max(0.0, 0.42))); + voice_0_graph_source_right_labium_right_labium_oscillation_threshold = 0.030 + 0.070 * (max(0.0, 0.16)) + 0.080 * voice_0_graph_source_right_labium_right_labium_tissue_loss + 0.18 * clip01(max(0.0, patch_param_3)); + voice_0_graph_source_right_labium_right_labium_oscillation_gate = clip01((voice_0_graph_source_right_labium_right_labium_pressure_drive - voice_0_graph_source_right_labium_right_labium_oscillation_threshold) * (3.0 + 1.6 * max(0.0, 1.0 - (max(0.0, 0.16))))); + voice_0_graph_source_right_labium_right_labium_modal_q = 3.0 + 22.0 * clip01((clip01(patch_param_1)) * (1.0 - 0.45 * (max(0.0, 0.16)) - 0.35 * voice_0_graph_source_right_labium_right_labium_tissue_loss) + 0.35 * (clip01(patch_param_5))); + voice_0_graph_source_right_labium_right_labium_modal_seed = (no.noise * 0.018 + voice_0_graph_source_right_labium_right_labium_pressure_drive * max(0.0, 0.22 - clip01(max(0.0, patch_param_3))) * 0.16); + voice_0_graph_source_right_labium_right_labium_modal_ring = voice_0_graph_source_right_labium_right_labium_modal_seed : fi.resonbp(voice_0_graph_source_right_labium_right_labium_modal_frequency, voice_0_graph_source_right_labium_right_labium_modal_q, 1); + voice_0_graph_source_right_labium_right_labium_modal_oscillator = os.osc(voice_0_graph_source_right_labium_right_labium_modal_frequency * voice_0_graph_source_right_labium_right_labium_load_detune) * voice_0_graph_source_right_labium_right_labium_oscillation_gate; + voice_0_graph_source_right_labium_right_labium_modal_tissue = (voice_0_graph_source_right_labium_right_labium_modal_oscillator * (0.70 + 0.80 * (clip01(patch_param_5))) + voice_0_graph_source_right_labium_right_labium_modal_ring * 0.35) * max(0.0, 1.0 - 0.35 * (max(0.0, 0.16)) - 0.45 * voice_0_graph_source_right_labium_right_labium_tissue_loss); + voice_0_graph_source_right_labium_right_labium_velocity_decay = min(0.9995, max(0.20, 1.0 - ((0.008 + 0.08 * (max(0.0, 0.16)) + 0.055 * voice_0_graph_source_right_labium_right_labium_tissue_loss) / (max(0.02, 0.32))))); + voice_0_graph_source_right_labium_right_labium_displacement_decay = min(0.9998, max(0.20, 1.0 - 0.0008 / (max(0.02, 0.32)))); + voice_0_graph_source_right_labium_right_labium_force = (voice_0_graph_source_right_labium_right_labium_pressure_drive * (0.0004 + 0.0024 * (1.0 - clip01(max(0.0, patch_param_3)))) - (max(0.0, 0.42)) * voice_0_graph_source_right_labium_right_labium_load_pressure * 0.001) / (max(0.02, 0.32)); + voice_0_graph_source_right_labium_right_labium_velocity = voice_0_graph_source_right_labium_right_labium_force : + ~ *(voice_0_graph_source_right_labium_right_labium_velocity_decay / (1.0 + 10.0 * voice_0_graph_source_right_labium_right_labium_stiffness + 0.4 * (max(0.0, 0.88)))); + voice_0_graph_source_right_labium_right_labium_displacement = voice_0_graph_source_right_labium_right_labium_velocity : + ~ *(voice_0_graph_source_right_labium_right_labium_displacement_decay / (1.0 + 1.5 * voice_0_graph_source_right_labium_right_labium_stiffness)); + voice_0_graph_source_right_labium_right_labium_aperture_linear = max(0.0, (max(0.0, 0.024)) + (max(0.0, patch_param_3)) + voice_0_graph_source_right_labium_right_labium_displacement - (max(0.0, 0.88)) * pow(voice_0_graph_source_right_labium_right_labium_displacement, 3.0)); + voice_0_graph_source_right_labium_right_labium_aperture = voice_0_graph_source_right_labium_right_labium_aperture_linear * (1.0 - 0.55 * voice_0_graph_source_right_labium_right_labium_aperture_shape) + pow(voice_0_graph_source_right_labium_right_labium_aperture_linear, 2.0) * (0.55 * voice_0_graph_source_right_labium_right_labium_aperture_shape); + voice_0_graph_source_right_labium_right_labium_flow_resistance = 1.0 + voice_0_graph_source_right_labium_right_labium_flow_loss * (0.35 + 1.8 / max(0.035, voice_0_graph_source_right_labium_right_labium_aperture + (max(0.0, 0.024)))); + voice_0_graph_source_right_labium_right_labium_turbulence = no.noise : fi.highpass(2, 1200.0 + 2800.0 * clip01(1.0 - voice_0_graph_source_right_labium_right_labium_aperture)); + voice_0_graph_source_right_labium_right_labium_voicing = voice_0_graph_source_right_labium_right_labium_modal_tissue * (0.18 + 1.45 * (clip01(patch_param_5))); + voice_0_graph_source_right_labium_right_labium_flow = ma.tanh(((voice_0_graph_source_right_labium_right_labium_pressure_drive * voice_0_graph_source_right_labium_right_labium_aperture * (1.5 + 3.5 * voice_0_graph_source_right_labium_right_labium_flow_scale)) + (voice_0_graph_source_right_labium_right_labium_voicing * voice_0_graph_source_right_labium_right_labium_pressure_drive * (0.45 + 1.55 * (clip01(patch_param_5))))) / voice_0_graph_source_right_labium_right_labium_flow_resistance); + voice_0_graph_source_right_labium_right_labium_noise = voice_0_graph_source_right_labium_right_labium_turbulence * (clip01(0.016)) * voice_0_graph_source_right_labium_right_labium_pressure_drive * clip01(voice_0_graph_source_right_labium_right_labium_aperture) * (1.0 - 0.55 * (clip01(patch_param_5))) / voice_0_graph_source_right_labium_right_labium_flow_resistance; + voice_0_graph_source_right_labium_right_labium_out = (voice_0_graph_source_right_labium_right_labium_flow * voice_0_graph_source_right_labium_right_labium_flow_scale * (0.55 + 2.6 * voice_0_graph_source_right_labium_right_labium_pressure_drive) + voice_0_graph_source_right_labium_right_labium_noise) * ((0.94) * (1.0)); + voice_0_graph_node_incident_pressure_right_labium = (voice_0_graph_in_1_start) / 1; + voice_0_graph_node_source_right_labium = voice_0_graph_source_right_labium_right_labium_out; + voice_0_graph_node_incident_pressure_right_merge = (voice_0_graph_in_1_end) / 1; + voice_0_graph_node_source_right_merge = 0.0; + voice_0_graph_node_incident_pressure_trachea_base = (voice_0_graph_in_2_start) / 1; + voice_0_graph_node_source_trachea_base = 0.0; + voice_0_graph_node_incident_pressure_beak = (voice_0_graph_in_2_end) / 1; + voice_0_graph_node_source_beak = 0.0; + voice_0_graph_connection_reflection_syrinx_merge_left_merge_0_end = (2.0 * (voice_0_graph_segment_area_0) - (voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2)) / max(0.000001, voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2); + voice_0_graph_connection_scattered_syrinx_merge_left_merge_0_end = voice_0_graph_connection_reflection_syrinx_merge_left_merge_0_end * voice_0_graph_in_0_end + (1.0 + voice_0_graph_connection_reflection_syrinx_merge_left_merge_0_end) * (voice_0_graph_in_1_end + voice_0_graph_in_2_start); + voice_0_graph_out_0_end = ((voice_0_graph_connection_scattered_syrinx_merge_left_merge_0_end) * (voice_0_graph_connection_coupling_syrinx_merge) + voice_0_graph_in_0_end * (1.0 - (voice_0_graph_connection_coupling_syrinx_merge)) + (voice_0_graph_node_source_left_merge) / 1) * voice_0_graph_connection_loss_syrinx_merge; + voice_0_graph_connection_reflection_syrinx_merge_right_merge_1_end = (2.0 * (voice_0_graph_segment_area_1) - (voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2)) / max(0.000001, voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2); + voice_0_graph_connection_scattered_syrinx_merge_right_merge_1_end = voice_0_graph_connection_reflection_syrinx_merge_right_merge_1_end * voice_0_graph_in_1_end + (1.0 + voice_0_graph_connection_reflection_syrinx_merge_right_merge_1_end) * (voice_0_graph_in_0_end + voice_0_graph_in_2_start); + voice_0_graph_out_1_end = ((voice_0_graph_connection_scattered_syrinx_merge_right_merge_1_end) * (voice_0_graph_connection_coupling_syrinx_merge) + voice_0_graph_in_1_end * (1.0 - (voice_0_graph_connection_coupling_syrinx_merge)) + (voice_0_graph_node_source_right_merge) / 1) * voice_0_graph_connection_loss_syrinx_merge; + voice_0_graph_connection_reflection_syrinx_merge_trachea_base_2_start = (2.0 * (voice_0_graph_segment_area_2) - (voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2)) / max(0.000001, voice_0_graph_segment_area_0 + voice_0_graph_segment_area_1 + voice_0_graph_segment_area_2); + voice_0_graph_connection_scattered_syrinx_merge_trachea_base_2_start = voice_0_graph_connection_reflection_syrinx_merge_trachea_base_2_start * voice_0_graph_in_2_start + (1.0 + voice_0_graph_connection_reflection_syrinx_merge_trachea_base_2_start) * (voice_0_graph_in_0_end + voice_0_graph_in_1_end); + voice_0_graph_out_2_start = ((voice_0_graph_connection_scattered_syrinx_merge_trachea_base_2_start) * (voice_0_graph_connection_coupling_syrinx_merge) + voice_0_graph_in_2_start * (1.0 - (voice_0_graph_connection_coupling_syrinx_merge)) + (voice_0_graph_node_source_trachea_base) / 1) * voice_0_graph_connection_loss_syrinx_merge; + voice_0_graph_connection_energy_in_syrinx_merge = (voice_0_graph_segment_area_0) * pow(voice_0_graph_in_0_end, 2.0) + (voice_0_graph_segment_area_1) * pow(voice_0_graph_in_1_end, 2.0) + (voice_0_graph_segment_area_2) * pow(voice_0_graph_in_2_start, 2.0); + voice_0_graph_connection_energy_out_syrinx_merge = (voice_0_graph_segment_area_0) * pow(voice_0_graph_out_0_end, 2.0) + (voice_0_graph_segment_area_1) * pow(voice_0_graph_out_1_end, 2.0) + (voice_0_graph_segment_area_2) * pow(voice_0_graph_out_2_start, 2.0); + voice_0_graph_out_0_start = voice_0_graph_in_0_start * voice_0_graph_node_reflection_left_labium + (voice_0_graph_node_source_left_labium) / 1; + voice_0_graph_out_1_start = voice_0_graph_in_1_start * voice_0_graph_node_reflection_right_labium + (voice_0_graph_node_source_right_labium) / 1; + voice_0_graph_radiation_boundary_load_beak = clip01((voice_0_graph_radiation_admittance_beak) * (voice_0_graph_radiation_differentiation_beak) * (clip01(0.98))); + voice_0_graph_radiation_reflected_raw_beak = (voice_0_graph_in_2_end) * (voice_0_graph_terminal_reflection_beak) + (voice_0_graph_node_source_beak); + voice_0_graph_radiation_reflected_loaded_beak = (voice_0_graph_radiation_reflected_raw_beak) * (1.0 - (voice_0_graph_radiation_boundary_load_beak)) + ((voice_0_graph_radiation_reflected_raw_beak) : fi.lowpass(1, voice_0_graph_radiation_highpass_beak)) * (voice_0_graph_radiation_boundary_load_beak); + voice_0_graph_out_2_end = voice_0_graph_radiation_reflected_loaded_beak; + voice_0_graph_radiation_model_beak = 2; + voice_0_graph_radiation_reference_area_beak = max(0.10, 1.10 * 1.10 * (0.25 + 0.75 * clip01(pow(clip01((max(0.0, patch_param_6)) / 1.5), 2.0)))); + voice_0_graph_radiation_differentiation_beak = (0.50 + 0.22 * clip01(pow(clip01((max(0.0, patch_param_6)) / 1.5), 2.0))); + voice_0_graph_radiation_highpass_beak = (180.0 + 220.0 * clip01(pow(clip01((max(0.0, patch_param_6)) / 1.5), 2.0))); + voice_0_graph_radiation_admittance_beak = sqrt(clip01((voice_0_graph_terminal_area_beak) / max(0.000001, (voice_0_graph_terminal_area_beak) + (voice_0_graph_radiation_reference_area_beak)))); + voice_0_graph_radiation_flow_beak = ((voice_0_graph_in_2_end - voice_0_graph_out_2_end)); + voice_0_graph_delay_0 = max(0.000001, 0.00011079 * ma.SR); + voice_0_graph_segment_loss_0 = clip01((0.999) * (sqrt(clip01((voice_0_graph_segment_area_0) / max(0.000001, (voice_0_graph_segment_area_0) + 0.02))))); + voice_0_graph_next_r0 = voice_0_graph_out_0_start : de.fdelay(2048, min(2047, max(0.000001, voice_0_graph_delay_0))) * voice_0_graph_segment_loss_0; + voice_0_graph_next_l0 = voice_0_graph_out_0_end : de.fdelay(2048, min(2047, max(0.000001, voice_0_graph_delay_0))) * voice_0_graph_segment_loss_0; + voice_0_graph_delay_1 = max(0.000001, 0.00010496 * ma.SR); + voice_0_graph_segment_loss_1 = clip01((0.999) * (sqrt(clip01((voice_0_graph_segment_area_1) / max(0.000001, (voice_0_graph_segment_area_1) + 0.02))))); + voice_0_graph_next_r1 = voice_0_graph_out_1_start : de.fdelay(2048, min(2047, max(0.000001, voice_0_graph_delay_1))) * voice_0_graph_segment_loss_1; + voice_0_graph_next_l1 = voice_0_graph_out_1_end : de.fdelay(2048, min(2047, max(0.000001, voice_0_graph_delay_1))) * voice_0_graph_segment_loss_1; + voice_0_graph_delay_2 = max(0.000001, 0.0002449 * ma.SR); + voice_0_graph_segment_loss_2 = clip01((0.999) * (sqrt(clip01((voice_0_graph_segment_area_2) / max(0.000001, (voice_0_graph_segment_area_2) + 0.02))))); + voice_0_graph_next_r2 = voice_0_graph_out_2_start : de.fdelay(2048, min(2047, max(0.000001, voice_0_graph_delay_2))) * voice_0_graph_segment_loss_2; + voice_0_graph_next_l2 = voice_0_graph_out_2_end : de.fdelay(2048, min(2047, max(0.000001, voice_0_graph_delay_2))) * voice_0_graph_segment_loss_2; + voice_0_graph_out = (((voice_0_graph_radiation_flow_beak * (1.0 - (voice_0_graph_radiation_differentiation_beak)) + (voice_0_graph_radiation_flow_beak : fi.highpass(1, voice_0_graph_radiation_highpass_beak)) * (voice_0_graph_radiation_differentiation_beak)) * clip01(0.98) * voice_0_graph_radiation_admittance_beak)) * voice_0_graph_radiation_gain; + }; +}; +voice_0_acoustic_graph_radiated = voice_0_graph(voice_0_graph_drive); +voice_0_freq = ((max(20, 920 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age))) * (1.0 + select2(voice_0_age < 0, 0.0, sin(2.0 * ma.PI * (voice_0_age - 0) * 5.2) * 0.008))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = voice_0_acoustic_graph_radiated; +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.82 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.03 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.03 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)) : fi.resonbp(max(20.0, clip01(0.36) * 18000.0), max(0.1, 1.5), 1.0); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.12, 0.92) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.3); + +process = softclip((voice_0) * 0.46); diff --git a/tools/aqua-playground/lowered/bfxr-coin-spark.dsp b/tools/aqua-playground/lowered/bfxr-coin-spark.dsp new file mode 100644 index 0000000..cc4ec46 --- /dev/null +++ b/tools/aqua-playground/lowered/bfxr-coin-spark.dsp @@ -0,0 +1,65 @@ +import("stdfaust.lib"); +declare name "bfxr-coin-spark"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 1180 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 1180 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 1180 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 5))) * (max(0.0, 3.2 + patch_mod_fm_index + 0.0) * exp(-voice_0_age / max(0.16, 0.0001))) / ma.PI)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.05 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.05 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.42, 0.022) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.18); + +voice_1_age = age; +voice_1_freq = ((max(20, 1770 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 1770 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 1770 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 7))) * (max(0.0, 1.7 + patch_mod_fm_index + 0.0) * exp(-voice_1_age / max(0.11, 0.0001))) / ma.PI)); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.05 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.05 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0, 0, 1, 0.42, 0.022) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.09); + +process = softclip((voice_0 + voice_1) * 1); diff --git a/tools/aqua-playground/lowered/bfxr-portal-chirp.dsp b/tools/aqua-playground/lowered/bfxr-portal-chirp.dsp new file mode 100644 index 0000000..ef6741c --- /dev/null +++ b/tools/aqua-playground/lowered/bfxr-portal-chirp.dsp @@ -0,0 +1,65 @@ +import("stdfaust.lib"); +declare name "bfxr-portal-chirp"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0 + 0.018 * lfo_sin(9, 0); +patch_mod_duty = 0 + 0.06 * lfo_sin(9, 0); +patch_mod_lpf = 0 + 0.08 * lfo_sin(9, 0); +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 320 * pow(2.0, 0.85 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = 2.0 * wrap01(os.phasor(1.0, ((max(20, 320 * pow(2.0, 0.85 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0) - 1.0; +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.16 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.16 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0.08 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0.08 + patch_mod_fold + 0.0) * 3.5)) * clip01(0.08 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.72 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.08 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.08 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.28, 0.09) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.14); + +voice_1_age = age; +voice_1_freq = ((max(20, 640 * pow(2.0, 0.85 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = select2(wrap01(os.phasor(1.0, ((max(20, 640 * pow(2.0, 0.85 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0) < clip01(0.44 + 0 * voice_1_age + patch_mod_duty + 0.0), -0.5, 0.5); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.16 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.16 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0.08 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0.08 + patch_mod_fold + 0.0) * 3.5)) * clip01(0.08 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.72 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.08 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.08 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0, 0, 1, 0.28, 0.09) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.05); + +process = softclip((voice_0 + voice_1) * 1); diff --git a/tools/aqua-playground/lowered/bfxr-shield-pop.dsp b/tools/aqua-playground/lowered/bfxr-shield-pop.dsp new file mode 100644 index 0000000..ef7c445 --- /dev/null +++ b/tools/aqua-playground/lowered/bfxr-shield-pop.dsp @@ -0,0 +1,65 @@ +import("stdfaust.lib"); +declare name "bfxr-shield-pop"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 260 * pow(2.0, -0.75 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age))) * (1.0 + select2(voice_0_age < 0, 0.0, sin(2.0 * ma.PI * (voice_0_age - 0) * 7.2) * 0.04))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = 1.0 - 4.0 * abs(wrap01(os.phasor(1.0, ((max(20, 260 * pow(2.0, -0.75 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age))) * (1.0 + select2(voice_0_age < 0, 0.0, sin(2.0 * ma.PI * (voice_0_age - 0) * 7.2) * 0.04))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0) - 0.5); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.68 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.03 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.03 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 0.7575758, 0.36, 0.04) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.264); + +voice_1_age = age; +voice_1_freq = ((max(20, 900 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = no.noise; +voice_1_colored = (voice_1_osc * (1.0 - clip01(0.7 + patch_mod_noise + 0.0)) + no.noise * clip01(0.7 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.68 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.4 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.4 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0, 0, 0.7575758, 0.16, 0.018) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.05); + +process = softclip((voice_0 + voice_1) * 1); diff --git a/tools/aqua-playground/lowered/bfxr-ui-bloom.dsp b/tools/aqua-playground/lowered/bfxr-ui-bloom.dsp new file mode 100644 index 0000000..2e48f40 --- /dev/null +++ b/tools/aqua-playground/lowered/bfxr-ui-bloom.dsp @@ -0,0 +1,65 @@ +import("stdfaust.lib"); +declare name "bfxr-ui-bloom"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time - floor(time / 0.18) * 0.18; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 392 * pow(2.0, 0.18 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * select2(voice_0_age < 0.08, 1.25, 1.0) * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 392 * pow(2.0, 0.18 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * select2(voice_0_age < 0.08, 1.25, 1.0) * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.06 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.06 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.78 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 0.8196721, 0.5, 0.05) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.1464); + +voice_1_age = age; +voice_1_freq = ((max(20, 588 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 588 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.06 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.06 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.78 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0.004, 0, 0.8196721, 0.38, 0.04) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.06); + +process = softclip((voice_0 + voice_1) * 1); diff --git a/tools/aqua-playground/lowered/catalog.json b/tools/aqua-playground/lowered/catalog.json new file mode 100644 index 0000000..d3e3440 --- /dev/null +++ b/tools/aqua-playground/lowered/catalog.json @@ -0,0 +1,300 @@ +[ + { + "name": "thruster", + "origin": "thruster/thruster.dsp", + "kind": "faust", + "dsp": "thruster.dsp", + "warnings": [] + }, + { + "name": "808-clap", + "origin": "808/clap.aqua", + "kind": "aqua", + "dsp": "808-clap.dsp", + "warnings": [] + }, + { + "name": "808-cowbell", + "origin": "808/cowbell.aqua", + "kind": "aqua", + "dsp": "808-cowbell.dsp", + "warnings": [] + }, + { + "name": "808-hat", + "origin": "808/hat.aqua", + "kind": "aqua", + "dsp": "808-hat.dsp", + "warnings": [] + }, + { + "name": "808-kick", + "origin": "808/kick.aqua", + "kind": "aqua", + "dsp": "808-kick.dsp", + "warnings": [] + }, + { + "name": "808-snare", + "origin": "808/snare.aqua", + "kind": "aqua", + "dsp": "808-snare.dsp", + "warnings": [] + }, + { + "name": "808-tom", + "origin": "808/tom.aqua", + "kind": "aqua", + "dsp": "808-tom.dsp", + "warnings": [] + }, + { + "name": "advanced-alien-multivalve-graph", + "origin": "advanced/alien-multivalve-graph.aqua", + "kind": "aqua", + "dsp": "advanced-alien-multivalve-graph.dsp", + "warnings": [] + }, + { + "name": "advanced-aurora-pad", + "origin": "advanced/aurora-pad.aqua", + "kind": "aqua", + "dsp": "advanced-aurora-pad.dsp", + "warnings": [] + }, + { + "name": "advanced-bird-syrinx", + "origin": "advanced/bird-syrinx.aqua", + "kind": "aqua", + "dsp": "advanced-bird-syrinx.dsp", + "warnings": [] + }, + { + "name": "advanced-bird-syrinx-graph", + "origin": "advanced/bird-syrinx-graph.aqua", + "kind": "aqua", + "dsp": "advanced-bird-syrinx-graph.dsp", + "warnings": [] + }, + { + "name": "advanced-glass-creature", + "origin": "advanced/glass-creature.aqua", + "kind": "aqua", + "dsp": "advanced-glass-creature.dsp", + "warnings": [] + }, + { + "name": "advanced-human-larynx-graph", + "origin": "advanced/human-larynx-graph.aqua", + "kind": "aqua", + "dsp": "advanced-human-larynx-graph.dsp", + "warnings": [] + }, + { + "name": "advanced-machine-breath", + "origin": "advanced/machine-breath.aqua", + "kind": "aqua", + "dsp": "advanced-machine-breath.dsp", + "warnings": [] + }, + { + "name": "advanced-ritual-sequence", + "origin": "advanced/ritual-sequence.aqua", + "kind": "aqua", + "dsp": "advanced-ritual-sequence.dsp", + "warnings": [] + }, + { + "name": "advanced-subtractive-drums", + "origin": "advanced/subtractive-drums.aqua", + "kind": "aqua", + "dsp": "advanced-subtractive-drums.dsp", + "warnings": [ + "voice_0: low-pass resonance is approximated with Faust resonlp" + ] + }, + { + "name": "advanced-syrinx-voice", + "origin": "advanced/syrinx-voice.aqua", + "kind": "aqua", + "dsp": "advanced-syrinx-voice.dsp", + "warnings": [] + }, + { + "name": "bfxr-coin-spark", + "origin": "bfxr/coin-spark.aqua", + "kind": "aqua", + "dsp": "bfxr-coin-spark.dsp", + "warnings": [] + }, + { + "name": "bfxr-portal-chirp", + "origin": "bfxr/portal-chirp.aqua", + "kind": "aqua", + "dsp": "bfxr-portal-chirp.dsp", + "warnings": [] + }, + { + "name": "bfxr-shield-pop", + "origin": "bfxr/shield-pop.aqua", + "kind": "aqua", + "dsp": "bfxr-shield-pop.dsp", + "warnings": [] + }, + { + "name": "bfxr-ui-bloom", + "origin": "bfxr/ui-bloom.aqua", + "kind": "aqua", + "dsp": "bfxr-ui-bloom.dsp", + "warnings": [] + }, + { + "name": "dx7-algorithm-32-additive-organ", + "origin": "dx7/algorithm-32-additive-organ.aqua", + "kind": "aqua", + "dsp": "dx7-algorithm-32-additive-organ.dsp", + "warnings": [] + }, + { + "name": "dx7-algorithm-8-bright-pair", + "origin": "dx7/algorithm-8-bright-pair.aqua", + "kind": "aqua", + "dsp": "dx7-algorithm-8-bright-pair.dsp", + "warnings": [] + }, + { + "name": "dx7-public-domain-mc-mm-5-3", + "origin": "dx7/public-domain-mc-mm-5-3.aqua", + "kind": "aqua", + "dsp": "dx7-public-domain-mc-mm-5-3.dsp", + "warnings": [] + }, + { + "name": "dx7-public-domain-prc-synth1-calibrated", + "origin": "dx7/public-domain/prc-synth1-calibrated.aqua", + "kind": "aqua", + "dsp": "dx7-public-domain-prc-synth1-calibrated.dsp", + "warnings": [] + }, + { + "name": "examples-language-tour", + "origin": "examples/language-tour.aqua", + "kind": "aqua", + "dsp": "examples-language-tour.dsp", + "warnings": [ + "voice_2: low-pass resonance is approximated with Faust resonlp" + ] + }, + { + "name": "fm-bell-bell", + "origin": "fm-bell/bell.aqua", + "kind": "aqua", + "dsp": "fm-bell-bell.dsp", + "warnings": [] + }, + { + "name": "fm-bell-chime", + "origin": "fm-bell/chime.aqua", + "kind": "aqua", + "dsp": "fm-bell-chime.dsp", + "warnings": [] + }, + { + "name": "fm-bell-coin", + "origin": "fm-bell/coin.aqua", + "kind": "aqua", + "dsp": "fm-bell-coin.dsp", + "warnings": [] + }, + { + "name": "fm-bell-gong", + "origin": "fm-bell/gong.aqua", + "kind": "aqua", + "dsp": "fm-bell-gong.dsp", + "warnings": [] + }, + { + "name": "sfxr-blip", + "origin": "sfxr/blip.aqua", + "kind": "aqua", + "dsp": "sfxr-blip.dsp", + "warnings": [] + }, + { + "name": "sfxr-classic-classic-sfxr-abstract-golf", + "origin": "sfxr/classic/classic-sfxr-abstract-golf.aqua", + "kind": "aqua", + "dsp": "sfxr-classic-classic-sfxr-abstract-golf.dsp", + "warnings": [] + }, + { + "name": "sfxr-explosion", + "origin": "sfxr/explosion.aqua", + "kind": "aqua", + "dsp": "sfxr-explosion.dsp", + "warnings": [] + }, + { + "name": "sfxr-hit", + "origin": "sfxr/hit.aqua", + "kind": "aqua", + "dsp": "sfxr-hit.dsp", + "warnings": [] + }, + { + "name": "sfxr-jump", + "origin": "sfxr/jump.aqua", + "kind": "aqua", + "dsp": "sfxr-jump.dsp", + "warnings": [] + }, + { + "name": "sfxr-laser", + "origin": "sfxr/laser.aqua", + "kind": "aqua", + "dsp": "sfxr-laser.dsp", + "warnings": [] + }, + { + "name": "sfxr-pickup", + "origin": "sfxr/pickup.aqua", + "kind": "aqua", + "dsp": "sfxr-pickup.dsp", + "warnings": [] + }, + { + "name": "sfxr-powerup", + "origin": "sfxr/powerup.aqua", + "kind": "aqua", + "dsp": "sfxr-powerup.dsp", + "warnings": [] + }, + { + "name": "wobble-bass-growl", + "origin": "wobble-bass/growl.aqua", + "kind": "aqua", + "dsp": "wobble-bass-growl.dsp", + "warnings": [] + }, + { + "name": "wobble-bass-neuro", + "origin": "wobble-bass/neuro.aqua", + "kind": "aqua", + "dsp": "wobble-bass-neuro.dsp", + "warnings": [] + }, + { + "name": "wobble-bass-talker", + "origin": "wobble-bass/talker.aqua", + "kind": "aqua", + "dsp": "wobble-bass-talker.dsp", + "warnings": [] + }, + { + "name": "wobble-bass-yoy", + "origin": "wobble-bass/yoy.aqua", + "kind": "aqua", + "dsp": "wobble-bass-yoy.dsp", + "warnings": [] + } +] \ No newline at end of file diff --git a/tools/aqua-playground/lowered/dx7-algorithm-32-additive-organ.dsp b/tools/aqua-playground/lowered/dx7-algorithm-32-additive-organ.dsp new file mode 100644 index 0000000..f617a62 --- /dev/null +++ b/tools/aqua-playground/lowered/dx7-algorithm-32-additive-organ.dsp @@ -0,0 +1,112 @@ +import("stdfaust.lib"); +declare name "dx7-algorithm-32-additive-organ"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_param_0 = hslider("/macro/drawbar", 0.78, 0, 1, 0.001) : si.smoo; +patch_param_1 = hslider("/macro/shimmer", 0.08, 0, 0.3, 0.001) : si.smoo; + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 196 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 196 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.03 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.03 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.96 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.015 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.015 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0.002, 0, 1, 0.32, 0.48) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.14); + +voice_1_age = age; +voice_1_freq = ((max(20, 392 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 392 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.03 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.03 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.96 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.015 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.015 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0.002, 0, 1, 0.32, 0.48) * max(0.0, 1.0 + patch_mod_gain + 0.0) * patch_param_0); + +voice_2_age = age; +voice_2_freq = ((max(20, 588 * pow(2.0, 0 * voice_2_age + 0.5 * 0 * voice_2_age * voice_2_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_2_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 588 * pow(2.0, 0 * voice_2_age + 0.5 * 0 * voice_2_age * voice_2_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_2_colored = (voice_2_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_2_driven = ma.tanh(voice_2_colored * (1.0 + clip01(0.03 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.03 + patch_mod_drive + 0.0) * 12.0); +voice_2_folded = voice_2_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_2_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_2_filtered = voice_2_folded : fi.lowpass(1, max(20.0, clip01(0.96 * (1.0 + 0 * voice_2_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.015 * (1.0 + 0 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.015 * (1.0 + 0 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_2_phased = voice_2_filtered; +voice_2_formants = voice_2_phased; +voice_2 = ((voice_2_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_2_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_2_age, 0.002, 0, 1, 0.32, 0.48) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.12); + +voice_3_age = age; +voice_3_freq = ((max(20, 784 * pow(2.0, 0 * voice_3_age + 0.5 * 0 * voice_3_age * voice_3_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_3_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 784 * pow(2.0, 0 * voice_3_age + 0.5 * 0 * voice_3_age * voice_3_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_3_colored = (voice_3_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_3_driven = ma.tanh(voice_3_colored * (1.0 + clip01(0.03 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.03 + patch_mod_drive + 0.0) * 12.0); +voice_3_folded = voice_3_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_3_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_3_filtered = voice_3_folded : fi.lowpass(1, max(20.0, clip01(0.96 * (1.0 + 0 * voice_3_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.015 * (1.0 + 0 * voice_3_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.015 * (1.0 + 0 * voice_3_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_3_phased = voice_3_filtered; +voice_3_formants = voice_3_phased; +voice_3 = ((voice_3_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_3_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_3_age, 0.002, 0, 1, 0.32, 0.48) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.08); + +voice_4_age = age; +voice_4_freq = ((max(20, 980 * pow(2.0, 0 * voice_4_age + 0.5 * 0 * voice_4_age * voice_4_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_4_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 980 * pow(2.0, 0 * voice_4_age + 0.5 * 0 * voice_4_age * voice_4_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_4_colored = (voice_4_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_4_driven = ma.tanh(voice_4_colored * (1.0 + clip01(0.03 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.03 + patch_mod_drive + 0.0) * 12.0); +voice_4_folded = voice_4_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_4_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_4_filtered = voice_4_folded : fi.lowpass(1, max(20.0, clip01(0.96 * (1.0 + 0 * voice_4_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.015 * (1.0 + 0 * voice_4_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.015 * (1.0 + 0 * voice_4_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_4_phased = voice_4_filtered; +voice_4_formants = voice_4_phased; +voice_4 = ((voice_4_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_4_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_4_age, 0.002, 0, 1, 0.32, 0.48) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.055); + +voice_5_age = age; +voice_5_freq = ((max(20, 1176 * pow(2.0, 0 * voice_5_age + 0.5 * 0 * voice_5_age * voice_5_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_5_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 1176 * pow(2.0, 0 * voice_5_age + 0.5 * 0 * voice_5_age * voice_5_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 1176 * pow(2.0, 0 * voice_5_age + 0.5 * 0 * voice_5_age * voice_5_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 1))) * (max(0.0, 0.18 + patch_mod_fm_index + 0.0) * exp(-voice_5_age / max(0.24, 0.0001))) / ma.PI)); +voice_5_colored = (voice_5_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_5_driven = ma.tanh(voice_5_colored * (1.0 + clip01(0.03 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.03 + patch_mod_drive + 0.0) * 12.0); +voice_5_folded = voice_5_driven * (1.0 - clip01(patch_param_1 + patch_mod_fold + 0.0)) + fold(voice_5_driven * (1.0 + clip01(patch_param_1 + patch_mod_fold + 0.0) * 3.5)) * clip01(patch_param_1 + patch_mod_fold + 0.0); +voice_5_filtered = voice_5_folded : fi.lowpass(1, max(20.0, clip01(0.96 * (1.0 + 0 * voice_5_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.015 * (1.0 + 0 * voice_5_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.015 * (1.0 + 0 * voice_5_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_5_phased = voice_5_filtered; +voice_5_formants = voice_5_phased; +voice_5 = ((voice_5_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_5_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_5_age, 0.002, 0, 1, 0.32, 0.48) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.035); + +process = softclip((voice_0 + voice_1 + voice_2 + voice_3 + voice_4 + voice_5) * 0.58); diff --git a/tools/aqua-playground/lowered/dx7-algorithm-8-bright-pair.dsp b/tools/aqua-playground/lowered/dx7-algorithm-8-bright-pair.dsp new file mode 100644 index 0000000..12295f4 --- /dev/null +++ b/tools/aqua-playground/lowered/dx7-algorithm-8-bright-pair.dsp @@ -0,0 +1,77 @@ +import("stdfaust.lib"); +declare name "dx7-algorithm-8-bright-pair"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_param_0 = hslider("/macro/brightness", 2.6, 0, 5, 0.001) : si.smoo; +patch_param_1 = hslider("/macro/strike", 0.18, 0.02, 0.6, 0.001) : si.smoo; + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 330 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 330 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 330 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 2))) * (max(0.0, patch_param_0 + patch_mod_fm_index + 0.0) * exp(-voice_0_age / max(0.22, 0.0001))) / ma.PI)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.9 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.02 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.02 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0.001, 0, 1, patch_param_1, 0.045) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.04); + +voice_1_age = age; +voice_1_freq = ((max(20, 660 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 660 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0.05 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0.05 + patch_mod_fold + 0.0) * 3.5)) * clip01(0.05 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.9 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.02 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.02 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0.001, 0, 1, patch_param_1, 0.045) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.025); + +opgraph_0_freq = 330; +opgraph_0_op_6 = sin(2.0 * ma.PI * (os.phasor(1.0, opgraph_0_freq * max(0.0, 4)) + (0.0) / ma.PI)) * oneshot_adsr_at(age, 0.035, 0.18, 0, 0, 0.215) * 0.9; +opgraph_0_op_4 = ((_ * 0.18 + (0.0)) : \(pm).(sin(2.0 * ma.PI * (os.phasor(1.0, opgraph_0_freq * max(0.0, 2)) + pm / ma.PI)) * oneshot_adsr_at(age, 0.05, 0.24, 0, 0, 0.29) * 0.7)) ~ _; +opgraph_0_op_2 = sin(2.0 * ma.PI * (os.phasor(1.0, opgraph_0_freq * max(0.0, 1)) + (0.0) / ma.PI)) * oneshot_adsr_at(age, 0.045, 0.2, 0, 0, 0.245) * 0.75; +opgraph_0_op_5 = sin(2.0 * ma.PI * (os.phasor(1.0, opgraph_0_freq * max(0.0, 3)) + (opgraph_0_op_6 * 1.1) / ma.PI)) * oneshot_adsr_at(age, 0.04, 0.2, 0, 0, 0.24) * 0.82; +opgraph_0_op_1 = sin(2.0 * ma.PI * (os.phasor(1.0, opgraph_0_freq * max(0.0, 1)) + (opgraph_0_op_2 * 0.85) / ma.PI)) * oneshot_adsr_at(age, 0.005, 0.08, 0.68, 0.34, 0.1) * 0.82; +opgraph_0_op_3 = sin(2.0 * ma.PI * (os.phasor(1.0, opgraph_0_freq * max(0.0, 2)) + (opgraph_0_op_5 * 0.9 + opgraph_0_op_4 * 0.75) / ma.PI)) * oneshot_adsr_at(age, 0.06, 0.3, 0, 0, 0.36) * 0.6; +opgraph_0 = (opgraph_0_op_1 + opgraph_0_op_3) * 0.18; + +process = softclip((voice_0 + voice_1 + opgraph_0) * 0.52); diff --git a/tools/aqua-playground/lowered/dx7-public-domain-mc-mm-5-3.dsp b/tools/aqua-playground/lowered/dx7-public-domain-mc-mm-5-3.dsp new file mode 100644 index 0000000..efd7671 --- /dev/null +++ b/tools/aqua-playground/lowered/dx7-public-domain-mc-mm-5-3.dsp @@ -0,0 +1,54 @@ +import("stdfaust.lib"); +declare name "dx7-public-domain-mc-mm-5-3"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 654.0639 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 654.0639 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0.004, 0.008, 1, 0.004, 0.08) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 1); + +process = softclip((voice_0) * 0.82); diff --git a/tools/aqua-playground/lowered/dx7-public-domain-prc-synth1-calibrated.dsp b/tools/aqua-playground/lowered/dx7-public-domain-prc-synth1-calibrated.dsp new file mode 100644 index 0000000..f53571d --- /dev/null +++ b/tools/aqua-playground/lowered/dx7-public-domain-prc-synth1-calibrated.dsp @@ -0,0 +1,52 @@ +import("stdfaust.lib"); +declare name "dx7-public-domain-prc-synth1-calibrated"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +opgraph_0_freq = 261.6256; +opgraph_0_op_6 = sin(2.0 * ma.PI * (os.phasor(1.0, opgraph_0_freq * max(0.0, 7.983435)) + (0.0) / ma.PI)) * rl4_env_at(age, 0.001451, 0.413879, 0, 0.296962, 0.399165, 1, 0.424308, 0.370614, 1, 0.549977, 0, 1, 0.85) * 0.125; +opgraph_0_op_4 = ((_ * 0.19 + (0.0)) : \(pm).(sin(2.0 * ma.PI * (os.phasor(1.0, opgraph_0_freq * max(0.0, 0.501384)) + pm / ma.PI)) * rl4_env_at(age, 0.001451, 0.413879, 0, 0.296962, 0.353601, 1, 0.424308, 0.276106, 1, 0.549977, 0, 1, 0.85) * 0.917004)) ~ _; +opgraph_0_op_2 = sin(2.0 * ma.PI * (os.phasor(1.0, opgraph_0_freq * max(0.0, 0.501384)) + (0.0) / ma.PI)) * rl4_env_at(age, 0.011383, 0.981531, 0, 0.293515, 0.842813, 1, 0.41932, 0.660018, 1, 0.549977, 0, 1, 0.85) * 0.545254; +opgraph_0_op_5 = sin(2.0 * ma.PI * (os.phasor(1.0, opgraph_0_freq * max(0.0, 1)) + (opgraph_0_op_6 * 6) / ma.PI)) * rl4_env_at(age, 0.001451, 0.413879, 0, 0.296962, 0.241589, 1, 0.424308, 0.109464, 1, 0.549977, 0, 1, 0.85) * 0.32421; +opgraph_0_op_1 = sin(2.0 * ma.PI * (os.phasor(1.0, opgraph_0_freq * max(0.0, 0.500346)) + (opgraph_0_op_2 * 6.275) / ma.PI)) * rl4_env_at(age, 0.001451, 0.984375, 0, 0.296962, 1, 1, 0.424308, 1, 1, 0.549977, 0, 1, 0.85) * 3; +opgraph_0_op_3 = sin(2.0 * ma.PI * (os.phasor(1.0, opgraph_0_freq * max(0.0, 0.499655)) + (opgraph_0_op_4 * 6 + opgraph_0_op_5 * 6) / ma.PI)) * rl4_env_at(age, 0.001451, 0.984375, 0, 0.296962, 1, 1, 0.424308, 1, 1, 0.549977, 0, 1, 0.85) * 3; +opgraph_0 = (opgraph_0_op_1 + opgraph_0_op_3) * 0.25; + +process = (opgraph_0) * 1.4; diff --git a/tools/aqua-playground/lowered/examples-language-tour.dsp b/tools/aqua-playground/lowered/examples-language-tour.dsp new file mode 100644 index 0000000..afced2b --- /dev/null +++ b/tools/aqua-playground/lowered/examples-language-tour.dsp @@ -0,0 +1,76 @@ +import("stdfaust.lib"); +declare name "examples-language-tour"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time - floor(time / 0.4739614) * 0.4739614; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0 + 0.08 * lfo_tri(2, 0); +patch_mod_pitch = 0 + 0.01 * lfo_sin(5, 0); +patch_mod_duty = 0.0; +patch_mod_lpf = 0 + -0.04 * lfo_tri(2, 0); +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0 + 0.08 * lfo_sin(5, 0) + 0 + 0.12 * lfo_tri(2, 0); +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 220 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age))) * (1.0 + select2(voice_0_age < 0, 0.0, sin(2.0 * ma.PI * (voice_0_age - 0) * 5) * 0.02))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 220 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age))) * (1.0 + select2(voice_0_age < 0, 0.0, sin(2.0 * ma.PI * (voice_0_age - 0) * 5) * 0.02))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = ((voice_0_phased : fi.resonbp(620, 6.888889, 1.0)) * 1 + (voice_0_phased : fi.resonbp(1040, 6.933333, 1.0)) * 0.8) / 1.8; +voice_0 = ((voice_0_phased * (1.0 - clip01(0.45 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0.45 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0.002, 0, 1, 0.2, 0.03) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.12); + +voice_1_age = age; +voice_1_freq = ((max(20, 440 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = 1.0 - 4.0 * abs(wrap01(os.phasor(1.0, ((max(20, 440 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0) - 0.5); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.7 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.02 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.02 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0, 0, 1, 0.18, 0.02) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.04); + +voice_2_age = age; +voice_2_freq = ((max(20, 230.3403 * pow(2.0, 0.7460228 * voice_2_age + 0.5 * 0.00000008 * voice_2_age * voice_2_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_2_osc = 2.0 * wrap01(os.phasor(1.0, ((max(20, 230.3403 * pow(2.0, 0.7460228 * voice_2_age + 0.5 * 0.00000008 * voice_2_age * voice_2_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0) - 1.0; +voice_2_colored = (voice_2_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_2_driven = ma.tanh(voice_2_colored * (1.0 + clip01(0.1212819 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.1212819 + patch_mod_drive + 0.0) * 12.0); +voice_2_folded = voice_2_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_2_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_2_filtered = voice_2_folded : fi.resonlp(max(20.0, clip01(1 * (1.0 + -0.00208181 * voice_2_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0), 0.7 + clip01(0.00000026) * 18.0, 1.0) : fi.highpass(1, max(5.0, (clip01(0.0479493 * (1.0 + -0.0020957 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.0479493 * (1.0 + -0.0020957 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_2_phased = voice_2_filtered + (voice_2_filtered : de.fdelay(2048, min(2047.0, max(0.0, abs(0.0001425 + -0.0005662 * voice_2_age) * ma.SR)))); +voice_2_formants = voice_2_phased; +voice_2 = ((voice_2_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_2_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_2_age, 0.00014083, 0, 0.9929289, 0.07120296, 0.07388992) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.2215667); + +process = softclip((voice_0 + voice_1 + voice_2) * 0.7); diff --git a/tools/aqua-playground/lowered/fm-bell-bell.dsp b/tools/aqua-playground/lowered/fm-bell-bell.dsp new file mode 100644 index 0000000..5642d9c --- /dev/null +++ b/tools/aqua-playground/lowered/fm-bell-bell.dsp @@ -0,0 +1,65 @@ +import("stdfaust.lib"); +declare name "fm-bell-bell"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 440 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 440 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 440 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 4.1))) * (max(0.0, 5.8 + patch_mod_fm_index + 0.0) * exp(-voice_0_age / max(0.55, 0.0001))) / ma.PI)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.9 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0.002, 0, 1, 1.2, 0.04) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.24); + +voice_1_age = age; +voice_1_freq = ((max(20, 880 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 880 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 880 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 4.1))) * (max(0.0, 2.4 + patch_mod_fm_index + 0.0) * exp(-voice_1_age / max(0.55, 0.0001))) / ma.PI)); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.9 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0.002, 0, 1, 1.2, 0.04) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.08); + +process = softclip((voice_0 + voice_1) * 1); diff --git a/tools/aqua-playground/lowered/fm-bell-chime.dsp b/tools/aqua-playground/lowered/fm-bell-chime.dsp new file mode 100644 index 0000000..2712175 --- /dev/null +++ b/tools/aqua-playground/lowered/fm-bell-chime.dsp @@ -0,0 +1,65 @@ +import("stdfaust.lib"); +declare name "fm-bell-chime"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 660 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 660 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 660 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 3))) * (max(0.0, 4.2 + patch_mod_fm_index + 0.0) * exp(-voice_0_age / max(0.38, 0.0001))) / ma.PI)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.02 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.02 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0.001, 0, 1, 0.9, 0.025) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.18); + +voice_1_age = age; +voice_1_freq = ((max(20, 990 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 990 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 990 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 3))) * (max(0.0, 2.1 + patch_mod_fm_index + 0.0) * exp(-voice_1_age / max(0.38, 0.0001))) / ma.PI)); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.02 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.02 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0.001, 0, 1, 0.9, 0.025) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.07); + +process = softclip((voice_0 + voice_1) * 1); diff --git a/tools/aqua-playground/lowered/fm-bell-coin.dsp b/tools/aqua-playground/lowered/fm-bell-coin.dsp new file mode 100644 index 0000000..94bf997 --- /dev/null +++ b/tools/aqua-playground/lowered/fm-bell-coin.dsp @@ -0,0 +1,65 @@ +import("stdfaust.lib"); +declare name "fm-bell-coin"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 1200 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 1200 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 1200 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 5))) * (max(0.0, 3.4 + patch_mod_fm_index + 0.0) * exp(-voice_0_age / max(0.18, 0.0001))) / ma.PI)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.04 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.04 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.45, 0.02) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.18); + +voice_1_age = age; +voice_1_freq = ((max(20, 1800 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 1800 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 1800 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 7))) * (max(0.0, 1.8 + patch_mod_fm_index + 0.0) * exp(-voice_1_age / max(0.12, 0.0001))) / ma.PI)); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.08 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.04 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.04 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0, 0, 1, 0.45, 0.02) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.09); + +process = softclip((voice_0 + voice_1) * 1); diff --git a/tools/aqua-playground/lowered/fm-bell-gong.dsp b/tools/aqua-playground/lowered/fm-bell-gong.dsp new file mode 100644 index 0000000..c082a83 --- /dev/null +++ b/tools/aqua-playground/lowered/fm-bell-gong.dsp @@ -0,0 +1,65 @@ +import("stdfaust.lib"); +declare name "fm-bell-gong"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 196 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 196 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 196 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 2.414))) * (max(0.0, 7.2 + patch_mod_fm_index + 0.0) * exp(-voice_0_age / max(0.9, 0.0001))) / ma.PI)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.82 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0.003, 0, 1, 1.6, 0.08) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.24); + +voice_1_age = age; +voice_1_freq = ((max(20, 311 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 311 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 311 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 3.73))) * (max(0.0, 4.1 + patch_mod_fm_index + 0.0) * exp(-voice_1_age / max(0.7, 0.0001))) / ma.PI)); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.1 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.82 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0.003, 0, 1, 1.6, 0.08) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.12); + +process = softclip((voice_0 + voice_1) * 1); diff --git a/tools/aqua-playground/lowered/sfxr-blip.dsp b/tools/aqua-playground/lowered/sfxr-blip.dsp new file mode 100644 index 0000000..aa1b3b7 --- /dev/null +++ b/tools/aqua-playground/lowered/sfxr-blip.dsp @@ -0,0 +1,54 @@ +import("stdfaust.lib"); +declare name "sfxr-blip"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 78.2334 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 78.2334 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.1 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.1 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.01451247, 0.03832199) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.22); + +process = softclip((voice_0) * 1); diff --git a/tools/aqua-playground/lowered/sfxr-classic-classic-sfxr-abstract-golf.dsp b/tools/aqua-playground/lowered/sfxr-classic-classic-sfxr-abstract-golf.dsp new file mode 100644 index 0000000..5677485 --- /dev/null +++ b/tools/aqua-playground/lowered/sfxr-classic-classic-sfxr-abstract-golf.dsp @@ -0,0 +1,120 @@ +import("stdfaust.lib"); +declare name "sfxr-classic-classic-sfxr-abstract-golf"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time - floor(time / 0.11315) * 0.11315; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 148.7934 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * select2(voice_0_age < 0.081844, 1.116121, 1.0) * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = select2(wrap01(os.phasor(1.0, ((max(20, 148.7934 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * select2(voice_0_age < 0.081844, 1.116121, 1.0) * pow(2.0, patch_mod_pitch + 0.0)) + 0) < clip01(0.5 + 0 * voice_0_age + patch_mod_duty + 0.0), -0.5, 0.5); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.201 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.201 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 0.6896552, 0.1306122, 0.01451247) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.319); + +voice_1_age = age; +voice_1_freq = ((max(20, 229.0554 * pow(2.0, 0.703836 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = 2.0 * wrap01(os.phasor(1.0, ((max(20, 229.0554 * pow(2.0, 0.703836 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0) - 1.0; +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.04 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.04 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered + (voice_1_filtered : de.fdelay(2048, min(2047.0, max(0.0, abs(0.0001458 + -0.000504 * voice_1_age) * ma.SR)))); +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0, 0, 1, 0.07346939, 0.08185941) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.22); + +voice_2_age = age; +voice_2_freq = ((max(20, 20 * pow(2.0, 0.0320625 * voice_2_age + 0.5 * 0 * voice_2_age * voice_2_age))) * (1.0 + select2(voice_2_age < 0, 0.0, sin(2.0 * ma.PI * (voice_2_age - 0) * 3.4112) * 0.11))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_2_osc = no.noise; +voice_2_colored = (voice_2_osc * (1.0 - clip01(0.35 + patch_mod_noise + 0.0)) + no.noise * clip01(0.35 + patch_mod_noise + 0.0)); +voice_2_driven = ma.tanh(voice_2_colored * (1.0 + clip01(0.2136 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.2136 + patch_mod_drive + 0.0) * 12.0); +voice_2_folded = voice_2_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_2_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_2_filtered = voice_2_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_2_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_2_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_2_phased = voice_2_filtered + (voice_2_filtered : de.fdelay(2048, min(2047.0, max(0.0, abs(-0.0008712 + -0.00035 * voice_2_age) * ma.SR)))); +voice_2_formants = voice_2_phased; +voice_2 = ((voice_2_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_2_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_2_age, 0, 0, 0.6578947, 0.2938775, 0.1907029) * (1.0 - 0.0264 * (0.5 + 0.5 * lfo_sin(13.04, 0.0))) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.3344); + +voice_3_age = age; +voice_3_freq = ((max(20, 57.5946 * pow(2.0, -0.208544 * voice_3_age + 0.5 * 0 * voice_3_age * voice_3_age))) * (1.0 + select2(voice_3_age < 0, 0.0, sin(2.0 * ma.PI * (voice_3_age - 0) * 3.9602) * 0.09))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_3_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 57.5946 * pow(2.0, -0.208544 * voice_3_age + 0.5 * 0 * voice_3_age * voice_3_age))) * (1.0 + select2(voice_3_age < 0, 0.0, sin(2.0 * ma.PI * (voice_3_age - 0) * 3.9602) * 0.09))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_3_colored = (voice_3_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_3_driven = ma.tanh(voice_3_colored * (1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0); +voice_3_folded = voice_3_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_3_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_3_filtered = voice_3_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_3_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_3_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_3_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_3_phased = voice_3_filtered; +voice_3_formants = voice_3_phased; +voice_3 = ((voice_3_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_3_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_3_age, 0, 0, 1, 0.1777778, 0.1306122) * (1.0 - 0.0216 * (0.5 + 0.5 * lfo_sin(13.94, 0.0))) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.22); + +voice_4_age = age; +voice_4_freq = ((max(20, 51.4206 * pow(2.0, 1.050624 * voice_4_age + 0.5 * 0 * voice_4_age * voice_4_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_4_osc = no.noise; +voice_4_colored = (voice_4_osc * (1.0 - clip01(0.35 + patch_mod_noise + 0.0)) + no.noise * clip01(0.35 + patch_mod_noise + 0.0)); +voice_4_driven = ma.tanh(voice_4_colored * (1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0); +voice_4_folded = voice_4_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_4_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_4_filtered = voice_4_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_4_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.12 * (1.0 + 0 * voice_4_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.12 * (1.0 + 0 * voice_4_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_4_phased = voice_4_filtered; +voice_4_formants = voice_4_phased; +voice_4 = ((voice_4_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_4_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_4_age, 0, 0, 1, 0.09070295, 0.00566893) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.22); + +voice_5_age = age; +voice_5_freq = ((max(20, 78.2334 * pow(2.0, -0.101156 * voice_5_age + 0.5 * 0 * voice_5_age * voice_5_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_5_osc = select2(wrap01(os.phasor(1.0, ((max(20, 78.2334 * pow(2.0, -0.101156 * voice_5_age + 0.5 * 0 * voice_5_age * voice_5_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0) < clip01(0.38 + 0 * voice_5_age + patch_mod_duty + 0.0), -0.5, 0.5); +voice_5_colored = (voice_5_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_5_driven = ma.tanh(voice_5_colored * (1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0); +voice_5_folded = voice_5_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_5_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_5_filtered = voice_5_folded : fi.lowpass(1, max(20.0, clip01(0.72 * (1.0 + 0 * voice_5_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.05 * (1.0 + 0 * voice_5_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.05 * (1.0 + 0 * voice_5_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_5_phased = voice_5_filtered; +voice_5_formants = voice_5_phased; +voice_5 = ((voice_5_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_5_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_5_age, 0, 0, 1, 0.07346939, 0.1097506) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.22); + +voice_6_age = age; +voice_6_freq = ((max(20, 78.2334 * pow(2.0, 0 * voice_6_age + 0.5 * 0 * voice_6_age * voice_6_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_6_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 78.2334 * pow(2.0, 0 * voice_6_age + 0.5 * 0 * voice_6_age * voice_6_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_6_colored = (voice_6_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_6_driven = ma.tanh(voice_6_colored * (1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0); +voice_6_folded = voice_6_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_6_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_6_filtered = voice_6_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_6_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.1 * (1.0 + 0 * voice_6_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.1 * (1.0 + 0 * voice_6_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_6_phased = voice_6_filtered; +voice_6_formants = voice_6_phased; +voice_6 = ((voice_6_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_6_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_6_age, 0, 0, 1, 0.01451247, 0.03832199) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.22); + +process = softclip((voice_0 + voice_1 + voice_2 + voice_3 + voice_4 + voice_5 + voice_6) * 1); diff --git a/tools/aqua-playground/lowered/sfxr-explosion.dsp b/tools/aqua-playground/lowered/sfxr-explosion.dsp new file mode 100644 index 0000000..3df35ab --- /dev/null +++ b/tools/aqua-playground/lowered/sfxr-explosion.dsp @@ -0,0 +1,54 @@ +import("stdfaust.lib"); +declare name "sfxr-explosion"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time - floor(time / 0.174744) * 0.174744; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 20 * pow(2.0, 0.0320625 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age))) * (1.0 + select2(voice_0_age < 0, 0.0, sin(2.0 * ma.PI * (voice_0_age - 0) * 3.4112) * 0.11))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = no.noise; +voice_0_colored = (voice_0_osc * (1.0 - clip01(0.35 + patch_mod_noise + 0.0)) + no.noise * clip01(0.35 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.2136 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.2136 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered + (voice_0_filtered : de.fdelay(2048, min(2047.0, max(0.0, abs(-0.0008712 + -0.00035 * voice_0_age) * ma.SR)))); +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 0.6578947, 0.2938775, 0.1907029) * (1.0 - 0.0264 * (0.5 + 0.5 * lfo_sin(13.04, 0.0))) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.3344); + +process = softclip((voice_0) * 1); diff --git a/tools/aqua-playground/lowered/sfxr-hit.dsp b/tools/aqua-playground/lowered/sfxr-hit.dsp new file mode 100644 index 0000000..9e8a840 --- /dev/null +++ b/tools/aqua-playground/lowered/sfxr-hit.dsp @@ -0,0 +1,54 @@ +import("stdfaust.lib"); +declare name "sfxr-hit"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 51.4206 * pow(2.0, 1.050624 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = no.noise; +voice_0_colored = (voice_0_osc * (1.0 - clip01(0.35 + patch_mod_noise + 0.0)) + no.noise * clip01(0.35 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.12 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.12 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.09070295, 0.00566893) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.22); + +process = softclip((voice_0) * 1); diff --git a/tools/aqua-playground/lowered/sfxr-jump.dsp b/tools/aqua-playground/lowered/sfxr-jump.dsp new file mode 100644 index 0000000..7cfbefc --- /dev/null +++ b/tools/aqua-playground/lowered/sfxr-jump.dsp @@ -0,0 +1,54 @@ +import("stdfaust.lib"); +declare name "sfxr-jump"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 78.2334 * pow(2.0, -0.101156 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = select2(wrap01(os.phasor(1.0, ((max(20, 78.2334 * pow(2.0, -0.101156 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0) < clip01(0.38 + 0 * voice_0_age + patch_mod_duty + 0.0), -0.5, 0.5); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.72 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.05 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.05 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.07346939, 0.1097506) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.22); + +process = softclip((voice_0) * 1); diff --git a/tools/aqua-playground/lowered/sfxr-laser.dsp b/tools/aqua-playground/lowered/sfxr-laser.dsp new file mode 100644 index 0000000..4bcb2b0 --- /dev/null +++ b/tools/aqua-playground/lowered/sfxr-laser.dsp @@ -0,0 +1,54 @@ +import("stdfaust.lib"); +declare name "sfxr-laser"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 229.0554 * pow(2.0, 0.703836 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = 2.0 * wrap01(os.phasor(1.0, ((max(20, 229.0554 * pow(2.0, 0.703836 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0) - 1.0; +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.04 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.04 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered + (voice_0_filtered : de.fdelay(2048, min(2047.0, max(0.0, abs(0.0001458 + -0.000504 * voice_0_age) * ma.SR)))); +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.07346939, 0.08185941) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.22); + +process = softclip((voice_0) * 1); diff --git a/tools/aqua-playground/lowered/sfxr-pickup.dsp b/tools/aqua-playground/lowered/sfxr-pickup.dsp new file mode 100644 index 0000000..c2e1915 --- /dev/null +++ b/tools/aqua-playground/lowered/sfxr-pickup.dsp @@ -0,0 +1,54 @@ +import("stdfaust.lib"); +declare name "sfxr-pickup"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 148.7934 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * select2(voice_0_age < 0.081844, 1.116121, 1.0) * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = select2(wrap01(os.phasor(1.0, ((max(20, 148.7934 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * select2(voice_0_age < 0.081844, 1.116121, 1.0) * pow(2.0, patch_mod_pitch + 0.0)) + 0) < clip01(0.5 + 0 * voice_0_age + patch_mod_duty + 0.0), -0.5, 0.5); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.201 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.201 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 0.6896552, 0.1306122, 0.01451247) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.319); + +process = softclip((voice_0) * 1); diff --git a/tools/aqua-playground/lowered/sfxr-powerup.dsp b/tools/aqua-playground/lowered/sfxr-powerup.dsp new file mode 100644 index 0000000..cf8bf37 --- /dev/null +++ b/tools/aqua-playground/lowered/sfxr-powerup.dsp @@ -0,0 +1,54 @@ +import("stdfaust.lib"); +declare name "sfxr-powerup"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time - floor(time / 0.11315) * 0.11315; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0.0; +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0.0; +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 57.5946 * pow(2.0, -0.208544 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age))) * (1.0 + select2(voice_0_age < 0, 0.0, sin(2.0 * ma.PI * (voice_0_age - 0) * 3.9602) * 0.09))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = sin(2.0 * ma.PI * wrap01(os.phasor(1.0, ((max(20, 57.5946 * pow(2.0, -0.208544 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age))) * (1.0 + select2(voice_0_age < 0, 0.0, sin(2.0 * ma.PI * (voice_0_age - 0) * 3.9602) * 0.09))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0)); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.12 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(1 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.1777778, 0.1306122) * (1.0 - 0.0216 * (0.5 + 0.5 * lfo_sin(13.94, 0.0))) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.22); + +process = softclip((voice_0) * 1); diff --git a/tools/aqua-playground/lowered/thruster.dsp b/tools/aqua-playground/lowered/thruster.dsp new file mode 100644 index 0000000..9260b6a --- /dev/null +++ b/tools/aqua-playground/lowered/thruster.dsp @@ -0,0 +1,29 @@ +// thruster: sustained, heavy, brittle-hull thruster with an RPM control. +// Compile as Faust source (AquaSynthPatchCompiler.CompileSource); it is not a .aqua script. +// Control: rpm (300..6000). Rotor tone = 28 Hz + rpm*0.025 (about 36..180 Hz); three blades chop the rasp at 3x that. +declare name "thruster"; +import("stdfaust.lib"); + +rpm = hslider("rpm", 1200, 300, 6000, 1) : si.smooth(ba.tau2pole(0.2)); +load = (rpm - 300) / 5700; +shaft = 28 + rpm * 0.025; + +// effort: slow random wander of the shaft speed +wander = no.noise : fi.lowpass(2, 5) : *(0.35); +f0 = shaft * (1 + 0.04 * wander); + +// low rumble: saw at shaft speed plus a square a sub-octave down, low-passed +rumble = (os.sawtooth(f0) + 0.7 * os.square(f0 * 0.5)) : fi.lowpass(3, 60 + 2.5 * shaft); + +// blade pass: rasp noise chopped at 3x shaft, band tracks rpm +chop = 0.5 + 0.5 * os.osc(f0 * 3) ^ 2; +rasp = no.noise : fi.resonbp(700 + rpm * 0.6, 1.5, 1) : *(chop); + +// brittle hull: high-Q modes rattled by noise, louder with load; tanh on the rattle alone keeps ring-up spikes from setting the peak +mode(f, q) = no.noise : fi.resonbp(f, q, 1); +rattle = (mode(173, 20) * (0.3 + 0.7 * load) + 0.8 * mode(311, 18) + 0.6 * mode(467, 16) + 0.4 * mode(1130, 14)) * (0.1 + 0.9 * load ^ 2) * 3 : *(4) : ma.tanh : /(4); + +mix = rumble * (0.5 + 0.5 * load) + rasp * (0.3 + 1.5 * load) + rattle; +// drive falls only gently with load so tanh stays out of saturation while high rpm still ends up louder than low rpm +// final 0.425 trim keeps peak under 0.4 at rpm 4800 +process = mix * (0.4 + 0.6 * load) * (0.9 - 0.5 * load) : ma.tanh : *(0.425); diff --git a/tools/aqua-playground/lowered/wobble-bass-growl.dsp b/tools/aqua-playground/lowered/wobble-bass-growl.dsp new file mode 100644 index 0000000..914ab66 --- /dev/null +++ b/tools/aqua-playground/lowered/wobble-bass-growl.dsp @@ -0,0 +1,65 @@ +import("stdfaust.lib"); +declare name "wobble-bass-growl"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0 + 0.32 * lfo_sin(6, 0); +patch_mod_pitch = 0 + 0.035 * lfo_sin(6, 0); +patch_mod_duty = 0.0; +patch_mod_lpf = 0 + 0.55 * lfo_sin(6, 0); +patch_mod_hpf = 0.0; +patch_mod_noise = 0 + 0.08 * lfo_sin(6, 0); +patch_mod_drive = 0 + 0.28 * lfo_sin(6, 0); +patch_mod_fold = 0 + 0.22 * lfo_sin(6, 0); +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0 + 2.2 * lfo_sin(6, 0); + +voice_0_age = age; +voice_0_freq = ((max(20, 44 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = 2.0 * wrap01(os.phasor(1.0, ((max(20, 44 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 44 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 1.5))) * (max(0.0, 1.2 + patch_mod_fm_index + 0.0) * exp(-voice_0_age / max(0.45, 0.0001))) / ma.PI) - 1.0; +voice_0_colored = (voice_0_osc * (1.0 - clip01(0.05 + patch_mod_noise + 0.0)) + no.noise * clip01(0.05 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.42 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.42 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0.18 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0.18 + patch_mod_fold + 0.0) * 3.5)) * clip01(0.18 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.28 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.01 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.01 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.3, 0.7) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.2); + +voice_1_age = age; +voice_1_freq = ((max(20, 88 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = select2(wrap01(os.phasor(1.0, ((max(20, 88 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 88 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 1.5))) * (max(0.0, 1.2 + patch_mod_fm_index + 0.0) * exp(-voice_1_age / max(0.45, 0.0001))) / ma.PI) < clip01(0.36 + 0 * voice_1_age + patch_mod_duty + 0.0), -0.5, 0.5); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0.05 + patch_mod_noise + 0.0)) + no.noise * clip01(0.05 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.42 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.42 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0.18 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0.18 + patch_mod_fold + 0.0) * 3.5)) * clip01(0.18 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.28 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.01 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.01 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0, 0, 1, 0.3, 0.7) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.09); + +process = softclip((voice_0 + voice_1) * 1); diff --git a/tools/aqua-playground/lowered/wobble-bass-neuro.dsp b/tools/aqua-playground/lowered/wobble-bass-neuro.dsp new file mode 100644 index 0000000..805ec9a --- /dev/null +++ b/tools/aqua-playground/lowered/wobble-bass-neuro.dsp @@ -0,0 +1,65 @@ +import("stdfaust.lib"); +declare name "wobble-bass-neuro"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0 + 0.28 * lfo_hold(7, 0); +patch_mod_pitch = 0 + 0.04 * lfo_hold(7, 0); +patch_mod_duty = 0.0; +patch_mod_lpf = 0 + 0.52 * lfo_hold(7, 0); +patch_mod_hpf = 0.0; +patch_mod_noise = 0 + 0.1 * lfo_hold(7, 0); +patch_mod_drive = 0 + 0.25 * lfo_hold(7, 0); +patch_mod_fold = 0 + 0.3 * lfo_hold(7, 0); +patch_mod_formant_mix = 0.0; +patch_mod_fm_index = 0 + 2.8 * lfo_hold(7, 0); + +voice_0_age = age; +voice_0_freq = ((max(20, 49 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = 2.0 * wrap01(os.phasor(1.0, ((max(20, 49 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 49 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 2.7))) * (max(0.0, 1.5 + patch_mod_fm_index + 0.0) * exp(-voice_0_age / max(0.35, 0.0001))) / ma.PI) - 1.0; +voice_0_colored = (voice_0_osc * (1.0 - clip01(0.04 + patch_mod_noise + 0.0)) + no.noise * clip01(0.04 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.38 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.38 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0.24 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0.24 + patch_mod_fold + 0.0) * 3.5)) * clip01(0.24 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.25 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.04 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.04 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = voice_0_phased; +voice_0 = ((voice_0_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.28, 0.75) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.16); + +voice_1_age = age; +voice_1_freq = ((max(20, 147 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = 1.0 - 4.0 * abs(wrap01(os.phasor(1.0, ((max(20, 147 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 147 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 2.7))) * (max(0.0, 1.5 + patch_mod_fm_index + 0.0) * exp(-voice_1_age / max(0.35, 0.0001))) / ma.PI) - 0.5); +voice_1_colored = (voice_1_osc * (1.0 - clip01(0.04 + patch_mod_noise + 0.0)) + no.noise * clip01(0.04 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.38 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.38 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0.24 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0.24 + patch_mod_fold + 0.0) * 3.5)) * clip01(0.24 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.25 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.04 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.04 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = voice_1_phased; +voice_1 = ((voice_1_phased * (1.0 - clip01(0 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0, 0, 1, 0.28, 0.75) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.06); + +process = softclip((voice_0 + voice_1) * 1); diff --git a/tools/aqua-playground/lowered/wobble-bass-talker.dsp b/tools/aqua-playground/lowered/wobble-bass-talker.dsp new file mode 100644 index 0000000..116e187 --- /dev/null +++ b/tools/aqua-playground/lowered/wobble-bass-talker.dsp @@ -0,0 +1,65 @@ +import("stdfaust.lib"); +declare name "wobble-bass-talker"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0 + 0.42 * lfo_tri(4, 0); +patch_mod_pitch = 0.0; +patch_mod_duty = 0.0; +patch_mod_lpf = 0 + 0.48 * lfo_tri(4, 0); +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0 + 0.2 * lfo_tri(4, 0); +patch_mod_fold = 0 + 0.14 * lfo_tri(4, 0); +patch_mod_formant_mix = 0 + 0.38 * lfo_tri(4, 0); +patch_mod_fm_index = 0 + 1.6 * lfo_tri(4, 0); + +voice_0_age = age; +voice_0_freq = ((max(20, 55 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = 2.0 * wrap01(os.phasor(1.0, ((max(20, 55 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 55 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 2))) * (max(0.0, 0.8 + patch_mod_fm_index + 0.0) * exp(-voice_0_age / max(0.7, 0.0001))) / ma.PI) - 1.0; +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.3 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.3 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0.08 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0.08 + patch_mod_fold + 0.0) * 3.5)) * clip01(0.08 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.34 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.02 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.02 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = ((voice_0_phased : fi.resonbp(520, 5.777778, 1.0)) * 0.7 + (voice_0_phased : fi.resonbp(1250, 7.352941, 1.0)) * 1 + (voice_0_phased : fi.resonbp(2600, 8.125, 1.0)) * 0.45) / 2.15; +voice_0 = ((voice_0_phased * (1.0 - clip01(0.35 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0.35 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.25, 0.8) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.18); + +voice_1_age = age; +voice_1_freq = ((max(20, 110 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = 2.0 * wrap01(os.phasor(1.0, ((max(20, 110 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 110 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 2))) * (max(0.0, 0.8 + patch_mod_fm_index + 0.0) * exp(-voice_1_age / max(0.7, 0.0001))) / ma.PI) - 1.0; +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.3 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.3 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0.08 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0.08 + patch_mod_fold + 0.0) * 3.5)) * clip01(0.08 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.34 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.02 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.02 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = ((voice_1_phased : fi.resonbp(520, 5.777778, 1.0)) * 0.7 + (voice_1_phased : fi.resonbp(1250, 7.352941, 1.0)) * 1 + (voice_1_phased : fi.resonbp(2600, 8.125, 1.0)) * 0.45) / 2.15; +voice_1 = ((voice_1_phased * (1.0 - clip01(0.35 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0.35 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0, 0, 1, 0.25, 0.8) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.08); + +process = softclip((voice_0 + voice_1) * 1); diff --git a/tools/aqua-playground/lowered/wobble-bass-yoy.dsp b/tools/aqua-playground/lowered/wobble-bass-yoy.dsp new file mode 100644 index 0000000..fcaf023 --- /dev/null +++ b/tools/aqua-playground/lowered/wobble-bass-yoy.dsp @@ -0,0 +1,65 @@ +import("stdfaust.lib"); +declare name "wobble-bass-yoy"; +declare options "[nvoices:1]"; + +time = ba.time / ma.SR; +age = time; +clip01(x) = min(1.0, max(0.0, x)); +wrap01(x) = x - floor(x); +slew(rate,x) = x : *(1.0 - exp((0.0 - max(0.0001, rate)) / ma.SR)) : + ~ *(exp((0.0 - max(0.0001, rate)) / ma.SR)); +softclip(x) = ma.tanh(x * 1.35); +fold(x) = 2.0 * abs(2.0 * (x / 4.0 - floor(x / 4.0)) - 1.0) - 1.0; +release_start(a,d,g) = max(g, a + d); +oneshot_adsr_at(t,a,d,s,r,g) = select2(t < a, select2(t < a + d, select2(t < release_start(a,d,g), select2(t < release_start(a,d,g) + r, 0.0, s * (1.0 - (t - release_start(a,d,g)) / max(0.0001, r))), s), 1.0 - (1.0 - s) * ((t - a) / max(0.0001, d))), t / max(0.0001, a)); +oneshot_adsr(a,d,s,r,g) = oneshot_adsr_at(age,a,d,s,r,g); +seg(t,t0,d,a,b) = a + (b - a) * clip01((t - t0) / max(0.0001, d)); +bez(t,a,b,c,d) = (1.0 - t) * (1.0 - t) * (1.0 - t) * a + 3.0 * (1.0 - t) * (1.0 - t) * t * b + 3.0 * (1.0 - t) * t * t * c + t * t * t * d; +seg_bez(t,t0,d,a,b,c,e) = bez(clip01((t - t0) / max(0.0001, d)), a, b, c, e); +smooth01(x) = clip01(x) * clip01(x) * (3.0 - 2.0 * clip01(x)); +seg_smooth(t,t0,d,a,b) = a + (b - a) * smooth01((t - t0) / max(0.0001, d)); +seg_exp(t,t0,d,a,b) = exp(log(max(0.00001, a)) + (log(max(0.00001, b)) - log(max(0.00001, a))) * clip01((t - t0) / max(0.0001, d))); +seg_curve(c,t,t0,d,a,b) = select2(c < 0.5, seg_exp(t,t0,d,a,b), seg(t,t0,d,a,b)); +rl_release_start(r1,r2,r3,g) = max(g, r1 + r2 + r3); +rl4_env_from_at(t,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = select2(t < r1, select2(t < r1 + r2, select2(t < r1 + r2 + r3, select2(t < rl_release_start(r1,r2,r3,g), select2(t < rl_release_start(r1,r2,r3,g) + r4, l4, seg_curve(c4, t, rl_release_start(r1,r2,r3,g), r4, l3, l4)), l3), seg_curve(c3, t, r1 + r2, r3, l2, l3)), seg_curve(c2, t, r1, r2, l1, l2)), seg_curve(c1, t, 0, r1, s0, l1)); +rl4_env_at(t,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(t,0.0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env_from(s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_from_at(age,s0,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +rl4_env(r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g) = rl4_env_at(age,r1,l1,c1,r2,l2,c2,r3,l3,c3,r4,l4,c4,g); +lfo_sin(hz, phase) = sin(2.0 * ma.PI * (age * hz + phase)); +lfo_tri(hz, phase) = 1.0 - 4.0 * abs((age * hz + phase - floor(age * hz + phase)) - 0.5); +lfo_sq(hz, phase) = select2((age * hz + phase - floor(age * hz + phase)) < 0.5, -1.0, 1.0); +lfo_hold(hz, phase) = no.noise : ba.latch(os.oscrs(hz)); + +patch_mod_gain = 0 + 0.5 * lfo_sq(5, 0); +patch_mod_pitch = 0 + 0.025 * lfo_sq(5, 0); +patch_mod_duty = 0 + 0.08 * lfo_sq(5, 0); +patch_mod_lpf = 0 + 0.5 * lfo_sq(5, 0); +patch_mod_hpf = 0.0; +patch_mod_noise = 0.0; +patch_mod_drive = 0.0; +patch_mod_fold = 0.0; +patch_mod_formant_mix = 0 + 0.45 * lfo_sq(5, 0); +patch_mod_fm_index = 0.0; + +voice_0_age = age; +voice_0_freq = ((max(20, 62 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_0_osc = select2(wrap01(os.phasor(1.0, ((max(20, 62 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 62 * pow(2.0, 0 * voice_0_age + 0.5 * 0 * voice_0_age * voice_0_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 3))) * (max(0.0, 0.7 + patch_mod_fm_index + 0.0) * exp(-voice_0_age / max(0.5, 0.0001))) / ma.PI) < clip01(0.5 + 0 * voice_0_age + patch_mod_duty + 0.0), -0.5, 0.5); +voice_0_colored = (voice_0_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_0_driven = ma.tanh(voice_0_colored * (1.0 + clip01(0.25 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.25 + patch_mod_drive + 0.0) * 12.0); +voice_0_folded = voice_0_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_0_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_0_filtered = voice_0_folded : fi.lowpass(1, max(20.0, clip01(0.3 * (1.0 + 0 * voice_0_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.03 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.03 * (1.0 + 0 * voice_0_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_0_phased = voice_0_filtered; +voice_0_formants = ((voice_0_phased : fi.resonbp(400, 5, 1.0)) * 0.6 + (voice_0_phased : fi.resonbp(900, 7.5, 1.0)) * 1 + (voice_0_phased : fi.resonbp(2100, 8.076923, 1.0)) * 0.4) / 2; +voice_0 = ((voice_0_phased * (1.0 - clip01(0.28 + patch_mod_formant_mix + 0.0)) + voice_0_formants * clip01(0.28 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_0_age, 0, 0, 1, 0.22, 0.65) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.16); + +voice_1_age = age; +voice_1_freq = ((max(20, 124 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0); +voice_1_osc = 2.0 * wrap01(os.phasor(1.0, ((max(20, 124 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0)) + 0 + sin(2.0 * ma.PI * os.phasor(1.0, ((max(20, 124 * pow(2.0, 0 * voice_1_age + 0.5 * 0 * voice_1_age * voice_1_age)))) * 1.0 * pow(2.0, patch_mod_pitch + 0.0) * max(0.0, 3))) * (max(0.0, 0.7 + patch_mod_fm_index + 0.0) * exp(-voice_1_age / max(0.5, 0.0001))) / ma.PI) - 1.0; +voice_1_colored = (voice_1_osc * (1.0 - clip01(0 + patch_mod_noise + 0.0)) + no.noise * clip01(0 + patch_mod_noise + 0.0)); +voice_1_driven = ma.tanh(voice_1_colored * (1.0 + clip01(0.25 + patch_mod_drive + 0.0) * 12.0)) / ma.tanh(1.0 + clip01(0.25 + patch_mod_drive + 0.0) * 12.0); +voice_1_folded = voice_1_driven * (1.0 - clip01(0 + patch_mod_fold + 0.0)) + fold(voice_1_driven * (1.0 + clip01(0 + patch_mod_fold + 0.0) * 3.5)) * clip01(0 + patch_mod_fold + 0.0); +voice_1_filtered = voice_1_folded : fi.lowpass(1, max(20.0, clip01(0.3 * (1.0 + 0 * voice_1_age * 1.8) + patch_mod_lpf + 0.0) * 18000.0)) : fi.highpass(1, max(5.0, (clip01(0.03 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * (clip01(0.03 * (1.0 + 0 * voice_1_age * 2.0) + patch_mod_hpf + 0.0)) * 7000.0)); +voice_1_phased = voice_1_filtered; +voice_1_formants = ((voice_1_phased : fi.resonbp(400, 5, 1.0)) * 0.6 + (voice_1_phased : fi.resonbp(900, 7.5, 1.0)) * 1 + (voice_1_phased : fi.resonbp(2100, 8.076923, 1.0)) * 0.4) / 2; +voice_1 = ((voice_1_phased * (1.0 - clip01(0.28 + patch_mod_formant_mix + 0.0)) + voice_1_formants * clip01(0.28 + patch_mod_formant_mix + 0.0)) * oneshot_adsr_at(voice_1_age, 0, 0, 1, 0.22, 0.65) * max(0.0, 1.0 + patch_mod_gain + 0.0) * 0.07); + +process = softclip((voice_0 + voice_1) * 1); diff --git a/tools/aqua-playground/package-lock.json b/tools/aqua-playground/package-lock.json new file mode 100644 index 0000000..ae5be49 --- /dev/null +++ b/tools/aqua-playground/package-lock.json @@ -0,0 +1,35 @@ +{ + "name": "aqua-playground", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "aqua-playground", + "devDependencies": { + "@grame/faustwasm": "0.20.0" + } + }, + "node_modules/@grame/faustwasm": { + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@grame/faustwasm/-/faustwasm-0.20.0.tgz", + "integrity": "sha512-oxy1MgkGVMxmWdmpiP0OGFv9T0nUfYYINFMoYhErzCipdfkMYv35KgVg5OojHa9NgXD9leLlAB+IIzJZ0KoIQQ==", + "dev": true, + "license": "LGPL-2.1", + "dependencies": { + "@types/emscripten": "^1.39.10" + }, + "bin": { + "faust2sndfile-ts": "scripts/faust2sndfile.js", + "faust2svg-ts": "scripts/faust2svg.js", + "faust2wasm-ts": "scripts/faust2wasm.js" + } + }, + "node_modules/@types/emscripten": { + "version": "1.41.6", + "resolved": "https://registry.npmjs.org/@types/emscripten/-/emscripten-1.41.6.tgz", + "integrity": "sha512-uN+9i8bFT5CUcZfyIEYDrSueACEyKGbUs5kC/72DGlZZoinh84sJfVV0i8UOJD1asdzkvLPBRrKs41kZ8MdEXg==", + "dev": true, + "license": "MIT" + } + } +} diff --git a/tools/aqua-playground/package.json b/tools/aqua-playground/package.json new file mode 100644 index 0000000..9ebad5f --- /dev/null +++ b/tools/aqua-playground/package.json @@ -0,0 +1,13 @@ +{ + "name": "aqua-playground", + "private": true, + "type": "module", + "description": "Static in-browser playground for AquaSynth patches: .aqua -> Faust (AquaLower) -> wasm (faustwasm) -> AudioWorklet.", + "scripts": { + "build": "node build.mjs", + "test": "node test.mjs" + }, + "devDependencies": { + "@grame/faustwasm": "0.20.0" + } +} diff --git a/tools/aqua-playground/test.mjs b/tools/aqua-playground/test.mjs new file mode 100644 index 0000000..4275537 --- /dev/null +++ b/tools/aqua-playground/test.mjs @@ -0,0 +1,49 @@ +// Headless check of the built site (dist/): every catalog patch compiles to wasm through the same +// faustwasm runtime the browser loads, exposes controls, and renders audible, finite samples. +// It measures non-silence and NaN only; it cannot hear anything. Usage: node build.mjs && node test.mjs +import { readFileSync } from "node:fs"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath, pathToFileURL } from "node:url"; + +const dist = resolve(process.argv[2] ?? join(dirname(fileURLToPath(import.meta.url)), "dist")); +const { instantiateFaustModuleFromFile, LibFaust, FaustCompiler, FaustMonoDspGenerator } = + await import(pathToFileURL(join(dist, "vendor/faustwasm/index.js")).href); +const { controlsOf } = await import(pathToFileURL(join(dist, "ui.mjs")).href); + +const libfaust = new LibFaust(await instantiateFaustModuleFromFile(join(dist, "vendor/libfaust-wasm/libfaust-wasm.js"))); +const compiler = new FaustCompiler(libfaust); +const catalog = JSON.parse(readFileSync(join(dist, "catalog.json"), "utf8")); +const SR = 48000, SECONDS = 2; +let failed = 0; +console.log(`libfaust ${libfaust.version()}; ${catalog.length} patches; ${SECONDS} s at ${SR} Hz`); + +function stats(out) { + let peak = 0, bad = 0; + for (const ch of out) for (const v of ch) { if (!Number.isFinite(v)) bad++; else peak = Math.max(peak, Math.abs(v)); } + return { peak, bad }; +} + +for (const e of catalog) { + const g = new FaustMonoDspGenerator(); + const ok = await g.compile(compiler, e.name.replace(/[^A-Za-z0-9_]/g, "_"), readFileSync(join(dist, e.dsp), "utf8"), "-ftz 2"); + if (!ok) { failed++; console.log(`FAIL ${e.name}: compile: ${compiler.getErrorMessage()}`); continue; } + const controls = controlsOf(JSON.parse(g.factory.json)); + const { peak, bad } = stats((await g.createOfflineProcessor(SR, 512)).render(null, SR * SECONDS)); + const problems = []; + if (bad) problems.push(`${bad} non-finite samples`); + if (!(peak > 1e-4)) problems.push(`silent (peak ${peak})`); + if (e.name === "thruster") { + if (!controls.some((c) => c.label === "rpm")) problems.push("no rpm control in the DSP UI"); + for (const rpm of [600, 4800]) { + const p = await g.createOfflineProcessor(SR, 512); + p.setParamValue(controls.find((c) => c.label === "rpm").address, rpm); + const s = stats(p.render(null, SR * SECONDS)); + console.log(` thruster rpm=${rpm}: peak ${s.peak.toFixed(4)}, non-finite ${s.bad}`); + if (s.bad || !(s.peak > 1e-4)) problems.push(`rpm ${rpm}: peak ${s.peak}, non-finite ${s.bad}`); + } + } + failed += problems.length ? 1 : 0; + console.log(`${problems.length ? "FAIL" : "ok "} ${e.name}: peak ${peak.toFixed(4)}${peak > 1 ? " (CLIPS)" : ""}, ${controls.length} controls${problems.length ? " :: " + problems.join("; ") : ""}`); +} +console.log(failed ? `${failed} FAILED` : "all passed"); +process.exit(failed ? 1 : 0); diff --git a/tools/aqua-playground/web/app.js b/tools/aqua-playground/web/app.js new file mode 100644 index 0000000..da38b06 --- /dev/null +++ b/tools/aqua-playground/web/app.js @@ -0,0 +1,91 @@ +import { instantiateFaustModuleFromFile, LibFaust, FaustCompiler, FaustMonoDspGenerator } from "./vendor/faustwasm/index.js"; +import { controlsOf } from "./ui.mjs"; + +const $ = (id) => document.getElementById(id); +const status = (t) => { $("status").textContent = t; }; +let compiler, ctx, node, gain, analyser, generator, entry; + +async function init() { + const catalog = await (await fetch("./catalog.json")).json(); + for (const e of catalog) $("patch").add(new Option(`${e.name}${e.kind === "faust" ? " (hand-written Faust)" : ""}`, e.name)); + compiler = new FaustCompiler(new LibFaust(await instantiateFaustModuleFromFile("./vendor/libfaust-wasm/libfaust-wasm.js"))); + window.aquaCatalog = catalog; + $("patch").onchange = () => load(catalog.find((e) => e.name === $("patch").value)); + $("play").onclick = play; $("stop").onclick = stop; + $("recompile").onclick = () => compile($("source").value); + $("volume").oninput = () => { if (gain) gain.gain.value = Number($("volume").value); }; + const start = new URLSearchParams(location.search).get("patch"); + const first = catalog.find((e) => e.name === start) ?? catalog[0]; + $("patch").value = first.name; + await load(first); +} + +async function load(e) { + stop(); + entry = e; + $("origin").textContent = `from ${e.origin}`; + $("source").value = await (await fetch(`./${e.dsp}`)).text(); + await compile($("source").value); +} + +async function compile(code) { + stop(); + status("Compiling Faust to wasm…"); + const t0 = performance.now(); + const g = new FaustMonoDspGenerator(); + const ok = await g.compile(compiler, entry.name.replace(/[^A-Za-z0-9_]/g, "_"), code, "-ftz 2"); + if (!ok) { status(`Compile failed: ${compiler.getErrorMessage()}`); $("play").disabled = true; return; } + generator = g; + $("play").disabled = false; + const controls = controlsOf(JSON.parse(g.factory.json)); + buildControls(controls); + status(`Compiled in ${Math.round(performance.now() - t0)} ms; ${controls.length} controls. Press Play.`); +} + +function buildControls(controls) { + const box = $("controls"); box.replaceChildren(); + let group = null; + for (const c of controls) { + if (c.group !== group) { group = c.group; const h = document.createElement("div"); h.className = "grp"; h.textContent = group; box.append(h); } + const row = document.createElement("div"); row.className = "row"; + const label = document.createElement("label"); label.textContent = c.label; label.title = c.address; + const input = document.createElement("input"); + const out = document.createElement("output"); + if (c.type === "checkbox" || c.type === "button") { input.type = "checkbox"; input.checked = c.init > 0; } + else { input.type = "range"; input.min = c.min; input.max = c.max; input.step = c.step; input.value = c.init; } + const show = () => { out.textContent = input.type === "checkbox" ? (input.checked ? "on" : "off") : Number(input.value).toFixed(c.step < 0.01 ? 4 : c.step < 1 ? 2 : 0); }; + input.oninput = () => { show(); node?.setParamValue(c.address, input.type === "checkbox" ? Number(input.checked) : Number(input.value)); }; + input.dataset.address = c.address; show(); + row.append(label, input, out); box.append(row); + } +} + +async function play() { + stop(); + ctx ??= new AudioContext({ latencyHint: "interactive" }); + await ctx.resume(); + // A fresh node each press: one-shot .aqua patches run on a clock that starts at instantiation. + node = await generator.createNode(ctx); + if (!node) { status("createNode failed"); return; } + for (const input of $("controls").querySelectorAll("input")) input.dispatchEvent(new Event("input")); + gain = ctx.createGain(); gain.gain.value = Number($("volume").value); + analyser = ctx.createAnalyser(); analyser.fftSize = 1024; + node.connect(gain); gain.connect(analyser); analyser.connect(ctx.destination); + status(`Playing ${entry.name} at ${ctx.sampleRate} Hz.`); + meter(); +} + +function stop() { + if (node) { node.disconnect(); node.destroy?.(); node = null; } + gain?.disconnect(); analyser?.disconnect(); gain = analyser = null; + $("level").value = 0; +} + +function meter() { + if (!analyser) return; + const buf = new Float32Array(analyser.fftSize); analyser.getFloatTimeDomainData(buf); + $("level").value = buf.reduce((m, v) => Math.max(m, Math.abs(v)), 0); + requestAnimationFrame(meter); +} + +init().catch((err) => { status(`Failed to start: ${err}`); console.error(err); }); diff --git a/tools/aqua-playground/web/index.html b/tools/aqua-playground/web/index.html new file mode 100644 index 0000000..7f8974d --- /dev/null +++ b/tools/aqua-playground/web/index.html @@ -0,0 +1,38 @@ + + + + + + AquaSynth Playground + + + +
+
+

AquaSynth lab

+

Patch Playground

+

An AquaSynth .aqua patch is lowered to Faust, compiled to WebAssembly in this page, and played through an AudioWorklet. Nothing here is rendered on a server.

+
+
+ + + + + + Loading the Faust compiler… +
+
+
+

Controls (from the DSP's own UI)

+
+
+
+

Lowered Faust source

+ + +
+
+
+ + + diff --git a/tools/aqua-playground/web/styles.css b/tools/aqua-playground/web/styles.css new file mode 100644 index 0000000..3c7dcaf --- /dev/null +++ b/tools/aqua-playground/web/styles.css @@ -0,0 +1,19 @@ +:root { color-scheme: dark; --bg:#0b1418; --fg:#d7e6ea; --dim:#7f9aa3; --acc:#3fc1c9; --line:#1f3640; } +* { box-sizing: border-box; } +body { margin:0; background:var(--bg); color:var(--fg); font:15px/1.45 system-ui, sans-serif; } +main { max-width:1200px; margin:0 auto; padding:24px; } +.eyebrow { margin:0; color:var(--acc); text-transform:uppercase; letter-spacing:.12em; font-size:12px; } +h1 { margin:.1em 0 .2em; } h2 { font-size:16px; margin:0 0 8px; } small { color:var(--dim); font-weight:400; } +.lede { color:var(--dim); max-width:70ch; } +.bar { display:flex; flex-wrap:wrap; gap:12px 16px; align-items:center; padding:12px 0; border-block:1px solid var(--line); margin-bottom:16px; } +button, select { background:#10242b; color:var(--fg); border:1px solid var(--line); padding:6px 14px; border-radius:4px; font:inherit; } +button:hover { border-color:var(--acc); } button:disabled { opacity:.4; } +#status { color:var(--dim); } +.cols { display:grid; grid-template-columns:minmax(280px,1fr) minmax(320px,1.4fr); gap:24px; } +@media (max-width:800px) { .cols { grid-template-columns:1fr; } } +.controls { display:grid; gap:6px; max-height:70vh; overflow:auto; padding-right:8px; } +.controls .row { display:grid; grid-template-columns:minmax(0,1fr) 120px 58px; gap:8px; align-items:center; } +.controls .grp { color:var(--dim); font-size:12px; margin-top:8px; } +.controls label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; } +.controls output { text-align:right; color:var(--acc); font-variant-numeric:tabular-nums; } +textarea { width:100%; height:62vh; background:#071013; color:#bcd3d8; border:1px solid var(--line); border-radius:4px; font:12px/1.4 ui-monospace, monospace; padding:8px; resize:vertical; } diff --git a/tools/aqua-playground/web/ui.mjs b/tools/aqua-playground/web/ui.mjs new file mode 100644 index 0000000..d06102a --- /dev/null +++ b/tools/aqua-playground/web/ui.mjs @@ -0,0 +1,17 @@ +// Flattens a Faust DSP JSON `ui` tree (factory.json) into the controls a slider panel needs. +// Shared by the browser app and the node test so both read the DSP's own UI declaration. +export function controlsOf(json) { + const out = []; + const walk = (items, group) => { + for (const it of items ?? []) { + if (it.items) walk(it.items, it.label ? [...group, it.label] : group); + else if (/slider|nentry|checkbox|button/.test(it.type)) + out.push({ + address: it.address, label: it.label, group: group.join(" / "), type: it.type, + init: Number(it.init ?? 0), min: Number(it.min ?? 0), max: Number(it.max ?? 1), step: Number(it.step ?? 0.01), + }); + } + }; + walk(json.ui, []); + return out; +} -- 2.47.3 From 6080f9b8f182932b947eabf3930dec4757deffa0 Mon Sep 17 00:00:00 2001 From: Aqua Date: Wed, 4 Nov 2026 13:39:11 +0000 Subject: [PATCH 2/3] Playground: rename ui.mjs to ui.js so static hosts serve a JavaScript MIME type The minds host sends .mjs as application/octet-stream, which browsers refuse for module imports. Co-Authored-By: Claude Sonnet 5.5 --- tools/aqua-playground/README.md | 2 +- tools/aqua-playground/test.mjs | 2 +- tools/aqua-playground/web/app.js | 2 +- tools/aqua-playground/web/{ui.mjs => ui.js} | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename tools/aqua-playground/web/{ui.mjs => ui.js} (100%) diff --git a/tools/aqua-playground/README.md b/tools/aqua-playground/README.md index 720915b..3ecc87f 100644 --- a/tools/aqua-playground/README.md +++ b/tools/aqua-playground/README.md @@ -21,7 +21,7 @@ controls, so their slider panel is empty. - `node test.mjs [dist]`: headless check of `dist/`: each patch compiles to wasm, renders 2 s offline, is non-silent and finite; the thruster is also run at rpm 600 and 4800. It cannot hear and does not run an AudioWorklet or a browser. -- `web/`: the page (`index.html`, `app.js`, `ui.mjs`, `styles.css`). +- `web/`: the page (`index.html`, `app.js`, `ui.js`, `styles.css`). Serve `dist/` from any static host (`python3 -m http.server`); AudioWorklet needs `localhost` or https. The older `tools/vocal-tract-playground` renders server-side through the .NET renderer; this one diff --git a/tools/aqua-playground/test.mjs b/tools/aqua-playground/test.mjs index 4275537..673653a 100644 --- a/tools/aqua-playground/test.mjs +++ b/tools/aqua-playground/test.mjs @@ -8,7 +8,7 @@ import { fileURLToPath, pathToFileURL } from "node:url"; const dist = resolve(process.argv[2] ?? join(dirname(fileURLToPath(import.meta.url)), "dist")); const { instantiateFaustModuleFromFile, LibFaust, FaustCompiler, FaustMonoDspGenerator } = await import(pathToFileURL(join(dist, "vendor/faustwasm/index.js")).href); -const { controlsOf } = await import(pathToFileURL(join(dist, "ui.mjs")).href); +const { controlsOf } = await import(pathToFileURL(join(dist, "ui.js")).href); const libfaust = new LibFaust(await instantiateFaustModuleFromFile(join(dist, "vendor/libfaust-wasm/libfaust-wasm.js"))); const compiler = new FaustCompiler(libfaust); diff --git a/tools/aqua-playground/web/app.js b/tools/aqua-playground/web/app.js index da38b06..54c0331 100644 --- a/tools/aqua-playground/web/app.js +++ b/tools/aqua-playground/web/app.js @@ -1,5 +1,5 @@ import { instantiateFaustModuleFromFile, LibFaust, FaustCompiler, FaustMonoDspGenerator } from "./vendor/faustwasm/index.js"; -import { controlsOf } from "./ui.mjs"; +import { controlsOf } from "./ui.js"; const $ = (id) => document.getElementById(id); const status = (t) => { $("status").textContent = t; }; diff --git a/tools/aqua-playground/web/ui.mjs b/tools/aqua-playground/web/ui.js similarity index 100% rename from tools/aqua-playground/web/ui.mjs rename to tools/aqua-playground/web/ui.js -- 2.47.3 From 46da9975dfd51552ac102472fa2fc545a14f1413 Mon Sep 17 00:00:00 2001 From: Aqua Date: Thu, 5 Nov 2026 11:46:43 +0000 Subject: [PATCH 3/3] Playground README: state plainly that it is unheard and unrun in a browser Co-Authored-By: Claude Sonnet 5.5 --- tools/aqua-playground/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/aqua-playground/README.md b/tools/aqua-playground/README.md index 3ecc87f..aa5da7f 100644 --- a/tools/aqua-playground/README.md +++ b/tools/aqua-playground/README.md @@ -3,6 +3,12 @@ Static, serverless audition page for AquaSynth patches. Pick a patch, read the Faust it lowers to, move the sliders the DSP itself declares, press Play. +**Status: unheard, and never run in a browser.** `node test.mjs` is the only check that has run: it +compiles each patch to wasm in Node and renders it offline (non-silent, finite). No patch has been listened to; +the page itself, its AudioWorklet path, sliders and layout have not been opened in any browser. One patch +is known to clip: `dx7-public-domain-prc-synth1-calibrated` peaks at 2.10. Browser verification is open as +`aqua-body:follow_up:playground-browser-verify`. + **What is live:** 42 patches (`catalog.json`): the hand-written Faust `thruster` (with its `rpm` control) and 41 of the 43 `.aqua` files, lowered by `tools/AquaLower` through `FaustEmitter.EmitScript` (the lowering the daemon uses). Faust is compiled to WebAssembly in the page -- 2.47.3