(
// Load single buffer (user switches manually)
b = Buffer.read(s,
	"/home/lcoogan/snd/live/2025-04-26.Basic_City_Brewery/granular/Cantorial/old/Ribono_Shel_Olom.wav");
)

(
// SynthDef without the combo switch functionality
SynthDef(\pv16knob, {
    |out=0,
     bufnum=0,
     l1CC=0, l2CC=0, // CC values (no combo switching)
     l1Amp=1, l2Amp=1,
     pvAmp=1, pvMix=1,
     fil1Type=0, res1=0.3, fil2Type=0, res2=0.3,
     verb=0, comb=0, fold=0, sply=0,
     mast=1
    |

    var sig, chain, base, fftSize = 2048;

    base = PlayBuf.ar(1, bufnum, loop: 1);
    sig = base;

    chain = FFT(LocalBuf(fftSize), sig);

    // IFFT and effects applied directly to the signal
    sig = IFFT(chain) * l1Amp + IFFT(chain) * l2Amp;
    sig = SelectX.ar(pvMix, [base, sig]) * pvAmp;

    // Filters
    sig = Select.ar(fil1Type, [
        RLPF.ar(sig, 1200, res1),
        LPF.ar(sig, 1200),
        HPF.ar(sig, 1200),
        BPF.ar(sig, 1200),
        Formlet.ar(sig, 1000, 0.05, 0.005)
    ]);

    sig = BLowShelf.ar(sig, 500, 1, res2) + BHiPass.ar(sig, 1500, res2);

    // Effects
    sig = FreeVerb.ar(sig, mix: verb);
    sig = CombC.ar(sig, 0.3, 0.2, comb * 0.5);
    sig = Fold.ar(sig, 1 + fold);
    sig = Splay.ar(sig) * sply;

    Out.ar(out, sig * mast);
}).play;
)

(
// Instantiate the synth
~pvSynth = Synth(\pv16knob, [\bufnum, b.bufnum]);
)