Jump to content


Photo

[Solved] Help LUA: function to create a Group with two Tracks, one col

group track track collapsed lua tracks & group

  • Please log in to reply
77 replies to this topic

#1 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 999 posts
  • Gender:Male
  • Location:Spain

Posted 26 May 2016 - 18:51

I'm starting with LUA language. I would like to make the following tool:

-- GROUP + TWO TRACKS, ONE COLLAPSED

function insert_gt()
  local song = renoise.song()
-- insert new Group:  (Note: I need put the two tracks inside this group)
    song:insert_group_at(song.selected_track_index + 1)

-- insert two Tracks or more...:
    song:track(song.selected_track_index).name = "TRACK 1"  -- & the name of GROUP????
  local track = song:track(song.selected_track_index)
    track.visible_effect_columns = 0
    track.visible_note_columns = 12
    track.volume_column_visible = false
    track:set_column_name(1, "NOTE 1")
    track:set_column_name(2, "NOTE 2")

    song:track(song.selected_track_index).name = "TRACK 2"
  local track = song:track(song.selected_track_index)
    track.visible_effect_columns = 0
    track.visible_note_columns = 12
    track.volume_column_visible = false
    track:set_column_name(1, "NOTE 1")
    track:set_column_name(2, "NOTE 2")
    -- Note: Code for collapse the entire TRACK 2?????
end

renoise.tool():add_menu_entry {
  name = "Pattern Editor:Expand Group & 2 Tracks",
  invoke = function() insert_gt() end
}

Basically, I want to create a tool to create with a single mouse click a group and within two runways (one collapsed), in the Pattern Editor. As is the code creates two tracks and a group separately. I need the two tracks (or more) appear within the group.

 
Besides, I want to know what the code for a track made out collapsed (one expanded and other collapsed). This will serve  to create a more complex tool.
 
Can you help?
 
The result would be this:
group&2traks.png

Edited by Raul (ulneiz), 15 July 2016 - 02:09.

:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#2 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1480 posts
  • Gender:Not Telling
  • Location:Sweden
  • Interests:music, philosophy, engineering

Posted 26 May 2016 - 19:14

I think the key to your mystery is renoise.song():add_track_to_group(int track_index, int group_index)



#3 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 999 posts
  • Gender:Male
  • Location:Spain

Posted 26 May 2016 - 19:25

-- GROUP + TWO TRACKS, ONE COLLAPSED

function insert_gt()
  local song = renoise.song()
-- insert new Group:  (Note: I need put the two tracks inside this group)
    song:add_track_to_group(int track_index, int group_index)
    song:insert_group_at(song.selected_track_index + 1)

-- insert two Tracks or more...:
    song:track(song.selected_track_index).name = "TRACK 1"  -- & the name of GROUP????
  local track = song:track(song.selected_track_index)
    track.visible_effect_columns = 0
    track.visible_note_columns = 12
    track.volume_column_visible = false
    track:set_column_name(1, "NOTE 1")
    track:set_column_name(2, "NOTE 2")

    song:track(song.selected_track_index).name = "TRACK 2"
  local track = song:track(song.selected_track_index)
    track.visible_effect_columns = 0
    track.visible_note_columns = 12
    track.volume_column_visible = false
    track:set_column_name(1, "NOTE 1")
    track:set_column_name(2, "NOTE 2")
    -- Note: Code for collapse the entire TRACK 2?????
end

renoise.tool():add_menu_entry {
  name = "Pattern Editor:Expand Group & 2 Tracks",
  invoke = function() insert_gt() end
}
error in Terminal: *** main.lua:6: ')' expected near 'track_index'.

 

I know that code needed to add to define it. But I do not know how it goes...   :unsure:


Edited by Raul, 26 May 2016 - 19:27.

:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#4 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1480 posts
  • Gender:Not Telling
  • Location:Sweden
  • Interests:music, philosophy, engineering

Posted 26 May 2016 - 19:38

This works I think.

function insert_gt()
  local song = renoise.song()
  song:insert_track_at(1)
  song:insert_track_at(1)
  song:insert_group_at(3)
  song:add_track_to_group(1, 3)
  song:add_track_to_group(1, 3)
end

insert_gt()

Edited by joule, 26 May 2016 - 19:57.


#5 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 999 posts
  • Gender:Male
  • Location:Spain

Posted 26 May 2016 - 19:43

Thanks joule for the help!  I will try to fix it...  :wacko:  ^_^


:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#6 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 999 posts
  • Gender:Male
  • Location:Spain

Posted 26 May 2016 - 19:58

 

Disregard. This seems to work?

 

So, what is happening is that song:add_track_to_group(a, b ) is inserting a group at position b, and automatically adding the previous track to it. track #a is also being added to the group. The function is a bit stupid/buggy in that way, it seems.

function insert_gt()
  local song = renoise.song()
  song:insert_track_at(1)
  song:add_track_to_group(1, 2)
end

insert_gt()

 

Thereby yes!

function insert_gt()
  local song = renoise.song()
  song:insert_track_at(1)
  song:insert_track_at(2)
  song:insert_track_at(3)
  song:add_track_to_group(1, 2, 3)
end

insert_gt()

It seems to take 1 as the value of the group. To output two tracks need three numbers. I like the clean code! I need now collapsing one of the two tracks


:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#7 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1480 posts
  • Gender:Not Telling
  • Location:Sweden
  • Interests:music, philosophy, engineering

Posted 26 May 2016 - 20:05

No, that doesn't work. Do what I updated above.

 

song:add_track_to_group(track_index, group_index) is the syntax. Do that after inserting an empty group.

 

PS. For bonus: do it the proper way (in regards to selected_track_index) not allowing any errors in edge cases, for example when you only have one group and one master track in your song.


Edited by joule, 26 May 2016 - 20:06.


#8 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1480 posts
  • Gender:Not Telling
  • Location:Sweden
  • Interests:music, philosophy, engineering

Posted 26 May 2016 - 20:20

Here is probably what you want to do.

function insert_track(index, name, is_collapsed)
  renoise.song():insert_track_at(index)
  local track = renoise.song():track(index)
  track.name = name
  track.visible_effect_columns = 0
  track.visible_note_columns = 12
  track.volume_column_visible = false
  for note_column = 1, 12 do
    track:set_column_name(note_column, "NOTE " .. note_column)
  end
  track.collapsed = is_collapsed
end
    
function insert_gt()
  local song = renoise.song()
  insert_track(song.selected_track_index, "TRACK 1", false)
  insert_track(song.selected_track_index, "TRACK 2", true)
  song:insert_group_at(song.selected_track_index + 2)
  song:add_track_to_group(song.selected_track_index + 1 , song.selected_track_index + 2)
  song:add_track_to_group(song.selected_track_index, song.selected_track_index + 2)
end

insert_gt()

Edited by joule, 26 May 2016 - 20:23.

  • Raul (ulneiz) likes this

#9 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 999 posts
  • Gender:Male
  • Location:Spain

Posted 26 May 2016 - 20:24

The above code works! I'll try this code more extensive now...


  • joule likes this

:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#10 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 999 posts
  • Gender:Male
  • Location:Spain

Posted 26 May 2016 - 20:39

Thanks joule

 

Instead of inserting 2 tracks, as it would be 5 tracks within the group and rename the group?

 

this will help me understand the numbers!


Edited by Raul, 26 May 2016 - 20:40.

:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#11 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1480 posts
  • Gender:Not Telling
  • Location:Sweden
  • Interests:music, philosophy, engineering

Posted 26 May 2016 - 20:42

How to structure that code depends on what you ultimately want to do. Especially the loops..



#12 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 999 posts
  • Gender:Male
  • Location:Spain

Posted 26 May 2016 - 20:54

A group, inside 10 tracks

  • 1,2,3,4 collapsed
  • 5,6 expanded
  • 7,8,9,10 collapsed

and change the name of group. With the code able to create more tools... for example

 

A group, inside 5 tracks

  • 1,2 collapsed
  • 3 expanded
  • 4,5 collapsed

Things like that


name of group:

song:insert_group_at(song.selected_track_index + 2).name = "GROUP 1"

:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#13 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 999 posts
  • Gender:Male
  • Location:Spain

Posted 26 May 2016 - 21:08

^_^  with 3 traks!

function insert_gt()
  local song = renoise.song()
  insert_track(song.selected_track_index, "TRACK 1", true)
  insert_track(song.selected_track_index, "TRACK 2", false)
  insert_track(song.selected_track_index, "TRACK 3", true)
  song:insert_group_at(song.selected_track_index + 3).name = "GROUP 1"
  song:add_track_to_group(song.selected_track_index + 2, song.selected_track_index + 3)
  song:add_track_to_group(song.selected_track_index + 1, song.selected_track_index + 3)
  song:add_track_to_group(song.selected_track_index, song.selected_track_index + 3) 
end

with 4 tracks:

function insert_gt()
  local song = renoise.song()
  insert_track(song.selected_track_index, "TRACK 1", true)
  insert_track(song.selected_track_index, "TRACK 2", false)
  insert_track(song.selected_track_index, "TRACK 3", true)
  insert_track(song.selected_track_index, "TRACK 4", true)
  song:insert_group_at(song.selected_track_index + 4).name = "GROUP 1"
  song:add_track_to_group(song.selected_track_index + 3, song.selected_track_index + 4)
  song:add_track_to_group(song.selected_track_index + 2, song.selected_track_index + 4)
  song:add_track_to_group(song.selected_track_index + 1, song.selected_track_index + 4)
  song:add_track_to_group(song.selected_track_index, song.selected_track_index + 4) 
end

I think I get it well!!!! 

 

 

Thank you very much!!!!!


:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#14 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 999 posts
  • Gender:Male
  • Location:Spain

Posted 28 May 2016 - 00:18

Hi people!

function insert_track(index, name, is_collapsed)
  renoise.song():insert_track_at(index)
  local track = renoise.song():track(index)
  track.color_blend = 20                      <-------------------
  track.name = name
  track.visible_effect_columns = 0
  track.visible_note_columns = 12
  track.volume_column_visible = false
  for note_column = 1, 12 do
    track:set_column_name(note_column, "NOTE " .. note_column)
  end
  track.collapsed = is_collapsed
end
    
function insert_gt()
  local song = renoise.song()
  insert_track(song.selected_track_index, "TRACK 1", false)
  insert_track(song.selected_track_index, "TRACK 2", true)
  song:insert_group_at(song.selected_track_index + 2)
  song:add_track_to_group(song.selected_track_index + 1 , song.selected_track_index + 2)
  song:add_track_to_group(song.selected_track_index, song.selected_track_index + 2)
end

insert_gt()

I agree a line (line:4):

 track.color_blend = 20

With this code the Tracks can be colored in 20%, but not the main Group. How I can colored the main Group? I like to colored with an intensity of 40%, for example. Can you help me with the code?

 

Thanks!


:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#15 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 999 posts
  • Gender:Male
  • Location:Spain

Posted 28 May 2016 - 01:32

Basically, I need to solve two things, to end the code I'm doing for a tool:

  1. Agree the color_blend in the Main Group
  2. Agree the collapse FX column in the Main Group (...the right column FX in Group)

All the options for the tracks is solvet. Where I are problems is the options in the Group (color_blend and collapse FX column). In the coming days to see if I can finish.

 

Please help!


:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#16 4Tey

4Tey

    Chief Above Chief Member

  • Normal Members
  • PipPipPipPipPipPip
  • 382 posts
  • Gender:Male

Posted 28 May 2016 - 07:13

Raul:  Would adding these two lines in your 'insert_gt' do the trick?  Like this:

function insert_track(index, name, is_collapsed)
  renoise.song():insert_track_at(index)
  local track = renoise.song():track(index)
  track.color_blend = 20
  track.name = name
  track.visible_effect_columns = 0
  track.visible_note_columns = 12
  track.volume_column_visible = false
  for note_column = 1, 12 do
     track:set_column_name(note_column, "NOTE " .. note_column)
  end
  track.collapsed = is_collapsed
end
        
function insert_gt()
  local song = renoise.song()
  insert_track(song.selected_track_index, "TRACK 1", false)
  insert_track(song.selected_track_index, "TRACK 2", true)
  song:insert_group_at(song.selected_track_index + 2)
  song:add_track_to_group(song.selected_track_index + 1 , song.selected_track_index + 2)
  song:add_track_to_group(song.selected_track_index, song.selected_track_index + 2)

  --Additional lines
  song.tracks[1].group_parent.color_blend = 40
  song.tracks[1].group_parent.collapsed = true

end


#17 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1480 posts
  • Gender:Not Telling
  • Location:Sweden
  • Interests:music, philosophy, engineering

Posted 28 May 2016 - 08:53

@Raul,

 

Did you know that you can "browse" the renoise.song() values available? This way, you can investigate what is available quite easily.

 

1) In the terminal, type oprint(renoise.song()) and hit enter.

2) There you see, for example, "patterns". Let's go further into the tree and see what is in patterns. Patterns is a table, and if you want to list a table you need to type rprint(renoise.song().patterns) instead. For everything else, oprint works.

 

You get the idea. You can get the same info in more detail from https://github.com/r...se.Song.API.lua , but I have personally learnt the most by using the terminal. Soon enough you will get a general understanding of where to find certain values.


Edited by joule, 28 May 2016 - 08:56.

  • Raul (ulneiz) likes this

#18 joule

joule

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1480 posts
  • Gender:Not Telling
  • Location:Sweden
  • Interests:music, philosophy, engineering

Posted 28 May 2016 - 09:59

Depending on what you want to do, this might be pretty.


local track_settings = {

Setting_1 = {
  group_name = "GROUP - Setting 1",
  group_blend = 50,
  { name = "TRACK 1", collapsed = true, blend = 20 },
  { name = "TRACK 2", collapsed = true, blend = 20 },
  { name = "TRACK 3", collapsed = true, blend = 20 },
  { name = "TRACK 4", collapsed = true, blend = 20 },
  { name = "TRACK 5", collapsed = true, blend = 20 },
  { name = "TRACK 6", collapsed = true, blend = 20 },
            },

Setting_2 = {
  group_name = "GROUP - Setting 2",
  group_blend = 10,
  { name = "TRACK 1", collapsed = true, blend = 20 },
  { name = "TRACK 2", collapsed = false, blend = 20 },
  { name = "TRACK 3", collapsed = true, blend = 80 },
  { name = "TRACK 4", collapsed = false, blend = 10 },
  { name = "TRACK 5", collapsed = true, blend = 20 },
  { name = "TRACK 6", collapsed = true, blend = 20 },
            },
}

function insert_track(track_index, group_index, name, is_collapsed, blend)
  renoise.song():insert_track_at(track_index)
  local track = renoise.song():track(track_index)
  track.color_blend = blend                     
  track.name = name
  track.visible_effect_columns = 0
  track.visible_note_columns = 12
  track.volume_column_visible = false
  track.collapsed = is_collapsed
  for note_column = 1, 12 do
    track:set_column_name(note_column, "NOTE " .. note_column)
  end
  renoise.song():add_track_to_group(track_index, group_index)
end
        
function insert_gt(track_setting)
  local song, i = renoise.song(), 1
  local group_index = song.selected_track_index + 1
  song:insert_group_at(group_index)
  song:track(group_index).name = track_settings[track_setting].group_name
  song:track(group_index).color_blend = track_settings[track_setting].group_blend  
  for val, track_setting in ipairs(track_settings[track_setting]) do
    local group_index = group_index + i
    insert_track(song.selected_track_index, group_index, track_setting.name, track_setting.collapsed, track_setting.blend)
    i = i + 1
  end
end
     
insert_gt("Setting_2")
   


Edited by joule, 28 May 2016 - 10:04.

  • Raul (ulneiz) likes this

#19 4Tey

4Tey

    Chief Above Chief Member

  • Normal Members
  • PipPipPipPipPipPip
  • 382 posts
  • Gender:Male

Posted 28 May 2016 - 11:39

Joule, you probably also need the option to automatically collapse the group to hide the group FX column:

local track_settings = {

Setting_1 = {
  group_name = "GROUP - Setting 1",
  group_blend = 50,
  group_collapse = false,
  { name = "TRACK 1", collapsed = true, blend = 20 },
  { name = "TRACK 2", collapsed = true, blend = 20 },
  { name = "TRACK 3", collapsed = true, blend = 20 },
  { name = "TRACK 4", collapsed = true, blend = 20 },
  { name = "TRACK 5", collapsed = true, blend = 20 },
  { name = "TRACK 6", collapsed = true, blend = 20 },
            },

Setting_2 = {
  group_name = "GROUP - Setting 2",
  group_blend = 10,
  group_collapse = true,
  { name = "TRACK 1", collapsed = true, blend = 20 },
  { name = "TRACK 2", collapsed = false, blend = 20 },
  { name = "TRACK 3", collapsed = true, blend = 80 },
  { name = "TRACK 4", collapsed = false, blend = 10 },
  { name = "TRACK 5", collapsed = true, blend = 20 },
  { name = "TRACK 6", collapsed = true, blend = 20 },
            },
}

function insert_track(track_index, group_index, name, is_collapsed, blend)
  renoise.song():insert_track_at(track_index)
  local track = renoise.song():track(track_index)
  track.color_blend = blend                     
  track.name = name
  track.visible_effect_columns = 0
  track.visible_note_columns = 12
  track.volume_column_visible = false
  track.collapsed = is_collapsed
  for note_column = 1, 12 do
    track:set_column_name(note_column, "NOTE " .. note_column)
  end
  renoise.song():add_track_to_group(track_index, group_index)
end
        
function insert_gt(track_setting)
  local song, i = renoise.song(), 1
  local group_index = song.selected_track_index + 1
  song:insert_group_at(group_index)
  song:track(group_index).name = track_settings[track_setting].group_name
  song:track(group_index).color_blend = track_settings[track_setting].group_blend
  for val, track_setting in ipairs(track_settings[track_setting]) do
    local group_index = group_index + i
    insert_track(song.selected_track_index, group_index, track_setting.name, track_setting.collapsed, track_setting.blend)
    i = i + 1
  end
  song:track(group_index).group_parent.collapsed = track_settings[track_setting].group_collapse
end
     
insert_gt("Setting_2")


#20 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 999 posts
  • Gender:Male
  • Location:Spain

Posted 28 May 2016 - 14:46

@joule and @4Tey, Thanks!!!!!!!  ^_^

 

Let's see if I have time and I get to implement. I'm learning more quickly than I thought at first, all thanks to your help!

 

I love it!!!


:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#21 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 999 posts
  • Gender:Male
  • Location:Spain

Posted 28 May 2016 - 18:15

function insert_gt()
  local song = renoise.song()
  insert_track(song.selected_track_index, "TRACK 1", false)
  insert_track(song.selected_track_index, "TRACK 2", true)
  song:insert_group_at(song.selected_track_index + 2)   <-----------------------------------------------
  song:add_track_to_group(song.selected_track_index + 1 , song.selected_track_index + 2)
  song:add_track_to_group(song.selected_track_index, song.selected_track_index + 2)

  --Additional lines
  song.tracks[1].group_parent.color_blend = 40
  song.tracks[1].group_parent.collapsed = true

end

Hi 4Tey. I agree the two additional lines:

  song.tracks[1].group_parent.color_blend = 40
  song.tracks[1].group_parent.collapsed = true

But only served if the first pattern is selected. If  is selected, for example, the pattern 20 not work. I'm trying to implement with various groups and subgroups...

 

Is there any way to add the line marked up? song:insert_group_at(song.selected_track_index + 2)  HERE!

 

Per example:   song:insert_group_at(song.selected_track_index + 2).name = "MAIN GROUP"

 

".name = "MAIN GROUP"  work!

 

".color_blend= 40" and  ".collapsed = true" doesn't work in this line

 

With joule solution not I get to add more major groups encompassing more subgroups. I'm trying things.


Edited by Raul, 28 May 2016 - 18:22.

:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#22 4Tey

4Tey

    Chief Above Chief Member

  • Normal Members
  • PipPipPipPipPipPip
  • 382 posts
  • Gender:Male

Posted 28 May 2016 - 19:15

Raul I only gave that as a crude example to show 'group_parent' and one way to modify the background colour of the group you have created.  If you wanted it to work on another track (apart from a send track) you could sort of do:

--Additional lines
song.tracks[song.selected_track_index].group_parent.color_blend = 40
song.tracks[song.selected_track_index].group_parent.collapsed = true

But I suspect that this isn't what you are looking for anyway :)

 

Now if you simplify Joules example code to say (again wont work on a send track):

local track_settings = {

Setting_1 = {
  group_name = "Main Group",
  group_blend = 50,
  group_collapse = true,
  { name = "TRACK 1", collapsed = false, blend = 20 },
  { name = "TRACK 2", collapsed = true, blend = 20 },
     }
}

function insert_track(track_index, group_index, name, is_collapsed, blend)
  renoise.song():insert_track_at(track_index)
  local track = renoise.song():track(track_index)
  track.color_blend = blend                     
  track.name = name
  track.visible_effect_columns = 0
  track.visible_note_columns = 12
  track.volume_column_visible = false
  track.collapsed = is_collapsed
  for note_column = 1, 12 do
    track:set_column_name(note_column, "NOTE " .. note_column)
  end
  renoise.song():add_track_to_group(track_index, group_index)
end
        
function insert_gt(track_setting)
  local song, i = renoise.song(), 1
  local group_index = song.selected_track_index
  song:insert_group_at(group_index)
  song:track(group_index).name = track_settings[track_setting].group_name
  song:track(group_index).color_blend = track_settings[track_setting].group_blend
  for val, track_setting in ipairs(track_settings[track_setting]) do
    local group_index = group_index + i
    insert_track(song.selected_track_index, group_index, track_setting.name, track_setting.collapsed, track_setting.blend)
    i = i + 1
  end
  song:track(group_index).group_parent.collapsed = track_settings[track_setting].group_collapse
end
     
insert_gt("Setting_1")

That will roughly give you what you have in your first post screenshot, plus you can define the structure of what tracks are created.

 

I'm not really sure what you are ultimately trying to write though.  Whatever it is, it sounds complicated.  Good luck Raul! :)

 



#23 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 999 posts
  • Gender:Male
  • Location:Spain

Posted 28 May 2016 - 23:03

Thanks 4Tey!!!!  ^_^

 

All the codes serve me! You guys are helping me a lot!


:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#24 Raul (ulneiz)

Raul (ulneiz)

    Guruh Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPip
  • 999 posts
  • Gender:Male
  • Location:Spain

Posted 29 May 2016 - 00:00

A silly question...
 
Is it possible to apply the "color_blend" separately in each "note_column"?

 

Per example: (a octave)

 

 note_column 01 in color_blend = 40

 note_column 02 in color_blend = 10   #

 note_column 03 in color_blend = 40

 note_column 04 in color_blend = 10   #

 note_column 05 in color_blend = 40

 note_column 06 in color_blend = 40

 note_column 07 in color_blend = 10   #

 note_column 08 in color_blend = 40

 note_column 09 in color_blend = 10   #

 note_column 10 in color_blend = 40

 note_column 11 in color_blend = 10   #

 note_column 12 in color_blend = 40

 

I think Renoise does not support it, but I wonder if there is some trick. The approximate result:

 

note_column_colors.png

 

Part of the code I'm using:

function insert_track(index, name, is_collapsed)
  renoise.song():insert_track_at(index)
  local track = renoise.song():track(index)
  track.color_blend = 40
  --track.color = {0xff,0xff,0xff}
  track.name = name
  track.visible_note_columns = 12
  track.visible_effect_columns = 0
  track.volume_column_visible = false
  track.panning_column_visible = false
  track.delay_column_visible = false
  track.sample_effects_column_visible = false
  for note_column = 1, 12 do
    track:set_column_name(1, "C  do")
    track:set_column_name(2, "C#")
    track:set_column_name(3, "D  re")
    track:set_column_name(4, "D#")
    track:set_column_name(5, "E  mi")
    track:set_column_name(6, "F  fa")
    track:set_column_name(7, "F#")
    track:set_column_name(8, "G  sol")
    track:set_column_name(9, "G#")
    track:set_column_name(10, "A  la")
    track:set_column_name(11, "A#")
    track:set_column_name(12, "B  si")
    --track:set_column_name(note_column, "NOTE " .. note_column)
  end
  if is_collapsed then
    track.collapsed = true
  end 
end

Edited by Raul, 29 May 2016 - 00:13.

:excl: Development of my tool: GT16-Colors

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#25 4Tey

4Tey

    Chief Above Chief Member

  • Normal Members
  • PipPipPipPipPipPip
  • 382 posts
  • Gender:Male

Posted 29 May 2016 - 06:49

Is it possible to apply the "color_blend" separately in each "note_column"?

No, as far as I'm aware Raul.  You can only apply a colour (color) to whole tracks.

 

P.S.  It looks way more complicated than MiniRoll.  Good luck Raul! :)


Edited by 4Tey, 27 June 2016 - 07:04.






Also tagged with one or more of these keywords: group, track, track collapsed, lua, tracks & group