Convolution in place of crossfade

Aug 29, 2011 at 2:54am

Convolution in place of crossfade

Hello,

I am currently working on a performance piece in which it is very important that one specific sample seamlessly morphs into another. I first considered crossfading from one to the other but it did not achieve the desired effect. What I would like to do instead is to convolve the two samples but rather than just convolving the two and having a third sample with the characteristics of both I’d to be able to control how much of the qualities (amplitude and phase is of course what I’ll be dealing with but let’s say for the sake of simplicity that I’ll only deal with amplitudes) of one sample are present in the other. I would like a knob or slider that when turn all the way one way, would allow the unchanged playback of the first sample, when turned completely the other way would play the other sample unedited but in between would be a sort of crossfade but with convolution instead of volume.
I understand pfft and convolution normally but I can’t figure out the math on this one. Can someone please help?

#58668
Aug 29, 2011 at 4:57am

I think you’ll need to mix your sound sources with a noise sources so there is always something to convolve with (otherwise you’ll be cross-convolving from silence and back to silence again)

so it might be: sourceA*noise -> sourceA*sourceB -> noise*sourceB

where * means convolve

but I’m not sure of the intermediate steps….

#210949
Aug 29, 2011 at 6:56pm

Do you mean something like this?

hth

– Pasted Max Patch, click to expand. –
#210950
Aug 30, 2011 at 12:18am

yp,
I don’t want to preempt VHS, but your patch is the freq domain equivalent of a simple crossfade in the time domain…. (except it has independent control of magnitude and phase). The two sources don’t actually convolve with each other. If I get a chance I’ll try and tackle it too…

cheers
T

#210951
Aug 30, 2011 at 12:59am

Thanks yp. As Terry has said it is still a crossfade (though it is nice that i can change which phase info I am using which does give somewhere near the effect I would like) albeit a souped-up on. The reason I put this on the forum is because it is extremely difficult to do this while actually multiplying the two signals. What i believe we need here is a some sort of msp equivalent of “scale” that would offer a sort of non-linear response such that when the fader/dial was turned half way, the two signals would fully convolved. I’m not sure how the math would work out since that amp of the fully convolved two signals would rarely be exactly the average of the two respective signals’ (of each sine wave of course) amplitudes and the those three numbers would always be changing in a non linear way…

This is a bit of a conundrum…

#210952
Aug 30, 2011 at 2:44am

Ok, I downloaded scale~. That is the object i need but how to i make sure that when the dial/fader is halfway that the output is at the product of the two amplitudes?
ah, math…

#210953
Aug 30, 2011 at 9:27am

[sqrt~]

#210954
Aug 30, 2011 at 12:59pm

@Terry & VHS: thanks for pointing that out.

here’s a second attempt :)
using an adaption of the cnmat scale~, each bin is interpolated between the original signal and the convolved signal.
I didn’t comment the math in the subpatches, but it’s just the scale~ expressions done with msp objects.

– Pasted Max Patch, click to expand. –
#210955
Aug 30, 2011 at 5:48pm

Great. this is pretty much what I need except for some reason when I put both the phase and amp in the middle, the whole thing starts clipping which should be impossible if it is truly convolving since both amplitudes are less than 1 so if they are multiplied with each other they should also be less than one (in fact, less than either of the two amplitudes…). My attempts have ended exactly the same way…

#210956
Aug 31, 2011 at 5:20pm

As it turns out, that was just a problem with noise in the tracks I was using.

Thank you very much for this patch. It’s a huge help.

#210957
Aug 31, 2011 at 8:47pm

I’m glad it worked out. By the way, you might have noticed that when you send the crossfade value of exactly 0. you get silence instead of full convolution. This is due to the nature of the slide4~ subpatches. There is probably a more elegant solution, but here’s a dirty workaround. You should replace the corresponding objects in the pfft subpatch.

cheers,
yp

– Pasted Max Patch, click to expand. –
#210958

You must be logged in to reply to this topic.