1 2/* Stereo flanger with feedback. */ 3 4/* This is basically just a chorus with a different kind of LFO (triangle wave 5 instead of sine), smaller delay times (typically 1-10 ms instead of 20-30 6 ms) and (much) larger sweep depth, which makes this unit sound more like a 7 time-varying filter (in fact, that's just what it is), in contrast to the 8 gentle pitch modulation produced by a chorus. 9 10 There's also an additional feedback loop which can be used to produce 11 metallic sounds, and a stereo control which allows you to change the 12 stereo spread (a.k.a. phase difference between left and right LFO). 13 14 Note that you can actually make this unit sound pretty much like a chorus 15 by cranking up the delay time while setting the feedback to zero and 16 reducing level and depth (the latter by at least an order of magnitude). */ 17 18declare name "flanger -- stereo flanger with feedback"; 19declare author "Albert Graef"; 20declare version "1.0"; 21 22import("music.lib"); 23 24level = hslider("level", 1, 0, 1, 0.01); 25freq = hslider("freq", 2, 0, 10, 0.01); 26dtime = hslider("delay", 0.002, 0, 0.04, 0.001); 27depth = hslider("depth", 0.5, 0, 1, 0.001); 28feedback = hslider("feedback", 0.1, 0, 1, 0.001); 29stereo = hslider("stereo", 1, 0, 1, 0.001); 30 31tblosc(n,f,freq,mod) = (1-d)*rdtable(n,wave,i&(n-1)) + 32 d*rdtable(n,wave,(i+1)&(n-1)) 33with { 34 wave = time*(2.0*PI)/n : f; 35 phase = freq/SR : (+ : decimal) ~ _; 36 modphase = decimal(phase+mod/(2*PI))*n; 37 i = int(floor(modphase)); 38 d = decimal(modphase); 39}; 40 41triangle(t) = ((0<=t) & (t<=PI))*((2*t-PI)/PI) + 42 ((PI<t) & (t<=2*PI))*((3*PI-2*t)/PI); 43 44flanger(dtime,freq,level,feedback,depth,phase,x) 45 = (x+(loop(x)*level))/(1+level) 46with { 47 t = SR*dtime/2*(1+depth*tblosc(1<<16, triangle, freq, phase)); 48 loop = (+ : fdelay(1<<16, t)) ~ *(feedback); 49}; 50 51process = vgroup("flanger", (left, right)) 52with { 53 left = flanger(dtime,freq,level,feedback,depth,0); 54 right = flanger(dtime,freq,level,feedback,depth,stereo*PI); 55}; 56