### Curves & math

On 18 Jun 2006, at 09:35, f.e wrote:

> samps[i] = samps[i]*(Type.toFloat(i)/fadeTimeL);

I’m not sure I understand this: you’re dividing all the sample

amplitudes by something called "fadeTimeL". Is that what you intend?

What exactly is it that you’re trying to achieve? Periodicity? One-

shot fades?

— N.

nick rothwell — composition, systems, performance — http://

http://www.cassiel.com

Doesn’t matter, but for the records : in a "for i=0 to

loop, i’m multiplying

length>.

What i do is a linear fade in (in this case). Perfectly working (great

live looping tool). But i wonder what are the ways to do other fades

curve. And it’s always the time i remember maybe i shouldn’t have spent

my math classes playing pinball.

cheers

f.e

On 18 Jun 2006, at 17:18, f.e wrote:

> but for the records : in a "for i=0 to

> multiplying

Makes sense (although to be finicky, it should probably be fade

length – 1).

> But i wonder what are the ways to do other fades curve.

I tend to do this kind of thing as a normalisation (which you’re

doing, I guess: fade goes from 1.0 to 0.0) then just pass the value

through a function providing the fade curve. (I can’t remember

offhand what an equal-power curve looks like, for instance – just a

bit of sine/cosine as I recall, so map your 0.0..1.0 into 0.0..pi/2

radians.)

— N.

nick rothwell — composition, systems, performance — http://

http://www.cassiel.com

That’s precisely what you don’t remember that i need. If you get a hand

on this, don’t forget to drop a mail.

cheers

f.e

maybe the msp examples on spatialization can help?

-thijs

hi fe,

i would suggest to scale your fade values between 0 and 1 (or 1 to 0

for fade out) and raise to a desired exponent.

an exponent of 1 would give you a linear fade.

an exponent smaller than 1 will give you a faster fade in (slowing

down) – useful for crossfades.

an exponent bigger than 1 will give you a slower fade in (which is

"accelerating") – useful for fade in/out.

for sinusoidal fades scale your values between 0 and pi/2 and take

sine or cosine resp.

and there are a lot more, i guess.

hth,

volker.

Forums > Java