Lfo Lpc ? How To Write Full Number

like let’s say LPC32, i want the LFO to reset itself every 32 rows. how do i tell it 32? sure, renoise.song().selected_track.devices[2].parameters[6].value_string=“32” will write 32LPC to LFO, but I can’t just replace “32” with countednumber because the number is not a string. so how do i replace =“32” with something which will eat a calculation?

Are I correct in thinking that you just want to convert a number to a string?

  
tonumber('32') will give the number 32  
  
tostring(32) will give the string '32'  
  

Also LPC = LPB?

hmm… ?
tried but no avail:

  
local gapper=nil  
gapper=32  
tostring(gapper)  
print (gapper)  
  
renoise.song().selected_track.devices[2].parameters[6].value_string="gapper"  
  

tried with “gapper” and gapper.

p.s, no, LPC isn’t LPB, LPC is the bottom parameter in *Lfo … Frequency (( – )) 64.00LPC

it eats value_string=“512” for instance, but i cannot just type a local into it.

This is unnecessary. Just do: local gapper = 32

This will do nothing. The tostring() function does not actually transform the local variable into a string, it returns a new string based on the number you passed into it. So in order to actually use the string, you must assign it to a variable or pass the result directly into another function that expects a string.

This will work:

local gapper_string = tostring(gapper)  
renoise.song().selected_track.devices[2].parameters[6].value_string = gapper_string  

Alternatively, you could simply do:

renoise.song().selected_track.devices[2].parameters[6].value_string = tostring(gapper)  

?? all this time it worked like this? that’s nuts. i have some local bla = nil’s to rip out of paketti now. :)

thank you for the

renoise.song().selected_track.devices[2].parameters[6].value_string = tostring(gapper)  

proposal, works like a charm.

thanks!!

You only use the blabla = nil (or any other kind of non-value), in situations where you need some kind of hook to know whether a value has never been populated with something or wether it has been used before (good example:your tool is being started for the very first time or whether it is being popped up a next time in the same session).
Everything loaded from (required) lua files in the global name-space is loaded and defined right after Renoise has been started and will not be restarted if you reinvoke dialogs.

  
globals.lua:  
value = nil  
vb = renoise.ViewBuilder  
  
function show_main_dialog()  
 if value == nil then  
 value = 6  
 else  
 value = vb.views['my_popup'].value  
 end  
end  
  
1 Like