# Possible to get a Kontakt patch to auto dimuendo?



## RiffWraith (Jul 29, 2008)

Looking to see if there are any scripts - or if it is possible to make one - that will automatically dimuendo a specific note when applied? It's complicated, because it has to dim. at varying intervals - if you are at 60bpm, and have a half note you want to dim. naturally, and the next note is a whole note that you also want to dim., the script would have to know to start the dim. on the whole note later in time than on the half note. Not the script needs to know the difference from whole notes to half notes to whatever, but it does need to know when to start. Maybe there is a way to trigger the script at varying points?

HERE is a short .mp3 example of what I am looking to achieve. See how both notes dim., but the second dim.'s later because the note is longer? The example was done with automation; if a script can do this, alot of time can be saved.

Ideas?

Mucho thanks in advance.


----------



## Thonex (Jul 29, 2008)

Hi RW,

The diminuendo part based on tempo and duration is a fairly easy script to write, except that it is impossible for Kontakt to know whether you are playing a whole, half, 1/4, 1/8th etc not until you released the note. So, therefore, A more practical approach may be to "tell" the script what the duration of the note is... by either:

a) playing a key switch of predetermined keys equaling note values
b) via CC and the CC range would be split up to whole all the way to (say) 1/8th note.
c) having a drop down menu on the script that lets you select the note value.

I tend to like a or b.

Anyway... it can be done fairly easily with a command called "fade_out ()".

I'm getting ready to leave town for a week so maybe someone else can jump in....

Cheers,

AK


----------



## RiffWraith (Jul 30, 2008)

Hey T,

Thanks for the response.

a) I never use kswitches
b) seems practical
c) yeah - but select for each note? nah....lol

"fade_out ()" - ok, great. But this is coming from someone (me) who has no clue whatsoever how to write a script. 

Ideas? :D


----------



## gmet (Jul 31, 2008)

OK - had a go at this. The problem is that 'fade-out' fades to nothing so I have had to introduce a second identical note to enable fading to a specific vol (%).

So you have:
sustain - sustain time in ms before diminuendo
dim - diminuendo time in ms
end_vol - end volume as a percentage of start volume

You could now add #CC's to control this or some sort of time function.

Justin

p.s. nice cues on your site - are the CG competition videos from a specific site?


----------



## RiffWraith (Jul 31, 2008)

Cool - thanks!

Couple of things - 

I get "errror line 3 - 'end on' expected"

And as far as adding #CC's to control this - how?

Cheers.


----------



## gmet (Jul 31, 2008)

OK - you have to be careful to remove the ' character when copying from BBCode. Here it is again with the characters removed and CC's added (just change them to whatever you desire):

Justin
p.s. it is also attached as an NKP (zipped)


----------



## gmet (Jul 31, 2008)

Took this a step further so you can have dim, dim + cresc, cresc, cresc + dim.

So the script can do: pfp, fpf, fp, pf etc. Also with a bit of tweaking of the dials you should be able to emulate sfzp.

N.B.
Note On Velocity = Loudest part of cresc/dim
Low Vol % = Quietest part of cresc/dim

Justin

This is now hosted on http://scoringfilm.wordpress.com/ (my blog).


----------



## Thonex (Aug 1, 2008)

Wow Justin,

I'm checking in from Ohio and I see you really "went to town" on this script!!! :D 

I can't test it out here but it looks really cool.

Just glancing over your script, did you implement note duration based on musical durations (whole, half, 1/4, 1/8th) ? Or did you decide to just use time based values (ms)?

Cheers,

T


----------



## gmet (Aug 1, 2008)

Cheers Andrew,

It is purely based on time in ms as I never use the tempo function in Kontakt. It was quite bizarre that the script engine didn't recognise fading out the $EVENT_ID unless it had a wait command before it. In the latter cases it was told to wait for a time of zero and suddenly the fade out worked - another Kontakt script anomaly.

Justin


----------



## RiffWraith (Aug 1, 2008)

"OK - you have to be careful to remove the ' character when copying from BBCode"

AHA! :lol:

Ok, first off, you deserve a tip of the hat, and a very big thank you for your efforts.

I have tried the first script (will try the second later) and it works. o-[][]-o 

However, the dim is always the same - the same distance from the note start point. So if you have an 8th note dim that sounds fine, and the next note is a whole note, that whole note will dim to soon. Possible to somehow trigger different note lengths to have different dim times - let's say, by inserting CC info into the MIDI track that the script will respond to?

Or is that just asking too much?

Thanks a bunch again!


----------



## gmet (Aug 1, 2008)

If you look below each dial there is a box with CC numbers - choose the CC numbers that suits you. You can then enter into the midi file for example; CC115,100 (sus time before dim), then CC116,100 (dim time) etc etc.

If you want it based on tempo there is a slight problem as I don't know enough about this to implement it. It would however have to be based on bpm not half note/whole note as these will change legnth at different tempos. As 'T' says the above CC method is probably the best - once you have played around you will find your best settings for each note legnth.

My time based method will always be one beat late as it would be based on engine uptime in ms (Kontakt cannot mind read how long a note will be before it is finished)

Hopefully someone with more knowledge will chime in.

Justin


----------



## luigiv (Aug 1, 2008)

Justin M,

your script is wonderful!
Would be posible diferents curves of dim. or cresc.? (linear, exponential, etc.)

...Luis


----------



## Thonex (Aug 1, 2008)

luigiv @ Fri Aug 01 said:


> Justin M,
> 
> your script is wonderful!
> Would be posible diferents curves of dim. or cresc.? (linear, exponential, etc.)
> ...



:lol: 

That makes things a "little" more complicated. 

But nice request. :D


----------



## gmet (Aug 2, 2008)

Luis - I'm sure it is theoretically possible to get different curves, however I wouldn't have a clue where to start!!

Justin


----------



## Thonex (Aug 2, 2008)

Justin M @ Sat Aug 02 said:


> Luis - I'm sure it is theoretically possible to get different curves, however I wouldn't have a clue where to start!!
> 
> Justin



Well, I think it could be done using a table that the end user could draw their own curve, and then the script would have to take that table info (1-127) and adapt it to KSP numbers (1-1000000) and then use change_vol statements in a 'while loop' perhaps with some interpolation algorithm to smooth out the 127 steps and 'wait()' statements to make the duration correct.

But I've always found it easier and more natural sounding to just use CC11 or CC1 and ride the fader to give me the performance I need. :wink:


----------

