# Equal-Power Crossfading Tutorial



## Dynamitec (Dec 12, 2006)

Thank you very very much! What a nice birthday present 

I started to read right now...but it's late here so i'm going trough the files tomorrow!

Thank you again and again! It's great to have people like you around here!

Best wishes!
And take care of yourself - please!


----------



## Big Bob (Dec 12, 2006)

> Thank you very very much! What a nice birthday present



Hey Benj,

Does that mean it's at or near your birthday? If so, let the Big Bob Quartet serenade you.

http://www.andrewkmusic.com/filearea/SI ... rthday.mp3


----------



## Thonex (Dec 12, 2006)

Thanks Bob!!!

I'm going to download this right now and put it on my laptop to read and to let it "sink in".

When I think about it, all your contributions in KSP are so valuable and they are made so easy to implement with Nils' script editor that allows functions and family groups and whatnot. All this stuff is evolving so beautifully.

I can't even imagine what programming KSP would be like without the likes of you, Nils, Dyn, Nickie.... that push the envelope... request new Editor features, and in turn you guys use the new features to build a library that will benefit all of us... then Nil's updates his code to delete unused variables for streamlining the use of something like the math library.... and the cycle continues... it's like a beautiful dance. 

Thanks again,

T

[edit] Just read the ATfade.PDF and am reading the EPXFade.PDF now.... great history lesson and very interesting.... [/edit]


----------



## lee (Dec 13, 2006)

We appretiate your efforts, Big Bob! You´re a blessing to the scripters and users of K2.

Since I dont have programming skills, I´ll pray Nils or someone will write enhanced velocity layer crossfading scripts which we may be able to download. 

please...!

/Johnny


----------



## Dynamitec (Dec 13, 2006)

Hi Bob!

One single question: you often mentioned in the manual that EPX is necessary for formant-correct bending. Could you tell me why and what's differenet between a bending and a formant-correct bending?

Would be very kind!

Btw: Thanks for the mp3  *g* :wink:


----------



## Big Bob (Dec 13, 2006)

> One single question: you often mentioned in the manual that EPX is necessary for formant-correct bending. Could you tell me why and what's differenet between a bending and a formant-correct bending?



Hi Benj,

On formant-corrected bending, first I'll give you the quick summary but if that doesn't 'make it click' please let me know and I'll be glad to supply more detail. I have a propensity to go into too much detail.

You probably already know that you can't pitch shift most sounds by more than a few semi-tones without losing realism. So for example, when you want to synthesize something like a trombone slide glissando over a musical 4th or 5th, and you simply use the pitch bender set to a wide range, it never sounds right. Of course this is the reason we multi-sample instruments every few semitones.

Now, let's say you want to do a convincing trombone glissando from C to F, if you have an instrument that has been multi-sampled at each semi-tone, here's is one way you can accomplish it. Start all the notes at the same time but mute all but C. During the glide upward, we will be dealing with two samples at a time. Tune the muted C# flat by 100 cents so that both the C and C# would sound the same (but as of this point the C# is still muted). Now as you move the glide controller, you start to uptune both the C and C# until you reach the pitch of C#. Simultaneously, you crossfade the C and C# so that as C is fading out, C# is fading in. By the time you reach C#, the C sample is fully muted and the C# sample is at max volume.

At this point you drop the C sample and start working with the D sample tuned -100 cents and you then start raising the pitch of each as you crossfade the C# and D samples, etc. For the crossfade, you need to use EPXF to maintain a uniform volume during the transitions. When done correctly, you can get a very convincing slide effect. As an example, note how nicely the Clarinet 'morphs' into the Trombone in Demo #2.

About a year ago I started a project to implement formant-corrected pitch bending and wrote a script I called the PCE (for pitch control engine). But, the noisy change_vol problem caused me to set that aside while we waited for NI to fix the problem. Little did I know how long that was going to take.  But now that they have done something about the problem, when I get to working on my next script, I intend to utilize this idea to the fullest. If you don't have a copy of my old PCE script let me know and if you'd like I can email it to you (I think the full package is too big to post).

Did I answer your question or did I just ramble too much :lol: ?

God Bless,

Bob

PS Happy 26


----------



## Dynamitec (Dec 13, 2006)

Hi Bob!

Thank you very much! It "clicked"  I don't have the PCE anymore. I had a copy once but i lost it with my old computer (the one that burned a little bit). Would be nice if you could send me the whole package!

Thanks again!


----------



## Big Bob (Dec 14, 2006)

Hi Benjamin,

I emailed the PCE to you yesterday and unless I hear from you to the contrary, I'll assume you got the package.

Bob


----------



## Dynamitec (Dec 14, 2006)

Hi Bob!

Thank you! Sorry, i was home to celebrate birthday with my family. I came home this afternoon. Didn't have the time to check it out yet!

Thanks again!


----------



## Big Bob (Dec 20, 2006)

I'm bumping this up because I updated the download.

I have also completed the Technical Guide and I'll try to post that to a new thread but it may be slightly over the limit for forum attachments. The zipped .pdf is about 141K and I think the forum limit is 128K, but I'll try.

Well, it didn't fly but Andrew aka Thonex graciously agreed to host it so you can go to the new thread and use the link provided to download a copy of this soon to be best seller :wink: 

Bob


----------



## kotori (Dec 30, 2006)

Hi Bob,
I just went through your material. Excellent stuff! Thank you very much.  

Cheers,
Nils


----------



## Big Bob (Dec 30, 2006)

kotori @ Sat Dec 30 said:


> Hi Bob,
> I just went through your material. Excellent stuff! Thank you very much.
> 
> Cheers,
> Nils



Thanks Nils for the feedback. Did the Demo Instrument and such actually work for you? I haven't really gotten any operational feedback on this yet so I don't know if anyone actually went through the tutorial without problems or if everyone just sort of set this aside for future reference.

Has anyone else actually gone through the tutorial? Did everything work as I described in the guide or, do I need to fix something?

God Bless,

Bob


----------



## kotori (Dec 31, 2006)

Big Bob @ Sun Dec 31 said:


> Thanks Nils for the feedback. Did the Demo Instrument and such actually work for you? I haven't really gotten any operational feedback on this yet so I don't know if anyone actually went through the tutorial without problems or if everyone just sort of set this aside for future reference.



Yes, it seemed to work fine here. The only thing I can think of is that you several times refer to the "Range knob", but in the code you do "set_text(Range,'Vol Span')", so it might not be completely clear to everyone before reading the code that you are referring to the Vol Span knob.
As a side note I think I discovered some kind of problem with the compiler when XSinCos(10,sin,cos) is invoked inside 'on init' (this was with a driver script of mine). It seems Ang45 and Ang90 are declared in the wrong order, although this shouldn't be possible. I'll look into this.

Cheers,
Nils


----------



## Big Bob (Dec 31, 2006)

> Yes, it seemed to work fine here. The only thing I can think of is that you several times refer to the "Range knob", but in the code you do "set_text(Range,'Vol Span')", so it might not be completely clear to everyone before reading the code that you are referring to the Vol Span knob.



Good Catch Nils! I think I know what happened. I did the final Panel dressing up stuff after writing all the text. Then when I tried to name the knob 'Vol Range' it didn't fit (at least not very well) so I made an eleventh-hour executive decision :wink: to change 'Range' to 'Span' (which did fit). Unfortunately, I totally forgot to edit the text for the Guide accordingly. :oops: 

So, my apologies everyone. I could try to edit the User's Guide now but I'd probably miss some occurance of it so please think *Span = Range *or *Range = Span *when you read the Guide  



> As a side note I think I discovered some kind of problem with the compiler when XSinCos(10,sin,cos) is invoked inside 'on init' (this was with a driver script of mine). It seems Ang45 and Ang90 are declared in the wrong order, although this shouldn't be possible. I'll look into this.



I don't think that I ever tried to 'call' SinCos or XSinCos from the ICB. This whole business with the ordering of constants seems to be trickier than we first imagined but I really thought you had it nailed. I guess there might still be a few gotchas but hopefully not too many. Please let me know if I can do anything to help with testing and such.

God Bless,

Bob

BTW I'm getting near finishing my report on NCB/RCB inter-script triggering and I hope I'll be able to post it in a week or so. Now that I've organized all the data and have struggled with a way to present it, I'm beginning to think that you were right about bugs versus logical design. Initially, I thought I was beginning to see a logical pattern to what NI did, but, the more I study it now, the more confusing it looks. :o It may turn out to be quite a challenge to even suggest what we'd like to see in the way of a fix (if we could be so lucky as to have NI take an interest) :???:


----------



## Thonex (Dec 31, 2006)

Hi Bob, quick semi-related question....

In your studies have you found the KSP fade_in and fade_out commands to be equal volume if both are set to the same amount and executed at the same time? (I know midi is a serial protocol so it can't "really" be at the same time... but you know what I mean.)

Thanks,

T


----------



## Big Bob (Dec 31, 2006)

Thonex @ Sun Dec 31 said:


> Hi Bob, quick semi-related question....
> 
> In your studies have you found the KSP fade_in and fade_out commands to be equal volume if both are set to the same amount and executed at the same time? (I know midi is a serial protocol so it can't "really" be at the same time... but you know what I mean.)
> 
> ...



Hi Andrew,

I'm not quite sure what you mean by setting fade_in and fade_out to the same amount? Have you read items 13 & 14 in my list of former observations?

http://vi-control.net/forum/viewtopic.php?t=5519

If that doesn't answer the question, could you please clarify a little?

God Bless,

Bob


----------



## Thonex (Dec 31, 2006)

Big Bob @ Sun Dec 31 said:


> Thonex @ Sun Dec 31 said:
> 
> 
> > Hi Bob, quick semi-related question....
> ...



Thanks Bob,

If I understood 13 & 14 correctly, then there is not an equal "power" correlation if assigned an equal fade time.

THanks,

T


----------



## Big Bob (Dec 31, 2006)

> Thanks Bob,
> 
> If I understood 13 & 14 correctly, then there is not an equal "power" correlation if assigned an equal fade time.
> 
> THanks,



If you mean equal attenuation of two separate signals (or a clone of one signal with one fading in and another fading out), after expiration of the time setting, the fade_out signal is near zero (max attenuation) and the fade_in signal is at the max (reference volume) of say 0db. So they are not the same, in fact they are as different as day and night so this obviously isn't what you must be getting at.

Could you be trying to fade-in and fade-out at then stop at the crossover point where the two signals are equal? To do that sort of thing with the fade functions requires that you 'dual-slope' them. For example, you can write something like this:


```
fade_out(evt1,1000000,0)
  wait(500000)
  fade_out(evt1,2000000000,0)
```

This would cause the note to fade out about half way and then pretty much stand still at the level it reached after 0.5 seconds. When we first encountered the change_vol noise problem, I tried to use the fade functions to control levels like this as a workaround but, the problem is that the level hit after a any given fixed period of time is very ill-controlled. It's probably not so much the slope of the fade as it is the latency before it triggers. But, the bottom line is that I decided that a predictable level plateau as a function of fade time was not feasible.

Since you haven't disclosed what you are trying to do, I'm afraid I can't be of much more help, but, Happy New Year anyway.

Bob


----------



## Thonex (Dec 31, 2006)

Big Bob @ Sun Dec 31 said:


> > Since you haven't disclosed what you are trying to do, I'm afraid I can't be of much more help, but, Happy New Year anyway.
> >
> > Bob



Hi Bob,

I didn't have a specific use.... but your x-fade paper got me thinking and wondering if the fade_in and Fade_out commands are "good enough" for rock-'n-roll. I do have a little looping script that uses the fade_in/out command and it sounds ok... but I didn't test it with a sine wave or white noise... if I really wanted to get down to brass-tax, that's what I do and fudge the numbers accordingly.

But your X-Fade paper sounds like a real solution... I look forward to getting more into it when things slow down.

Cheers Bob.... and Happy New Year to you too.
T


----------



## chrodrig (May 24, 2022)

Dynamitec said:


> Hi Bob!
> 
> Thank you very much! It "clicked"  I don't have the PCE anymore. I had a copy once but i lost it with my old computer (the one that burned a little bit). Would be nice if you could send me the whole package!
> 
> Thanks again!


I know this thread is ancient...but is there any change you might still have a copy of this that you'd be willing to share?


----------



## chrodrig (May 24, 2022)

Thonex said:


> Thanks Bob,
> 
> If I understood 13 & 14 correctly, then there is not an equal "power" correlation if assigned an equal fade time.
> 
> ...


Is there any chance this thread is archived somewhere? I tried to click the link but it appears broken.


----------

