# Can The Api Be Used To Create Exponential/linear Curves

Is it possible, or does one really have to actually step them out one by one?

Haven`t done this myself but I am sure exponential could be done with a for loop and something like the math.pow standard Lua function

Prints 2 to the power of (i)

``````for i = 1,10 do
print(math.pow(2,i))
end
``````

http://lua-users.org…LibraryTutorial

Ok with dblues maths help from here I had a go at this:

http://www.renoise.c…h-help-scaling/

Gives a log curve. Change to_power_of in first line for different curves:
You need to add the curve manually or with some other code first.

``````
local to_power_of = 20
local input_min = 0
local input_max = math.pow(64,to_power_of)

local output_min = 0
local output_max = 1

for i = 1,64 do
local input = math.pow(i,to_power_of)
local normalised_input = (input - input_min) / (input_max - input_min)
local scaled_output = output_min + (normalised_input * (output_max - output_min))

end

``````

you can also get a straight line by changing to_power_of to 1 (though not the most efficient way)

works wonderfully, and it seems that this can be directly used to write to a volume-automation. unfortunately i suppose the pattern_matrix does not give currtrak + currpatt so that one could actually make a menu_entry into the pattern matrix to make fade-ins and fade-outs for the volume automation…

Not sure myself, you`ll have to check the documentation for this.

ok, identified one problem. It’s hardwired to [1], which is whichever automation was first automated. How would one go about modifying this so that it reads selected_parameter_index? Is there a way to “match by name”?

Maybe:

Lane = nil
for i=1 , #renoise.song().patterns[x].tracks[y].automation
If renoise.song().patterns[x].tracks[y].automation[i].dest_parameter.name == Volume and
renoise.song().patterns[x].tracks[y].automation[i].dest_device.name == TrackVolPan
then Lane = renoise.song().patterns[x].tracks[y].automation[i].dest_parameter.name
else
end

if Lane = nil then create new
else Lane is the automation lane you want to use.

Or do I misunderstand? Assume you’ve found Pattern and Track from Edit Position. Although there may be an easier way…

EDIT: Added DSP Name as well as others may have a parameter called Volume.