loop_0
 1 loop, 0 filters (1 worker, 1 AudioWorklet)
 tick: 0.000, time: 0.000 (120 bpm)
 
 
 
 
 

Richeh adapting to change

I don't want to grow up into some other kind of witch and that's why I'm going to show you how I make it to the exit using my own spells. #Instrumental #VHS #RetroFuturism

Log in to post a comment.

@Ollerich Thank you for listening and commenting, much appreciated! Over the years, I've collected code snippets in various languages and frameworks. I chose to do it this way out of convenience and to save time. To quickly port code between sketches and ideas without getting bogged down in framework implementation details, language semantics, or OS/processor specifications.
Some really cool sounds in this one. @nabr: Just wondering, why did you chose to do all the synthesis inside of InstGr instead of using built-in synths and loops? Sure,it is very compact that way, just wonderning.
/*
*/
const InstGr = class {
constructor() {
this.drrevInst = [new DrRoom(), new DrRoom(), new DrRoom()];
this.fltr = new FilterBank();
}
process(time) {
let snth = 0, fltpd = 0,padhi = 0,padlw = 0,crn1 = 0,crn0 = 0,arp = 0, bll = 0;
// -------- INTRO
// pad chord progression + warm sound pad
crn0 = lerp(.34, .17, fract(.5 * time)) * softkna(arpmel(2. + .5 * time), .76, .86);
// flute melody
fltpd = .8 * (0.75 * softkna(sup_chd(.3 + 1 * time, 1.5 / 2), .8, .8) + .3 * sup_chd(.15 + 1 * time, .5));
fltpd = smoothstep(3, 4.8, time) * fltpd; //softkn(pad, .7)
fltpd = .86 * tanh(fltpd + .9 * crn0);
// metalic trumpet
crn1 = (mod(time, 8) > 4 ? 1.2 : .7) * sup_ab(time) * env_adc(fract(time), .25, .7);
crn1 *= fadein(18, 24, time);
// bell-like sound very quiet in the background
bll = (sin(time) * .3 + .3) * msat(.6 * sin(12 * time) * sup_chd((1.2 + .5 * time), 4.), .6);
bll *= fadein(24, 32, time);
// bright bell-like sound melody
arp = lerp(.07, .47, fract(.5 * time)) * arpmel(time);
// sum to output
snth = arp + bll + lerp(1e-6, crn1, fract(time));
// toms
let tmdr = 0;
let tm0 = 0, tm1 = 0;
tm0 = (random() * 2. - 1.);
tm1 = tm0;
const ft = mod(1 * 2. * time, 1.);
const ft1 = mod(1 * 4. * time, 1.);
// noise gate toms and than eq for a perceived room fx
tm0 *= 25 * (max(0, (1 - ft), min(1, 40 * ft)) / max(1, 250. * ft));
tm1 *= 35 * (max(0, (1 - ft1), min(1, 25 * ft1)) / max(1, 80. * ft1));
tm1 = tm1 * [1, 0, 0, 1, 1, 0, 1, 0].ring(4 * time);
tm0 = this.drrevInst[0].process(tm0, { rc_fc: .05 + 0.27, rc_res: 1.0, lpf_fc: 250, lpf_q: 0.55 });
tm1 = this.drrevInst[1].process(tm1, { rc_fc: .1150 + 0.15, rc_res: 1.45, lpf_fc: 100, lpf_q: 0.25 });
tmdr = tanh(tm0 + tm1);
// kick
const hdkkdt = [260, 60, 0, 160][int(time) % 4];
let hdkk = 0;
const hdkk_rt = 4 * time + hdkkdt;
hdkk = sin(tau * (4 * hdkk_rt - 3 * exp(-44 * fract(hdkk_rt))));
hdkk *= [1, 0, 1, 1, 0, 1, 0, 1].ring(hdkk_rt);
hdkk = softkna(hdkk * 8, .6, .31);
hdkk *= env_ad(fract(4. * time), .3, .5);
// bass
let pwbss = 0;
let pwmel = 1 * [49, 58.8, 49, 73.5].ring(time) * tau * time;
const pwtft = fract(4 * time);
pwbss = .73 * sin(4 * pwmel - 4 * exp(-10 * pwtft)) + .5 * cos(.5 * (6 * pwmel - 24 * exp(-10 * pwtft)));
pwbss = sin(pwbss - .21);
let pwbss_gain = .763;
pwbss *= [1, 0, 1, 1, 0, 1, 0, 1][int(2 * time) % 8];
pwbss = softkn(pwbss, pwbss_gain) * env_ad(pwtft, .37, .46);
pwbss = this.drrevInst[2].process(pwbss, { rc_fc: lerp(.78, .9, fract(.2 * time)), rc_res: .5, lpf_fc: 175, lpf_q: 1.25 });
// -------- CHORDS second part
let synthtime = 0;
const mx = 4.;
const chch0 = (mod(time, 12) > 6 ? (mx * (1. / 8) * time) : 1);
const chch1 = mx * (1. / 8) * time;
const chch2 = [2, 1].ring(mx * (1. / 4) * time);
synthtime = [[4, 0, 4, 0].ring(mx * 2. * time), [4, 1, 0, 6].ring(mx * 2. * time)].ring(chch0)
+ [28, 32, 24].ring(chch1) + mod(time, chch2);
const evdt = 2 * 4 * synthtime;
// fast strumming
padhi = .5 * chd(.1 + .5 * synthtime, evdt, 1, 12) + .63 * chd(synthtime, evdt, 1, 8);
// deep and slow
padlw = chd([.5, 2, 6, 4].ring(1 * time) + mod(1 * time, 1), 4 * time, .25, 6);
padlw += .5 * chd(.1 + 2 * time, 2. * time, .5 * [1.5 / 3, .75 * 2].ring(2. * time), 12);
return {
hichordOut: padhi * fadein(38, 42, time),
lwchordOut: padlw * fadein(34, 36, time),
fltpdOut: fltpd * fadein(36, 32, time),
synthOut: snth * fadein(18, 24, time),
pwbssOut: pwbss * fadein(16, 24, time),
tomsOut: tmdr * fadein(6, 10, time),
hardkkOut: hdkk * fadein(14, 20, time)
}
}
}; // ######## Intrument Group
const MIX = class {
constructor() {
this.period = 0;
this.cmain = new InstGr();
this.crev = [new Rev_Mn(), new Rev_Mn(), new Rev_Mn(), new Rev_Mn(), new Rev_Mn(), new Rev_Mn()];
this.chrdcrev = [new Rev_Mn(), new Rev_Mn(), new Rev_Mn(), new Rev_Mn()];
this.fltr = new FilterBank();
this.stfltr = [new FilterBank(), new FilterBank(), new FilterBank(), new FilterBank()];
this.drrevInst = [new DrRoom(), new DrRoom(), new DrRoom(), new DrRoom()];
}
process() {
let fltpd = 0,hichrd = 0,lwchrd = 0,klav = 0,toms = 0,ktmdr = 0,pwbss = 0;
let rev_oxpad = [0, 0],rev_chrds = [0, 0],rev_osyth = [0, 0],rev_otoms = [0, 0];
this.period += 1;
let time = int(this.period) / ditty.sampleRate;
time+=36;
// prefilter
const cmain = this.cmain.process(time);
pwbss = .86 * this.fltr.karlsen4pole(cmain.pwbssOut, 460, .7, 1, 0);
fltpd = this.fltr.karlsen4pole(cmain.fltpdOut, 380, .6, 1, 1);
klav = .6 * this.fltr.karlsen4pole(cmain.synthOut, 700, 1, 1, 2);
toms = .83 * this.fltr.karlsen4pole(cmain.tomsOut, 60, .7, 1, 3);
ktmdr = .31 * this.fltr.karlsen4pole(cmain.hardkkOut, 100, 1.3, 1, 4);
hichrd = this.fltr.karlsen4pole(cmain.hichordOut, 360, 1, 1, 5);
lwchrd = cmain.lwchordOut;
const drydrumsum = (toms + ktmdr + .7 * pwbss);
const drysynthsum = fltpd + .89 * klav + .56 * hichrd + .6 * lwchrd;
// -------- CHORD PROGRESSION second part
lwchrd = this.drrevInst[3].process(lwchrd, { rc_fc: .985, rc_res: .29, lpf_fc: 200, lpf_q: 1.2 });
rev_chrds[0] = 1.1 * this.chrdcrev[2].process(hichrd, 0, 15, 0.4379);
rev_chrds[1] = 1.1 * this.chrdcrev[3].process(hichrd, 8, 15, 0.4371);
// the sum chords stumming + slow, narrow the width will add competition for the dr+bass line
rev_chrds = this.stfltr[3].stwidth(rev_chrds, max(.7, smoothstep(0, 1, mod(.333 * time, 3.))));
rev_chrds[0] += .6 * this.chrdcrev[0].process(lwchrd, 0, 30, 0.439);
rev_chrds[1] += .6 * this.chrdcrev[1].process(lwchrd, 8, 30, 0.439);
// animated stereo width strumming chrods
rev_chrds = this.fltr.stwidth(rev_chrds, min(.96, max(.7, smoothstep(0, 1, mod((1./12) * time, 1.)))));
rev_chrds[0] = 0.18 * rev_chrds[0] + drysynthsum;
rev_chrds[1] = 0.18 * rev_chrds[1] + drysynthsum;
// -------- INTRO
rev_oxpad[0] = .422 * this.crev[0].process(fltpd, 0, 16, 0.697);
rev_oxpad[1] = .422 * this.crev[1].process(fltpd, 8, 16, 0.696);
rev_osyth[0] = .237 * this.crev[2].process(klav + .1 * pwbss, 0, 12, 0.433)
rev_osyth[1] = .237 * this.crev[3].process(klav + .1 * pwbss, 8, 12, 0.429)
rev_otoms[0] = .188 * this.crev[4].process(toms, 0, 38, 0.572);
rev_otoms[1] = .188 * this.crev[5].process(toms, 0, 38, 0.560);
/* mid side processing of the stwidth with filter helps with a pumping compression-like fx */
rev_oxpad = this.stfltr[0].stwidth(rev_oxpad, max(.7, smoothstep(8, 4, time)));
rev_osyth = this.stfltr[1].stwidth(rev_osyth, .5) ;
// -------- DRUMS
const rvdrwidth = max(.3, .6 * smoothstep(0, 1, mod(.25 * time, 3.)));
rev_otoms = this.stfltr[2].stwidth(rev_otoms, rvdrwidth);
// second part, adjust volume, subtle chorus-like fx, re-captures the listener's attention
if (time > 38&&(mod(time, 16) > 8) ) {
rev_otoms = [.63 * msat(rev_otoms[0], lerp(.6, .87, fract(5 * time)))
, .63 * msat(rev_otoms[1], lerp(.83, .66, fract(.5 * time)))];
}
// eq filter toms for reveb - more darkish bottom
rev_otoms[0] = this.drrevInst[0].process(rev_otoms[0], { rc_fc:.52, rc_res:.89, lpf_fc: 125, lpf_q: 0.7 });
rev_otoms[1] = this.drrevInst[1].process(rev_otoms[1], { rc_fc:.52, rc_res:.89, lpf_fc: 125, lpf_q: 0.7 });
// adjust volume in the second part, add dry signal
rev_otoms = [((time < 24) ? .9 : .7) * (drydrumsum + rev_otoms[0])
, ((time < 24) ? .9 : .7) * (drydrumsum + rev_otoms[1])];
// -------- MASTER OUT
if(time > 46 && time < 48 )
return rev_otoms;
return [rev_chrds[0] + rev_osyth[0] + rev_oxpad[0] + rev_otoms[0],
rev_chrds[1] + rev_osyth[1] + rev_oxpad[1] + rev_otoms[1]];
}
}; // ######## MIX
// will filter noise of the toms
class DrRoom {
constructor() {
this.fltr = new FilterBank();
}
process(sgnl_in, finp, ov) {
let outp = sgnl_in;
outp = this.fltr.lpf_rc(outp, finp.rc_fc, finp.rc_res);
outp = this.fltr.dcblock(outp, .996, 0);//highpass
outp = this.fltr.lpf_earlvl(outp, finp.lpf_fc, finp.lpf_q);
return outp;
}
}; // ########DRROOM
/* mono reverb
I spend hours with trial and error,
why I'm obsessed with this FDN-ish reverberation approach?
Even when it looks (in my other ditties ) weird, I simply stop when I like how it sounds.
*/
const Rev_Mn = class {
constructor() {
this.zn = Array.from({ length: 8 }, () => Array(2639).fill(0));
this.dcBlockState = Array.from({ length: 17 }, () => [0, 0]);
this.period = 0;
}
// input signal, matrix offset, reverb tail, scale delay times
process(rv_xin, offs, rtail, scl) {
this.period += 1;
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
9571 chars