# Noob question ... velocity fading script



## damstraversaz (Oct 15, 2010)

Hi
a beginner question:
I found this nice thread on KVR about fading velocity 
http://www.kvraudio.com/forum/viewtopic.php?t=258611
if you want to test it , here is a link
http://damstraversaz.free.fr//midi EQ/MIDI_EQ.zip

unfortunaly, it's a midi vsti , so you must create two midi tracks for each instrument.is it possible to create this with a multiscript ? it could be very useful for orchestral multi , but for sound design too 

thanks a lot for reading my poor english

damien


----------



## kotori (Oct 15, 2010)

Hi damien,

This is something I've thought about doing for a long time. I'm a bit short of time at the moment so I just skimmed through the texts you linked and therefore hope I got it right. Anyway, here's a little instrument script that lets you draw a curve where the horizontal axis corresponds to midi note number and the vertical axis to a percentage with which velocity is scaled.


```
on init
  set_script_title("Note dependant velocity")
  make_perfview
  declare ui_table %compression[128](6, 5, 100)
  declare ui_table %helper[128](6, 1, 1)
  declare $velocity
  declare $i
  $i := 0
  while ($i <= 127)
    %compression[$i] := 100
    inc($i)
  end while
  make_persistent(%compression)  
end on

on note
  $i := 0
  while ($i <= 127)
    %helper[$i] := 0
    inc($i)
  end while
  %helper[$EVENT_NOTE] := 1
  change_velo($EVENT_ID, 1 + ($EVENT_VELOCITY - 1) * %compression[$EVENT_NOTE] / 100)  
end on
```

This lets you determine for each note how much you want to reduce its velocity. Below the main table there is a small helper table displaying the position of the last played note. It's only meant to provide a reference. 
If someone wants to convert this to a multi script, feel free to do so.

/Nils


----------



## damstraversaz (Oct 15, 2010)

ouah, thanks a lot for the answer, and the script !It works perfectly. o-[][]-o 
that's really a useful tool, the table helps a lot

thanks again :D 

damien


----------



## damstraversaz (Oct 16, 2010)

I use it a lot today, and that's a fantastic script, I wasn't believe It could be so useful. it really helps to create so unique or crazy multis.It's amazing to see how a simple thing can change a lot like for mind control for exemple :D , thanks again Nils !


----------



## kotori (Oct 16, 2010)

You're welcome. :D


----------



## kotori (Dec 21, 2010)

I made a http://nilsliberg.se/ksp/scripts/velocity/NoteDependantVelocity_compiled.txt (multi-script update) of this:





The velocity curve is specific to each port/midi channel. You can also specify the note range. 

Cheers,
Nils


----------



## damstraversaz (Dec 21, 2010)

oh, great ! thanks a lot , that 's really an essential script for me, espacially when you create sounds from différents instruments

thanks again !

Damien


----------

