How to activate the automation of any parameter inside a device

How to activate the automation of a parameter?

I use this function to copy the automation of the previous track in the selected track:

function clone_track( song, spi, sti, pta, max_pta )
  song = renoise.song()
  spi = song.selected_pattern_index
  sti = song.selected_track_index
  max_pta = #song.patterns[spi].tracks[sti].automation
  
  for i = 1, max_pta do
    --print("i", song.patterns[spi].tracks[sti - 1].automation[i] )
    --song.patterns[spi].tracks[sti].automation[i] = song.patterns[spi].tracks[sti]:find_automation( i )
    --print ( song.tracks[sti].devices[1].parameters[1].is_automatable )
    --song.patterns[spi].tracks[sti]:create_automation(1)
    --song.tracks[sti].devices[1].parameters[1].is_automatable = true
    
    song.patterns[spi].tracks[sti].automation[i]:copy_from( song.patterns[spi].tracks[sti -1].automation[i] )
  end
end

But before the line:

song.patterns[spi].tracks[sti].automation[i]:copy_from( song.patterns[spi].tracks[sti -1].automation[i] )

I need to enable the parameter for automation. If the parameter is not activated, this line not work!.

For example, in device 1, are three parameters: “Panning”, “Volume” “Width”.I need to check if the parameters of the previous track are active, to activate the same parameters of the selected track.

Something like that: song.tracks[sti].devices[1].parameters[1].enable orsong.tracks[sti].devices[1].parameters[1] = true ???Then would volume parameter activated, the curve would have an initial point, at least.

What is the exact code to activate a particular parameter?

– Creates a new automation for the given device parameter.
– Fires an error when an automation for the given parameter already exists.
– Returns the newly created automation. Passed parameter must be automatable,
– which can be tested with ‘parameter.is_automatable’.
renoise.song().patterns.tracks:create_automation(parameter)
→ [renoise.PatternTrackAutomation object]

For example, this will initialize/enable the mixer width parameter automation on track 1:

renoise.song():pattern(1):track(1):create_automation( renoise.song():track(1):device(1):parameter(3) )

@Joule. Thank you very much!I have advanced with my function. But, I have another problem a little deeper…

I’ve done some testing but I have a problem. I do not know how to activate these boxes to Active/Bypassed of each device >1. Attached is an image to clarify:

7485 problem-active-bipassed-device.png

I need to check if Track 1 has the active boxes “Active/Bypassed” on each device >1 to activate these boxes in Track 2.Thus, I can copy the entire contents of curves of each parameter, in this way:

max_automation = #song.patterns[spi].tracks[sti - 1].automation --activated parameters
  for aut = 1, max_automation do
    print("automation:", aut)
    song.patterns[spi].tracks[sti].automation[aut]:copy_from( song.patterns[spi].tracks[sti -1].automation[aut] )
  end

Important note: the boxes “Active/Bypassed” are a special case. What is the exact code to check their status and to activate or deactivate them?

In the documentation I can not find a line of code that serves expressly for this purpose…

For now, I have a function clone_automation() capable of copying all the curves of all the parameters from one track to another,but I need to activate the necessary boxes “Active/Bypassed” of each device of track 2, to match it to track 1.

The function clone_automation():

Click to view contents
function clone_automation( song, spi, sti, devices, max_parameter, max_automation )
  song = renoise.song()
  spi = song.selected_pattern_index
  sti = song.selected_track_index
  devices = #song.tracks[sti - 1].devices
  for dev = 1, devices do -- Vol, Pan, Delay for PRE
    print( "\n==========================================" )
    print("device:",dev)
    
    if dev == 1 then  
      for par = 1, 3 do
        print( "parameter (dev = 1):", par )
        if song.tracks[sti - 1].devices[1].parameters[par].is_automated then
          if not song.tracks[sti].devices[1].parameters[par].is_automated then
            song.patterns[spi].tracks[sti]:create_automation( song.tracks[sti].devices[1].parameters[par] )
          end
        end
      end  
    end
    ---
    if dev > 1 then
      
      -- ********************************************************************************************************* PROBLEM Active / Bypassed
        
      print (song.tracks[sti].devices[dev].is_active_parameter) -- ??????
      
      
      
      
      max_parameter = #song.tracks[sti -1].devices[dev].parameters  
      print( "max_parameter:", max_parameter )
      for par = 1, max_parameter do
        print( "parameter (dev > 1):", par )
        if song.tracks[sti - 1].devices[dev].parameters[par].is_automated then
          if not song.tracks[sti].devices[dev].parameters[par].is_automated then
            song.patterns[spi].tracks[sti]:create_automation( song.tracks[sti].devices[dev].parameters[par] )
          end
        end
      end
    end
  end
  ---
  print( "\n:::::::::::::::::::::::::::::::::::::::::::" )
  max_automation = #song.patterns[spi].tracks[sti - 1].automation --activated parameters
  print( "max_automation:", max_automation )
  
  for aut = 1, max_automation do
    print("automation:", aut)
    song.patterns[spi].tracks[sti].automation[aut]:copy_from( song.patterns[spi].tracks[sti -1].automation[aut] )
  end  
end

This function is part of a larger one, which previously includes a new track (track 2) and adds the same devices in it as in track 1.Thus it is ready to clone automation (the automation track 1 on track 2).

Any ideas?

What is the exact code to check their status and to activate or deactivate them?

Just a quick guess Raul?:

renoise.song().tracks[1].devices[2].is_active = false --deactivate Track 1 second device
renoise.song().tracks[1].devices[2].is_active = true --activate Track 1 second device
print(renoise.song().tracks[1].devices[2].is_active) --show status of Track 1 second device

Just a quick guess Raul?:

renoise.song().tracks[1].devices[2].is_active = false --deactivate Track 1 second device
renoise.song().tracks[1].devices[2].is_active = true --activate Track 1 second device
print(renoise.song().tracks[1].devices[2].is_active) --show status of Track 1 second device

I think I already tried it, but this is to activate the device, not the parameter box “Active/Bypassed”.I thought the same thing too. I believe thatrenoise.song().tracks[1].devices[2].is_activenot the same as the box “Active/Bypassed” (the parameter).

7486 problem-active-bipassed-device-2.png

I have also tried:song.patterns[spi].tracks[sti]:create_automation( song.tracks[sti].devices[1].parameters[0] ), I thought that 0 would be used for Active / Bypassed, but 0 is not a valid parameter value,parameters[a value > 0].

Oh I see now Raul. Now I admit I’ve never messed around with the automation side of things. Yes I see what you want now, however the DeviceParameter object does exist because of this function:

renoise.song().selected_automation_parameter

returns the “Active / Bypassed” DeviceParameter object when you have it selected in the automation window. But that isn’t much use. I haven’t looked but maybe there is some other way of obtaining that object?

[Edit: I can’t fully remember Raul, but I get the feeling that the “Active / Bypassed” automation parameter could of possibly of been added slightly later?]

Oh I see now Raul. Now I admit I’ve never messed around with the automation side of things. Yes I see what you want now, however the DeviceParameter object does exist because of this function:

renoise.song().selected_automation_parameter

returns the “Active / Bypassed” DeviceParameter object when you have it selected in the automation window. But that isn’t much use. I haven’t looked but maybe there is some other way of obtaining that object?

[Edit: I can’t fully remember Raul, but I get the feeling that the “Active / Bypassed” automation parameter could of possibly of been added slightly later?]

I’m blocked now!There should be a direct way to activate each box “Active/Bypassed”.And have independent control with a simple line of code.Then, iterating, it would be possible to check and activate or deactivate each box"Active/Bypassed".

I get the feeling that in automation, there are details still not very well prepared with the documentation currently available.Maybe something is missing?As I understand it, it is used to activate or deactivate the device by means of curves of ones and zeros (one: activated, zero: deactivated).

I get the feeling that the “Active / Bypassed” automation parameter could of possibly of been added slightly later?

Yep, it was. Definitely inconsistent that it’s not accessible through scripting.

Fixing it means that tools that rely on fixed indexes for parameters will break. But there’s isn’t really a clean way to do it otherwise.

Basically, the function clone_automation() that I have built does 3 things:

  1. Check if the parameters of all the devices are active in track 1
  2. Then activate the same parameters of the same devices in track 2.Remember that it is designed for a track cloning function.It is necessary to activate the parameters to be able to insert or to copy points or curves.
  3. Finally, copy the curves of the active parameters of track one to track two.If the function tries to copy a curve into a parameter disabled, it returns an error: bla bla bla… nil, possibly because there is a problem with the index when iterating.

@Danoise, is there a trick to solving this problem? :huh:

@Danoise, is there a trick to solving this problem? :huh:

if you can’t access the parameter, I can’t see a way to achieve this, no.

But you are doing things “properly”, so the code should continue to work once this is fixed in the API.

if you can’t access the parameter, I can’t see a way to achieve this, no.

But you are doing things “properly”, so the code should continue to work once this is fixed in the API.

Oops, a pity!

Well, at least by testing the API, we’re going to find details that seem to be missing. Sorry to ask but, do you have any idea when there will be a new version of Renoise available? Any approximate date?

I’ve also found other things a bit “strange” by experimenting with the code available for the devices and parameters.For example, on device 1, 5 parameters are available, when they actually are 3. I assume 2 parameters were prepared for the volume and panning of POST. But if there is no access…Also part of the code is read-only, which does not have much use if it is not possible to modify it by comparison.

Regarding my function, maybe there is some way to encase each device and always skip the value of “Active/Bypassed” to avoid mistakes.What is happening to me is that when cloning, 1 value is skipped and therefore copies curves in the parameter number + 1 incorrectly or something like that. And in the end it returns a nil because one value per device remains in the iteration.

In fact, if the Active / Bypassed box is manually activated on the clone track (track 2), the cloning of the curves is executed and finalized correctly.But, only the access and modification of this box is missing.

On the other hand, I do not know if it has to do with the internal cache of Renoise, but experimenting with my function, sometimes I returned strange errors, when in a clean boot of Renoise, the function works correctly. It is as if Renoise saved the cache of the parameter indexes and did not update it when loading the tool again without restarting Renoise.Maybe it has to do with the order in which the parameters are added in the automation editor and the cause must be the lack of access to the box “Active/Bypassed”.

This is another appropriate issue to add to your API wishlist??? :slight_smile:

“Automations” are added ad-hoc, can change from pattern to pattern, as different number of parameter are automated.

I don’t know how you are doing things, but you will need to obtain the right automation lane by first fetching the parameter and (al)locate the automation using “find_automation”.

Sounds like you are starting with a clean slate, but once you create automation lanes, you might not get the right indices the next time around? I’m just guessing here, sorry :slight_smile:

I think there is a design problem in the code under the API. With these linen there is also a problem:

– Copy contents from other patterns, including automation, when possible. when possible???

renoise.song().patterns[]:copy_from( other renoise.Pattern object)

– Copy contents from other pattern tracks, including automation when possible.when possible???

renoise.song().patterns[].tracks[]:copy_from( other renoise.PatternTrack object)

These lines are not able to copy the automation of each parameter. It is limited to copying the automation of the 3 parameters of the first device.All other parameters with automation are ignored.I suspect the reason is because the fourth parameter of pattern-track is a Active/Bypassed (is the first parameter of second device), it does not return any errors, but stops there.

There should be a way to return the maximum number of parameters without counting the number of devices.This way it is possible to iterate using this:

renoise.song().patterns[P’].tracks[T’].automation[A’]:copy_from(other renoise.PatternTrackAutomation object)

a renoise.PatternTrackAutomation is renoise.song().patterns[P].tracks[T].automation[A], P, T and A is a number. The “numer A” (automation) refers to all parameters, including the box Active/Bypassed, as one more parameter.When Renoise tries to copy the automation curves of other tracks, it dashes against this parameter.When you iterate inside any device >1, the “Active/Bypassed” parameter does not exist (or can not access).

In short, it is impossible to clone an entire automation from one pattern-track to another.This is useful to be able to quickly test with different instruments using the same automation (and same effects), without needing to modify anything of the origin track.

If in the next version of Renoise is present in Automation improvements and the requirements of some users, there is also appropriate an in-depth review of the related API…