Volume drop when mixing signals with ntrpol

I’ve got a very simple delay effect based on Iain McCurdy’s code:

kmain_delay_time = chnget:k("main_delay_time")
kdelay_mix = chnget:k(SDelayMixChannel)
abufferl delayr	5
adelsigl deltap	kmain_delay_time
delayw asigl
abufferr delayr	5
adelsigr deltap	kmain_delay_time
delayw asigr
asigl ntrpol asigl, adelsigl, kdelay_mix
asigr ntrpol asigr, adelsigr, kdelay_mix

You can test it out here by playing a sample, clicking the “Delay” button, adjusting the dry/wet mix slider next to it, and adjusting the delay time on the right. There’s a big volume drop when you move the dry/wet slider to the middle. I know that pan2 overcomes this volume drop by offering different algorithms for mixing the two signals. ntrpol doesn’t offer different algorithms though. Can you all recommend some strategies for reducing the volume drop when mixing the dry/wet mix of signals?

Thanks!
Jason

Perhaps you can just roll your own ntrpol UDO that will add some compensation for those 50/50 settings? I might be way off here, but you could fill a table with a bell like curve and then use the kdelay_mix var to read through it.

At the mid point it will increase the amplitude accordingly. And you can add controls for the amount of gain applied. Of course, there may be much simpler way to achieve this!

Thanks, Rory! I followed your lead and then found Iain McCurdy’s code in this Cabbage Forum post which shows how to implement what you suggested. Here’s a solution that balances out the amplitude across the mix slider much better:

gishape_halfsine ftgen 101,0,4097,9,0.5,1,0	
asigl = asigl*tablei:k((kdelay_mix + 1) *0.5 , gishape_halfsine, 1) + adelsigl*tablei:k((kdelay_mix) *0.5 , gishape_halfsine, 1)
asigr = asigr*tablei:k((kdelay_mix + 1) *0.5 , gishape_halfsine, 1) + adelsigr*tablei:k((kdelay_mix) *0.5 , gishape_halfsine, 1)

Ah yes, you find amazing things over on the Cabbage forum. It truly is a place of wonder! :rofl: