Forums > MaxMSP

Convolution in place of crossfade


VHS
August 29, 2011 | 2:54 am

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?


August 29, 2011 | 4:57 am

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….



yp
August 29, 2011 | 6:56 pm

Do you mean something like this?

hth

– Pasted Max Patch, click to expand. –

August 30, 2011 | 12:18 am

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



VHS
August 30, 2011 | 12:59 am

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…



VHS
August 30, 2011 | 2:44 am

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…



pid
August 30, 2011 | 9:27 am

[sqrt~]



yp
August 30, 2011 | 12:59 pm

@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. –


VHS
August 30, 2011 | 5:48 pm

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…



VHS
August 31, 2011 | 5:20 pm

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.



yp
August 31, 2011 | 8:47 pm

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. –

Viewing 11 posts - 1 through 11 (of 11 total)