# Ok, script/programing gurus, help teach me



## gmet (Feb 27, 2010)

If you PM me the script I will gladly take a look and advise you further.

I should point out, however, that I don't consider myself a 'Guru'; that crown belongs to Big Bob and Nils.

Regards,

Justin


----------



## MozillaUser (Feb 27, 2010)

Hi KingIdiot 
I'm by no means a progarmming guru, just lurking here and stealing one idea or another from the real gurus.
If I'd be you, I'd try not to use note_off commands for your purpose. Try using "fade_out (active_id, etc, etc) - vhere the first "etc" is the fadeout time, and the last "etc" should be set to 1 - if I remember correctly - to close the voice which is faded out. This should solve your problem, me thinks. CC64 won't be aware at all.

On the other hand... legato in 20 lines of code... come on, my friend. Look, we still don't have a string section legato which sounds any close to the real sound. We have clever portamentos, we have shrewd glissandos, but a real legato is not to be found in any library, no matter the price. I'm trying very hard to do that, with dedicated samples ... but I still didn't completely succeed...and that's in about hundreds of lines.
be well,
Mozil


----------



## KingIdiot (Feb 27, 2010)

Yah the Fade out action is the way to go it seems. Thanks for the help. 

As for legato...

Its an interval legato script.  Using VSL type samples. Its just a super basic group switcher based on the distance of the interval, but also "solo" mode. 

without legato transition samples, it'll never sound close... well maybe with good re-synthesis techniques, but thats out of the scope of sampling (unless you're doing something like sample modeling). All that said, nothing will be the same as a real instrument section playing.. but i you're shrwed and really delve into what you're creating, you can probably come up with something inspiring and realistic "enough"

This is all personal project stuff, to help me grasp the KSP editor better, but not attack building some "super" script yet.

I don't believe in end all "super scripts" anyway, but I do believe in special instrument sample manipulation AND scripting


----------



## MozillaUser (Feb 27, 2010)

So you wanna record each and every possible transition? Good luck! 
Ok, here's some (poor) advice about the logic behind it, the way it looks in my scripts. You should put each group of transitions in a separate group - that is, all "half-tone ups" in one group, all "whole-tone ups" in another group etc. You end up with 24 different groups. Before you start to complicate your life with enabling and disabling groups (which is really a heavy complication, disabling and re-enabling, yikes), why not choosing a controller number which you won't ever use for any other purpose - say, CC 53. In "Group Start Options", set each of those 24 groups start when CC 53 has a different value - that is, say, the "1/2 tone ups" start when CC53 = 65, "the "1 tone ups" start with CC 53 = 66; "1/2 tone down" start with CC 53 = 63, "1-tone down" start with CC 53 = 62 etc. 
Now, in your script, simply substract the old note from the new note, add 64 to the value (to have it centered around 64), set_controller (53, value), wait (1), $new_id := play_note (new note etc), fade_out ($old_id etc) and that'd be all about. 
have fun 
Mozil


----------



## KingIdiot (Feb 27, 2010)

MozillaUser @ Sat Feb 27 said:


> So you wanna record each and every possible transition? Good luck!



thanks I like a challenge... Hi I'm KingIdiot.



> Ok, here's some (poor) advice about the logic behind it, the way it looks in my scripts. You should put each group of transitions in a separate group - that is, all "half-tone ups" in one group, all "whole-tone ups" in another group etc. You end up with 24 different groups. Before you start to complicate your life with enabling and disabling groups (which is really a heavy complication, disabling and re-enabling, yikes), why not choosing a controller number which you won't ever use for any other purpose - say, CC 53. In "Group Start Options", set each of those 24 groups start when CC 53 has a different value - that is, say, the "1/2 tone ups" start when CC53 = 65, "the "1 tone ups" start with CC 53 = 66; "1/2 tone down" start with CC 53 = 63, "1-tone down" start with CC 53 = 62 etc.
> Now, in your script, simply substract the old note from the new note, add 64 to the value (to have it centered around 64), set_controller (53, value), wait (1), $new_id := play_note (new note etc), fade_out ($old_id etc) and that'd be all about.
> have fun
> Mozil





thats pretty much what I have going on, without the CC stuff. Hence the simple amount of code.

I have 25 groups for 12 octaves up and 12 octaves down and "normal" (27 for 13, 31 for 15..etc). The total amount will double for another dynamic layer (if I want to use crossfades), triple for a third..etc. I have basic logic to determine what interval is being played by subtracting the note being played by the note that was played previously. then a little bump in the math to determine the correct interval group based on how many intervals are sampled. Then a group allow for that group. Works fine for what i need it to do right now, which is basic testing of some sample edits I'm doing/have done in the past.

i see the reason for the CC, but it's not needed if you keep the groups in a specific order.

The only thing I was having a problem with is CC64 and how its handled in a On Note callback, and how to figure out the logic loop of turning it on and off within a On Note call back in a legato instrument. (which pretty much seems to be, use the fade out, not the note off command)


----------

