Skip to content

Commit

Permalink
Release QuickDualDelay v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagolr committed Dec 19, 2023
1 parent 1a39504 commit 0e7c8c5
Show file tree
Hide file tree
Showing 3 changed files with 1,220 additions and 0 deletions.
154 changes: 154 additions & 0 deletions Reverb/tilr_QuickDualDelay.jsfx
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
desc: QuickDualDelay
author: tilr
version: 1.0
provides:
tilr_QuickDualDelay/qd.delay.jsfx-inc
tilr_QuickDualDelay/qd.rbj_filter.jsfx-inc
about:
# QuickDualDelay

Dual delay with independent or sync times, ping-pong mode, tempo sync and feedback filters.

#### Features

* Dual delay with independent or sync time and feedback
* Normal and ping-pong modes
* Ping-pong stereo width control
* Tempo sync
* Low pass and high pass feedback filters with Q controls
* Delay modulation

desc:QuickDualDelay

slider1:delay_sync=0<0,1,1{No,Yes}>Sync Delays

slider3:delayms=250<1,1000>Delay Time 1 (ms)
slider4:sync=0<0,16,1{Off,1/16,1/8,1/4,1/2,1/1,1/16t,1/8t,1/4t,1/2t,1/1t,1/16.,1/8.,1/4.,1/2.,1/1.}>Tempo Sync 1
slider5:_feedback=0<0,100>Feedback 1

slider7:delayms2=250<1,1000>Delay Time 2 (ms)
slider8:sync2=0<0,16,1{Off,1/16,1/8,1/4,1/2,1/1,1/16t,1/8t,1/4t,1/2t,1/1t,1/16.,1/8.,1/4.,1/2.,1/1.}>Tempo Sync 2
slider9:_feedback2=0<0,100>Feedback 2

slider11:mode=0<0,1,1{Normal,Ping-Pong}>Mode
slider12:spread=0<-100,100,1>Ping-Pong Spread

slider14:lp_freq=20000<20,20000,1:log>Low Pass
slider15:lp_q=0.707<0.1,4.0,0.01:log>Low Pass Q
slider16:hp_freq=20<20,20000,1:log>High Pass
slider17:hp_q=0.707<0.1,4.0,0.01:log>High Pass Q

slider19:mod_amp=0<0,100>Modulation amp
slider20:mod_freq=1<1,8>Modulation freq (Hz)

slider22:_dry=100<0,100>Dry signal
slider23:_wet=100<0,100>Wet signal

import qd.delay.jsfx-inc
import qd.rbj_filter.jsfx-inc

@init
// 10 second stereo delay line
d0.delay(srate * 10);
d1.delay(srate * 10);

function sine_wave(cycle) (
sin(cycle * 2 * $pi);
);

@slider
cycle = 0;
feedback = _feedback / 100;
feedback2 = delay_sync ? feedback : _feedback2 / 100;
lfactor = spread > 0 ? 1 - spread / 100 : 1;
rfactor = spread < 0 ? 1 + spread / 100 : 1;

lp.rbj_lp(lp_freq, lp_q);
hp.rbj_hp(hp_freq, hp_q);

dry = _dry / 100;
wet = _wet / 100;

@block
while (midirecv(offset, msg1, note, vel)) (
event = msg1 & 0xF0;
event == 0xB0 && note == 123 ? ( // All notes off
memset(d0.buf, 0, d0.size);
memset(d1.buf, 0, d1.size);
);
);

function get_time_sync (sync) (
sync == 1 ? 60000 / 4 / tempo: // 1/16
sync == 2 ? 60000 / 2 / tempo: // 1/8
sync == 3 ? 60000 / tempo: // 1/4
sync == 4 ? 60000 * 2 / tempo: // 1/2
sync == 5 ? 60000 * 4 / tempo: // 1/1
sync == 6 ? 60000 / 6 / tempo: // 1/16t
sync == 7 ? 60000 / 3 / tempo: // 1/8t
sync == 8 ? 60000 / 3 * 2 / tempo: // 1/4t
sync == 9 ? 60000 / 3 * 4 / tempo: // 1/2t
sync == 10 ? 60000 / 3 * 8 / tempo: // 1/1t
sync == 11 ? 60000 / 4 * 1.5 / tempo: // 1/16.
sync == 12 ? 60000 / 2 * 1.5 / tempo: // 1/8.
sync == 13 ? 60000 * 1.5 / tempo: // 1/4.
sync == 14 ? 60000 * 2 * 1.5 / tempo: // 1/2.
sync == 15 ? 60000 * 4 * 1.5 / tempo: // 1/1.
1;
);

sync > 0 ? (
delayms = get_time_sync(sync);
);
delayms > 10000 ? delayms = 10000;

delay_sync ? (
sync2 = sync;
delayms2 = delayms;
) : (
sync2 > 0 ? (
delayms2 = get_time_sync(sync2);
);
);
delayms2 > 10000 ? delayms2 = 10000;

samps1 = delayms * 0.001 * srate; // delay time in samples
samps2 = delayms2 * 0.001 * srate;

@sample

// modulation sinewave
mod_amp ? (
cycle += mod_freq / srate;
cycle > 1 ? cycle -= 1;
wave = sine_wave(cycle);
) : (
wave = 0;
);

// read with cubic interpolation
val0 = d0.delay_read3(samps1 + wave * mod_amp);
val1 = d1.delay_read3(samps2 + wave * mod_amp);

// apply filters on delay signal
lp_freq < 20000 ? (
val0 = lp.rbj_df1(val0);
val1 = lp.rbj_df2(val1);
);
hp_freq > 20 ? (
val0 = hp.rbj_df1(val0);
val1 = hp.rbj_df2(val1);
);

// write values in delay lines
mode == 0 ? (
d0.delay_write(spl0 + val0 * feedback);
d1.delay_write(spl1 + val1 * feedback2);
) : mode == 1 ? (
d0.delay_write(spl0 * lfactor + val1 * feedback);
d1.delay_write(spl1 * rfactor + val0 * feedback2);
);

// sum and output
spl0 = spl0*dry + val0*wet;
spl1 = spl1*dry + val1*wet;
Loading

0 comments on commit 0e7c8c5

Please sign in to comment.