From 37417cf7be0b76e47beace4d8b708bc1593c8ba9 Mon Sep 17 00:00:00 2001 From: dxinteractive Date: Tue, 25 Jun 2024 00:11:30 +1000 Subject: [PATCH] huh --- dev/src/dsp-definitions/39-autosampler.ts | 15 ++------ dev/src/dsp-definitions/40-pulse-delay.ts | 46 +++++++++++++++++++++++ dev/src/dsp-definitions/all.ts | 2 + 3 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 dev/src/dsp-definitions/40-pulse-delay.ts diff --git a/dev/src/dsp-definitions/39-autosampler.ts b/dev/src/dsp-definitions/39-autosampler.ts index f9bc4be..b3c536a 100644 --- a/dev/src/dsp-definitions/39-autosampler.ts +++ b/dev/src/dsp-definitions/39-autosampler.ts @@ -22,7 +22,6 @@ env_on = env_active : ba.impulsify; gated = input * env_active; env_active_timer = env_active : invert_boolean : ba.countup(table_size); -env_active_forever = env_on : ba.on_and_off(_, 0) : >(0); env_active_sweep = env_active_timer : ba.sweep(table_size); record_head = env_active_sweep * (env_active_sweep <= sampling_time * 2); @@ -33,9 +32,7 @@ vol(v) = cos(v * ma.PI * 2.0) * -0.5 + 0.5; table(pb, x) = rwtable(table_size, 0.0, record_head(x), x, pb(x)) * vol(pb(x) / sampling_time); fx(x) = table(playback_head, x) + table(playback_head2, x) + (x * max(0.0, 1.0 - (env_active_sweep / sampling_time) * 2.0)); - -repeat = fx; - +process = fx; `; const dspDefinition: DspDefinition = { @@ -47,13 +44,9 @@ const dspDefinition: DspDefinition = { inputFile: "/audio/cycfi-q-pitch-test/GLines3.wav", channels: 1, sampleRate: 48000, - outputLength: 48000 * 5, - output: ["gated", "playback_head", "playback_head2", "repeat"], - inputOffset: 18000 + 13000, + output: ["env_active", "process"], + outputLength: 48000 * 20, + inputOffset: 18000 + 13000 + 300000, }; export default dspDefinition; - -// -// playback_head_double = ((env_active_sweep - 1) % sampling_time_2) + 1; -// playback_head2(x) = ba.if(playback_head_double(x) <= sampling_time, playback_head_double(x), sampling_time_2 - playback_head_double(x) + 1); diff --git a/dev/src/dsp-definitions/40-pulse-delay.ts b/dev/src/dsp-definitions/40-pulse-delay.ts new file mode 100644 index 0000000..2d6a4a4 --- /dev/null +++ b/dev/src/dsp-definitions/40-pulse-delay.ts @@ -0,0 +1,46 @@ +import type { DspDefinition } from "../types"; + +const dsp = ` +import("stdfaust.lib"); + +delay_max = ma.SR * 5; + +wet_param = 1.0; +dry_param = 0.7; +fb_param = 0.9; +time_param = 0.2 * ma.SR; + +squash(x) = 1.0 - (1.0 / (x + 1.0)); +stretch(mn, mx, x) = (x - mn) / (mx - mn) : min(1.0) : max(0.0); +env = *(10.0) : an.amp_follower_ar(0.1, 0.1) : squash : stretch(0.2, 0.7); +swell(x) = x * env(x); + +mod_speed_param = 3.0; +mod_depth_param = 0.0002; +mod = 1.0 - ((os.osc(mod_speed_param) * 0.5 + 0.5) * mod_depth_param); + +delay(time, fb, x) = x + fb : de.fdelay(delay_max, time * mod) : fi.highpass(2, 200.0) : fi.lowpass(2, 5000.0); +fb = *(fb_param); +echo(time) = delay(time) ~ fb; + +wet = swell <: echo(time_param) :> _; +dry(x) = x * dry_param * (1.0 - env(x) * 0.9); + +process = _ <: (dry,wet) :> _; + +`; + +const dspDefinition: DspDefinition = { + id: "pulse-delay", + name: "Pulse delay", + description: "Smooth off transients before high feedback clean delay", + dsp, + type: "offline", + inputFile: "/audio/cycfi-q-pitch-test/GLines3.wav", + channels: 1, + sampleRate: 48000, + outputLength: 48000 * 20, + inputOffset: 18000 + 13000, +}; + +export default dspDefinition; diff --git a/dev/src/dsp-definitions/all.ts b/dev/src/dsp-definitions/all.ts index e925388..ac16ac4 100644 --- a/dev/src/dsp-definitions/all.ts +++ b/dev/src/dsp-definitions/all.ts @@ -39,6 +39,7 @@ import wizardDelay from "./36-wizard-delay"; import filterBank from "./37-filter-bank"; import cloudify from "./38-cloudify"; import autosampler from "./39-autosampler"; +import pulseDelay from "./40-pulse-delay"; export const all: DspDefinition[] = [ sineWave, @@ -80,4 +81,5 @@ export const all: DspDefinition[] = [ filterBank, cloudify, autosampler, + pulseDelay, ];