# Velocity curve perfview



## jesusginard (Jul 1, 2013)

I've searched it in this forum and haven't found it, sorry if it has been already asked and answered. 

I've seen a cool and useful feature on some libraries that is modifying the velocity curve right in the GUI, how is it scripted? I've also seen that the actual line that displays the curve is also drawn in the interface, is that a custom table element?


----------



## Lindon (Jul 3, 2013)

Pretty simple really. 


```
on init
    declare ui_table %velocity_mapper[128](10,2,128)
    {the user can draw in the above table...}
end on

on note
    ignore_event($EVENT_ID)
    play_note($EVENT_NOTE,%velocity_mapper[$EVENT_NOTE],0,-1)
end on
```


----------



## jesusginard (Jul 8, 2013)

This is controlling the velocity of each key separetly. Every slot in the table is a note now, and every slot should be a velocity. 
Is there an easy way to: 
- Create a perfect ramp automatically that controls the velocity of all incoming events. 
- Create a knob that controls all the bars by incrementind/decrementing them all at once?
I've been thinking about it and I can't get a solution. Any help is appreciated.

EDIT: 

I think I've done the first point: 

```
on init
	declare ui_table %velocities[128](10,2,128)
	declare $i
	$i := 0
end on

on note
	while($i <= 127)
		%velocities[$i] := $i + 1
		inc($i)
	end while

	ignore_event($EVENT_ID)
	play_note($EVENT_NOTE,%velocities[$EVENT_VELOCITY],0,-1)
end on
```


----------



## Big Bob (Jul 8, 2013)

I think Lindon meant to write EVENT_VELOCITY instead of EVENT_NOTE



```
play_note($EVENT_NOTE,%velocity_mapper[$EVENT_VELOCITY],0,-1)
```

But, it looks like you've already worked that out.



> - Create a perfect ramp automatically that controls the velocity of all incoming events.



I'm not at all sure what you are asking for here. Lindon's (modified) code *does* map the velocity of *all* incoming note events so are you saying you want to map non-note events as well? And what would the sense of that be?



> - Create a knob that controls all the bars by incrementind/decrementing them all at once?



You had better amplify what you mean by this also, after clarifying the 2nd item :lol: 

Rejoice,

Bob


----------



## Raptor4 (Jul 8, 2013)

jesusginard @ Mon Jul 08 said:


> Is there an easy way to:
> - Create a perfect ramp automatically that controls the velocity of all incoming events.
> - Create a knob that controls all the bars by incrementind/decrementing them all at once?
> I've been thinking about it and I can't get a solution. Any help is appreciated.



Hi,
As a whole you will need some math here... As an example it is a good idea to open the Multi script and load the Factory ->Transform->Change Velocity preset. Pay an attention on math code lines which do the job (related to the Curve Knob & Linear. Shelf etc menu parameters).
Regards,
R4
_____________________
www.audiogrocery.com


----------



## paoling (Jul 8, 2013)

Take a look at this thread, it's quite old, but I still use this method for controlling velocity curves.

This was taken from a little study on bezier curves.

http://www.vi-control.net/forum/viewtop ... ght=bezier

(copy and paste from the second post)


----------



## Lindon (Jul 9, 2013)

Nope I meant to write $EVENT_NOTE, 'cause I thought the problem was setting specific velocities for each note - silly me. Clearly using $EVENT_VELOCITY sets the output velocity for all notes to a specific velocity curve (all notes respond the same), but as Bob says it seems you worked that out. 

A knob that increments/decrements all values?

Well I didn't use a knob for this when I needed it, I used an up and a down button, and in the UCB simply went through the table incrementing/decrementing values by 1.

Seemed to work OK.


----------



## jesusginard (Jul 14, 2013)

Thank you guys, I finally got it working!


----------



## Big Bob (Jul 14, 2013)

Hi Guys,

The other day I was toying with some ideas for combinining a Bezier curve with a ui_table so that one could adjust the overall shape of the curve graphically with the mouse. Instead of using knobs or sliders to shape the curve and/or trying to draw the curve bar by bar (by dragging), you would be able to just drag on the curve itself and the shape of the curve would follow smoothly. However, I'm not sure the table re-draw machinery is fast enough to support this without spending more time to investigate.

Of course the modulation-scaling tables in Kontakt already provide something akin to a Bezier curve to facilitate drawing those tables smoothly. However, I'm thinking about a scripted, 'perfview table' done with an ordinary ui_table (per the orignal poster). 

I'm trying to get a feel for what level of interest there might be in something like this. Feedback pro or con would be appreciated.

Rejoice,

Bob


----------



## jesusginard (Jul 19, 2013)

I think that it's a good idea, at least I would like to try that! 

Pros: 
something that has never been done -> always good.

Cons: 
the only difference with doing it with a slider/knob is where you click.


----------



## Big Bob (Jul 19, 2013)

> I think that it's a good idea, at least I would like to try that!



I'm just about done with a prototype script for this but I will probably start a new thread with a demo instrument to see what kind of interest there is. So, watch for it.



> Pros:
> something that has never been done -> always good.



I don't know about it never having been done (seems unlikely) :roll: 



> Cons:
> the only difference with doing it with a slider/knob is where you click.



Oh sure, you can drag a knob just as easily as dragging the curve but, I think it might be more intuitive to be able to go 'straight to the horse's mouth' :lol: 

Rejoice,

Bob


----------



## Raptor4 (Jul 19, 2013)

Big Bob @ Fri Jul 19 said:


> I think it might be more intuitive to be able to go 'straight to the horse's mouth'



+1
I love your idea Bob - it's great. I'll be happy to put my hands on your innovation :D .

God Bless,
R4
____________________
www.audiogrocery.com


----------

