Forums > MaxMSP

cross fade in MSP

February 17, 2009 | 7:02 pm

I am working on interactive installation using MSP and Jitter and we are trying to generate a cross fade between two separate audio files, the cross fading will be effected by midi sensor input. I have had success in the past with video files using the crossfade in Jitter but I have been unable to duplicate a similar effect with audio.

The desired effect is as the video fades from one to another the audio accompanying the video will cross fade with it in sync.

If anyone has any feedback on how I might begin or if there is a patch or tutorial that would be helpful I would appreciate it.

thank you


February 17, 2009 | 7:44 pm

There are a lot of ways to do this depending on your aptitute, patience, background, etc. Arguably, the easiest way is to use tap.crossfade~ from Tap.Tools (URL should be in the signature).

This will give you a few attributes to control the shape, performance, etc. and is easy to drop in and apply to MSP signals. As an external rather than a patch-based solution it is very efficient.


February 17, 2009 | 8:29 pm

Quote: Timothy Place wrote on Tue, 17 February 2009 14:44
—————————————————-
>Arguably, the easiest way is to use tap.crossfade~ from Tap.Tools
—————————————————-

Arguably being the key word in this sentence. Check out the [!- ] object. Here’s a patch that illustrates its use for cross fading.

#P toggle 108 64 15 0;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 262 542 49 196617 dac~ 1 2;
#P message 221 206 92 196617 0 , 1 3000 0 3000;
#P newex 221 234 32 196617 line~;
#P newex 383 349 36 196617 !-~ 1.;
#P newex 312 399 35 196617 *~ 0.;
#P newex 196 402 35 196617 *~ 1.;
#P newex 262 500 49 196617 *~ 0.8;
#P newex 313 312 49 196617 tri~ 230;
#P newex 195 310 55 196617 saw~ 220;
#P comment 49 48 174 196617 PRESS FOR CROSS FADING ACTION;
#P fasten 7 0 4 1 226 279 286 279 286 370 226 370;
#P fasten 7 0 6 0 226 278 388 278;
#P fasten 10 0 8 0 113 126 226 126;
#P fasten 10 0 9 0 113 531 267 531;
#P connect 3 0 9 0;
#P connect 3 0 9 1;
#P connect 1 0 4 0;
#P connect 6 0 5 1;
#P connect 7 1 8 0;
#P connect 8 0 7 0;
#P connect 2 0 5 0;
#P connect 4 0 3 0;
#P connect 5 0 3 0;
#P window clipboard copycount 11;


February 17, 2009 | 8:57 pm

Agreed. And like with any advice on the list, I would collect all of the responses and then try them:

* which is faster?
* which sounds better?
* does the one which is faster also sound better? (bonus!)
* etc.

best,
Tim

________________________________________________________
Timothy Place
Cycling ’74 | Electrotap

Tap.Tools for Max: http://shop.electrotap.com/taptools


February 17, 2009 | 9:45 pm

On Feb 17, 2009, at 11:02 AM, Rob Trumbour wrote:

> If anyone has any feedback on how I might begin or if there is a
> patch or tutorial that would be helpful I would appreciate it.

At one point I wanted to find a good xfader to replace a placeholder
one that I slapped together. Several years later, I’m still using the
placeholder. It’s designed to hook up to a pair of gain~ faders:

– Pasted Max Patch, click to expand. –

Chris Muir
cbm@well.com

http://www.xfade.com


February 17, 2009 | 9:51 pm

Here’s the abstraction I often use for crossfading. Input is 0-127. Enjoy.

– Pasted Max Patch, click to expand. –

February 17, 2009 | 10:48 pm

Another option is to use the panning engine inside the pan2 example.


February 18, 2009 | 6:59 am

Hi Rob,

I recommend that you read MSP tutorial 22 on panning. Crossfades are
really the same as panning, only difference being that you fade
between two input signals instead of two output signals (left and
right speaker).

So, the patch posted by Kyle will be a linear crossfade, and might
cause a – 3db dip in perceived intensity during the crossfade, while
tap.crossfade~ will also offer equal intensity crossfade. And you’ll
easily be able to wrap your own crossfade patch from the tutorial and
use that. But as of Max5 and the most recent version of tap.tools
tap.crossfade~ takes an argument to set how many channels the sources
have, which is kind of nice. And, tap.tools use 64 bit floats
internally.

When you have the crossfade working, spend a few hours watching a
movie or two, and look at how audio crossfades actually are synced to
images. You will see that audio often crossfades from one cut to the
next prior to or after the image switch or crossfade rather than in
sync. This often gives a more continuous flow to the narrative of
audio and image.

Best,
Trond

On Feb 17, 2009, at 8:02 PM, Rob Trumbour wrote:

>
> I am working on interactive installation using MSP and Jitter and we
> are trying to generate a cross fade between two separate audio
> files, the cross fading will be effected by midi sensor input. I
> have had success in the past with video files using the crossfade in
> Jitter but I have been unable to duplicate a similar effect with
> audio.
>
> The desired effect is as the video fades from one to another the
> audio accompanying the video will cross fade with it in sync.
>
> If anyone has any feedback on how I might begin or if there is a
> patch or tutorial that would be helpful I would appreciate it.
>
> thank you
>


February 18, 2009 | 1:32 pm

By the way, there was also an example in the reverb-example.pat in the Max 4 distribution. There was a cross-fade between wet & dry signals. This section of the patch disappeared in the Max 5 distribution. But as Trond said, it’s the same logic as panning.
J-F.



f.e
February 19, 2009 | 7:12 pm


October 1, 2012 | 10:28 pm

Thanks Holland Hopson, yours is working for me in max6.


October 3, 2012 | 8:39 pm

It is really easy to do that on your own … Crossfading with equal power can be done with the help of a sine/cosine function.

For fading 2 signals you need a float input source reaching from 0 to 1. multiply this input with Pi/2 (we just need half a wave) and the result of the multiplication is used to drive a sine and cosine function. And that result can be use to control the gain of both signal, where one signal gain is controlled by the sine function and the other by our cosine function. At the end you just need to add both signals to one … Your crossfade is ready ..

Simon


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