XFade2 enables smooth blend between a dry signal and a bandpass-filtered wet signal in a SynthDef
In sound design, often you want to continuously blend between an unfiltered signal and a bandpass-filtered version. XFade2.ar(dry, wet, pan) performs an equal-power crossfade: pan=-1 is full dry, pan=+1 is full wet, pan=0 is a 50/50 mix. By convention, a mix argument in the range 0-1 is mapped to this -1 to +1 range via mix*2-1. A useful detail: narrow BPF filters attenuate amplitude heavily, so compensating the BPF output with 1/rq.sqrt as the mul argument maintains consistent perceived loudness at different filter bandwidths.
Examples
sig = XFade2.ar(sig, BPF.ar(sig, cf, rq, 1/rq.sqrt), bpfmix*2-1);
— bpfmix=0 gives dry; bpfmix=1 gives fully filtered.
Assessment
Why does a narrow BPF (low rq) need amplitude compensation? How does 1/rq.sqrt provide this compensation, and what value does it evaluate to when rq=1?