Re: [PD] Equal-power crossfade?

2012-02-06 Thread Frank Barknecht
Hi,

On Mon, Feb 06, 2012 at 02:22:34PM +0100, Pierre Massat wrote:
 I need a simple equal-power crossfade between two signals. I asked the same
 question a few years ago, but i just can't remember how to do it...

This is used in rj's e_pan.pd:

left = cos(p) * signal
right = sin(p) * signal

where p is in radians from 0 to PI/2 (i.e. multiply your 0...1 panning by 
1.5708...)

Ciao
-- 
 Frank BarknechtDo You RjDj.me?  _ __footils.org__

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Equal-power crossfade?

2012-02-06 Thread Pierre Massat
Thanks Frank!

Pierre

2012/2/6 Frank Barknecht f...@footils.org

 Hi,

 On Mon, Feb 06, 2012 at 02:22:34PM +0100, Pierre Massat wrote:
  I need a simple equal-power crossfade between two signals. I asked the
 same
  question a few years ago, but i just can't remember how to do it...

 This is used in rj's e_pan.pd:

 left = cos(p) * signal
 right = sin(p) * signal

 where p is in radians from 0 to PI/2 (i.e. multiply your 0...1 panning by
 1.5708...)

 Ciao
 --
  Frank BarknechtDo You RjDj.me?  _ __footils.org__

 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management -
 http://lists.puredata.info/listinfo/pd-list

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Equal-power crossfade?

2012-02-06 Thread Jaime Oliver
Here's an argument for plain linear crossfade.
I get power boosts with cosine crossfades...

best,

J

On Mon, Feb 6, 2012 at 8:53 AM, Pierre Massat pimas...@gmail.com wrote:
 Thanks Frank!

 Pierre


 2012/2/6 Frank Barknecht f...@footils.org

 Hi,

 On Mon, Feb 06, 2012 at 02:22:34PM +0100, Pierre Massat wrote:
  I need a simple equal-power crossfade between two signals. I asked the
  same
  question a few years ago, but i just can't remember how to do it...

 This is used in rj's e_pan.pd:

 left = cos(p) * signal
 right = sin(p) * signal

 where p is in radians from 0 to PI/2 (i.e. multiply your 0...1 panning by
 1.5708...)

 Ciao
 --
  Frank Barknecht            Do You RjDj.me?          _ __footils.org__

 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management -
 http://lists.puredata.info/listinfo/pd-list



 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management -
 http://lists.puredata.info/listinfo/pd-list




-- 
Jaime E Oliver LR

jo2...@columbia.edu
www.jaimeoliver.pe
858 750 0924 (cel)


linear-cross.pd
Description: Binary data
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Equal-power crossfade?

2012-02-06 Thread Hans-Christoph Steiner

There are some pan algorithms in the 'pan' library also, included in 
Pd-extended.  They're all pd abstractions.

.hc

On Feb 6, 2012, at 9:29 AM, Jaime Oliver wrote:

 Here's an argument for plain linear crossfade.
 I get power boosts with cosine crossfades...
 
 best,
 
 J
 
 On Mon, Feb 6, 2012 at 8:53 AM, Pierre Massat pimas...@gmail.com wrote:
 Thanks Frank!
 
 Pierre
 
 
 2012/2/6 Frank Barknecht f...@footils.org
 
 Hi,
 
 On Mon, Feb 06, 2012 at 02:22:34PM +0100, Pierre Massat wrote:
 I need a simple equal-power crossfade between two signals. I asked the
 same
 question a few years ago, but i just can't remember how to do it...
 
 This is used in rj's e_pan.pd:
 
 left = cos(p) * signal
 right = sin(p) * signal
 
 where p is in radians from 0 to PI/2 (i.e. multiply your 0...1 panning by
 1.5708...)
 
 Ciao
 --
  Frank BarknechtDo You RjDj.me?  _ __footils.org__
 
 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management -
 http://lists.puredata.info/listinfo/pd-list
 
 
 
 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management -
 http://lists.puredata.info/listinfo/pd-list
 
 
 
 
 -- 
 Jaime E Oliver LR
 
 jo2...@columbia.edu
 www.jaimeoliver.pe
 858 750 0924 (cel)
 linear-cross.pd___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management - 
 http://lists.puredata.info/listinfo/pd-list







'You people have such restrictive dress for women,’ she said, hobbling away in 
three inch heels and panty hose to finish out another pink-collar temp pool 
day.  - “Hijab Scene #2, by Mohja Kahf



___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Equal-power crossfade?

2012-02-06 Thread Ludwig Maes
Make sure to use the interval 0 - Pi/2, panning beyond will only
crossfade back and forth

On 6 February 2012 15:29, Jaime Oliver jaime.oliv...@gmail.com wrote:
 Here's an argument for plain linear crossfade.
 I get power boosts with cosine crossfades...

 best,

 J

 On Mon, Feb 6, 2012 at 8:53 AM, Pierre Massat pimas...@gmail.com wrote:
 Thanks Frank!

 Pierre


 2012/2/6 Frank Barknecht f...@footils.org

 Hi,

 On Mon, Feb 06, 2012 at 02:22:34PM +0100, Pierre Massat wrote:
  I need a simple equal-power crossfade between two signals. I asked the
  same
  question a few years ago, but i just can't remember how to do it...

 This is used in rj's e_pan.pd:

 left = cos(p) * signal
 right = sin(p) * signal

 where p is in radians from 0 to PI/2 (i.e. multiply your 0...1 panning by
 1.5708...)

 Ciao
 --
  Frank Barknecht            Do You RjDj.me?          _ __footils.org__

 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management -
 http://lists.puredata.info/listinfo/pd-list



 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management -
 http://lists.puredata.info/listinfo/pd-list




 --
 Jaime E Oliver LR

 jo2...@columbia.edu
 www.jaimeoliver.pe
 858 750 0924 (cel)

 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management - 
 http://lists.puredata.info/listinfo/pd-list


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Equal-power crossfade?

2012-02-06 Thread Frank Barknecht
On Mon, Feb 06, 2012 at 02:42:01PM +0100, Frank Barknecht wrote:
 Hi,
 
 On Mon, Feb 06, 2012 at 02:22:34PM +0100, Pierre Massat wrote:
  I need a simple equal-power crossfade between two signals. I asked the same
  question a few years ago, but i just can't remember how to do it...
 
 This is used in rj's e_pan.pd:
 
 left = cos(p) * signal
 right = sin(p) * signal
 
 where p is in radians from 0 to PI/2 (i.e. multiply your 0...1 panning by 
 1.5708...)

Oh, well, actually you were looking for crossfade, not panning. It's basically
the same idea, though. In the rj library you could use [c_cpxfade]. The
helpfile for this compares it with the linear [c_xfade] which has the hole in
the middle.

Ciao
-- 
 Frank BarknechtDo You RjDj.me?  _ __footils.org__

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Equal-power crossfade?

2012-02-06 Thread Frank Barknecht
On Mon, Feb 06, 2012 at 09:29:33AM -0500, Jaime Oliver wrote:
 Here's an argument for plain linear crossfade.
 I get power boosts with cosine crossfades...

Your example is a bit broken (there is no panning going on at all), but I get
the same result with a the fixed version or with [e_pan] in
the rj library when adding left and right signal together and taking the RMS.

The boost in the center is to be expected: In the center with CP-panning,
left and right channels both are multiplied by about 0.707 instead of 0.5 with
a linear pan, so adding them together will make the center louder.
Perception-wise this results in the signal appearing nearer to you than with
linear panning, which is the reason this is used: With CP-panning the signal 
will
appear to move around you in a constant circle whereas with linear panning it 
will 
move farther away from you as it gets to the center, it will move as if on an 
oval.

Avoiding this kind of movement is the motivation for CP-panning.

Ciao
-- 
 Frank BarknechtDo You RjDj.me?  _ __footils.org__

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Equal-power crossfade?

2012-02-06 Thread Scott Nordlund

 Here's an argument for plain linear crossfade.
 I get power boosts with cosine crossfades...
 
 best,
 
 J

You'll want to use linear crossfades for correlated signals (similar spectrum 
and same phase), cosine for non-correlated signals (noise, different 
frequencies, arbitrary phase, etc.). Of course for similar signals with 
arbitrary phase, there's no guarantee that the output will really be constant 
power, since you could get cancellations or reinforcements. But unless you know 
in advance that the phases are correlated, it's best to use a cosine crossfade.
Incidentally I'm working on a frequency domain algorithm that forces mixed 
signals to be correlated and in phase, by summing their magnitudes. But it's no 
magic trick since it does this by inducing a time varying phase shift. This 
isn't the silver bullet that you might be hoping for, but I think it should 
make a neat variation of the usual chorus effect.   
   
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Equal-power crossfade?

2012-02-06 Thread Jaime Oliver
 Your example is a bit broken (there is no panning going on at all),

you're right. ... coffee excuse ...
here is a fixed version in case someone is interested.

the subject of the e-mail however, does not ask to pan, but to
crossfade without loosing or adding power.
What the example shows is a linear crossfade where the RMS remains
constant during the crossfade.

best,

J



-- 
Jaime E Oliver LR

jo2...@columbia.edu
www.jaimeoliver.pe
858 750 0924 (cel)


linear-cross.pd
Description: Binary data
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Equal-power crossfade?

2012-02-06 Thread Frank Barknecht
On Mon, Feb 06, 2012 at 10:15:51AM -0800, Jaime Oliver wrote:
  Your example is a bit broken (there is no panning going on at all),
 
 you're right. ... coffee excuse ...
 here is a fixed version in case someone is interested.
 
 the subject of the e-mail however, does not ask to pan, but to
 crossfade without loosing or adding power.

Yeah, I confused that right from the start ... missing-coffee-excuse ...

 What the example shows is a linear crossfade where the RMS remains
 constant during the crossfade.

This has its roots indeed in the use of fading identical signal(s). If you use
different input sounds, the CP-fade gives nicer results. Attached is an example
that uses the linear/cp crossfades from the rj-library as subpatches and fades
two different signals and then the same signal twice.

Ciao
-- 
 Frank BarknechtDo You RjDj.me?  _ __footils.org__


crossfade-compare.pd
Description: application/puredata
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Equal-power crossfade?

2012-02-06 Thread Pierre Massat
All very interesting stuff, thanks! I didn't need anything too special so
i've adapted Hans' equal-power pan (I've turned it upside down to make a
crossfader). I only needed it for the ring modulator patch i've just posted
on my blog (
http://guitarextended.wordpress.com/2012/02/06/ring-modulator-effect-using-pure-data/
)

Cheers!

Pierre

2012/2/6 Frank Barknecht f...@footils.org

 On Mon, Feb 06, 2012 at 10:15:51AM -0800, Jaime Oliver wrote:
   Your example is a bit broken (there is no panning going on at all),
 
  you're right. ... coffee excuse ...
  here is a fixed version in case someone is interested.
 
  the subject of the e-mail however, does not ask to pan, but to
  crossfade without loosing or adding power.

 Yeah, I confused that right from the start ... missing-coffee-excuse ...

  What the example shows is a linear crossfade where the RMS remains
  constant during the crossfade.

 This has its roots indeed in the use of fading identical signal(s). If you
 use
 different input sounds, the CP-fade gives nicer results. Attached is an
 example
 that uses the linear/cp crossfades from the rj-library as subpatches and
 fades
 two different signals and then the same signal twice.

 Ciao
 --
  Frank BarknechtDo You RjDj.me?  _ __footils.org__

 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management -
 http://lists.puredata.info/listinfo/pd-list


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Equal-power crossfade?

2012-02-06 Thread Mathieu Bouchard

Le 2012-02-06 à 14:42:00, Frank Barknecht a écrit :

On Mon, Feb 06, 2012 at 02:22:34PM +0100, Pierre Massat wrote:

I need a simple equal-power crossfade between two signals. I asked the same
question a few years ago, but i just can't remember how to do it...

This is used in rj's e_pan.pd:

left = cos(p) * signal
right = sin(p) * signal

where p is in radians from 0 to PI/2 (i.e. multiply your 0...1 panning by 
1.5708...)


That's for panning, not for crossfading.

crossfading is similar, but is the other way around :

signal = left * cos(p) + right * sin(p)

But if left=-right (opposite phase) then the crossfade will quickly fade 
out to silence and back in ;


and if left=right, then your power gain will be (cos(p)+sin(p))² = 
cos²(p)+2sin(p)cos(p)+sin²(p) = 1+2sin(p)cos(p) = 1+sin(2p). This goes up 
to double power (amplitude is multiplied by 1,414).


Generally speaking, as long as L and R don't have frequencies in common, 
this works perfectly, but as soon as they do, you have to do proper phase 
addition : the cosines are added separately from the sines : if you know a 
sinusoïd by its amplitude and phase offset, convert to cartesian before 
adding... this will show you how such things add up.


 __
| Mathieu BOUCHARD - téléphone : +1.514.383.3801 - Montréal, QC___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Equal-power crossfade?

2012-02-06 Thread Mathieu Bouchard

Le 2012-02-06 à 13:13:00, Scott Nordlund a écrit :

Incidentally I'm working on a frequency domain algorithm that forces 
mixed signals to be correlated and in phase, by summing their 
magnitudes. But it's no magic trick since it does this by inducing a 
time varying phase shift. This isn't the silver bullet that you might be 
hoping for, but I think it should make a neat variation of the usual 
chorus effect.


This means you do FFT, then convert to polar, then do linear crossfade in 
the shortest of the two paths ? (so that the phase shift is always between 
-π and +π)


If you do it quickly, it becomes a pitch shift, but if not panning too 
fast, it shouldn't be a problem.


 __
| Mathieu BOUCHARD - téléphone : +1.514.383.3801 - Montréal, QC___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] Equal-power crossfade?

2012-02-06 Thread Scott Nordlund

 Le 2012-02-06 à 13:13:00, Scott Nordlund a écrit :

  Incidentally I'm working on a frequency domain algorithm that forces
  mixed signals to be correlated and in phase, by summing their
  magnitudes. But it's no magic trick since it does this by inducing a
  time varying phase shift. This isn't the silver bullet that you might be
  hoping for, but I think it should make a neat variation of the usual
  chorus effect.

 This means you do FFT, then convert to polar, then do linear crossfade in
 the shortest of the two paths ? (so that the phase shift is always between
 -π and +π)

 If you do it quickly, it becomes a pitch shift, but if not panning too
 fast, it shouldn't be a problem. 

It's not specifically intended for a crossfader (though it could easily be used 
that way), just summing in general. It's a typical weighted-overlap-add FFT 
thing. The magnitude of the output is the sum of the input magnitudes (so 
they're effectively always in phase and never cancel). The phase can be a 
number of things: the phase of the sum of the inputs (i.e. the phase of the 
usual vector sum), or the phase of the input with the largest magnitude (per 
bin), or either of those but constrained to be within a certain range with 
respect to one of the inputs... or something like that. I haven't had a lot of 
time to mess with it, but it's been in the back of my mind as a generally neat 
idea.   
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list