A tool to randomise start point within a range?

The function would be relatively simple.
Detect the start line and the final line of the selection, which will establish the range. Check that there is a concrete effect in these 2 lines and a quantity (they are two quantities that determine the range to randomize). Apply a random value within the range in all the lines within the selection that have that specific effect, ignoring the rest of the effects that could have.
To work, you need a previous selection, and open the drop-down menu to execute the function. Initially, randomization would apply to all selected sub-columns. It really is strange that this does not exist natively.

@midierror If you want a quicker way of doing it by hand in mean time, my sequencer tool allows you to input patern commands with sliders. Just select the offset command from the relevant popup on the bottom row of buttons:

sam%20offset

1 Like

Here is the first version of the new RandomRangeTrack tool:

--
-- Menu Tool: "Random Range Track"
-- Version: 1.0 build 001
-- Release Date: January 2019
-- Compatibility: Renoise 3.1.1
-- Programmer: ulneiz
--
-- Description: This double function randomizes the notes or values of the selected range within the selected track.
--              First it is necessary to select an area in the pattern editor.
--              The first line and the last line selected must have different notes/values,  which define the
--              minimum and maximum notes/values of the range to randomize.
--              Use "ALT + mouse select" to the precise selection.
--
--              Access: "Pattern Editor/Selection/Randomize Notes... (or Randomize Effects...)".
--



--randomize notes (C-0 to B-9)
local function random_range_track_notes()
  local song=renoise.song()
  local spt=song.selected_pattern_track
  local sel=song.selection_in_pattern
  local range={sel.start_line,sel.end_line}
  --rprint(range)
  if (sel~=nil) then
    for lne=range[1],range[2] do
      --note columns (notes only)
      for ncl=1,12 do
        local nte_col=spt:line(lne):note_column(ncl)
        if (nte_col.is_selected) then
          --note
          if (nte_col.note_value<120) then
            local val_1=spt:line(range[1]):note_column(ncl).note_value
            local val_2=spt:line(range[2]):note_column(ncl).note_value
            print(val_1,val_2)
            if (val_1<120) and (val_2<120) then
              if (val_1<val_2) then
                nte_col.note_value=math.random(val_1,val_2)
              elseif (val_1>val_2) then
                nte_col.note_value=math.random(val_2,val_1)
              end
            end
          end
        end
      end
    end
  end
end



--randomize effect values (volume, panning, delay, sample effects & effect columns)
local function random_range_track_effect()
  local song=renoise.song()
  local spt=song.selected_pattern_track
  local sel=song.selection_in_pattern
  local range={sel.start_line,sel.end_line}
  --rprint(range)
  if (sel~=nil) then
    for lne=range[1],range[2] do
      --note columns (vol,pan,dly,sfx)
      for ncl=1,12 do
        local nte_col=spt:line(lne):note_column(ncl)
        if (nte_col.is_selected) then
          --volume
          if (nte_col.volume_string~="..") then
            local val_1=spt:line(range[1]):note_column(ncl).volume_value
            local val_2=spt:line(range[2]):note_column(ncl).volume_value
            if (val_1<=127) and (val_2<=127) then
              if (val_1<val_2) then
                nte_col.volume_value=math.random(val_1,val_2)
              elseif (val_1>val_2) then
                nte_col.volume_value=math.random(val_2,val_1)
              end
            end
          end
          --panning
          if (nte_col.panning_string~="..") then
            local val_1=spt:line(range[1]):note_column(ncl).panning_value
            local val_2=spt:line(range[2]):note_column(ncl).panning_value
            if (val_1<=127) and (val_2<=127) then
              if (val_1<val_2) then
                nte_col.panning_value=math.random(val_1,val_2)
              elseif (val_1>val_2) then
                nte_col.panning_value=math.random(val_2,val_1)
              end
            end
          end
          --delay
          if (nte_col.delay_string~="..") then
            local val_1=spt:line(range[1]):note_column(ncl).delay_value
            local val_2=spt:line(range[2]):note_column(ncl).delay_value
            if (val_1<=256) and (val_1>0) and (val_2<=256) and (val_2>0) then            
              if (val_1<val_2) then
                nte_col.delay_value=math.random(val_1,val_2)
              elseif (val_1>val_2) then
                nte_col.delay_value=math.random(val_2,val_1)
              end
            end
          end
          --sample effects
          if (nte_col.effect_number_string==spt:line(range[1]):note_column(ncl).effect_number_string) then
            local val_1=spt:line(range[1]):note_column(ncl).effect_amount_value
            local val_2=spt:line(range[2]):note_column(ncl).effect_amount_value
            if (val_1<val_2) then
              nte_col.effect_amount_value=math.random(val_1,val_2)
            elseif (val_1>val_2) then
              nte_col.effect_amount_value=math.random(val_2,val_1)
            end
          end
        end
      end
      --effect columns
      for ecl=1,8 do
        local eff_col=spt:line(lne):effect_column(ecl)
        if (eff_col.is_selected) then
          if (eff_col.number_string==spt:line(range[1]):effect_column(ecl).number_string) then
            local val_1=spt:line(range[1]):effect_column(ecl).amount_value
            local val_2=spt:line(range[2]):effect_column(ecl).amount_value
            if (val_1<val_2) then
              eff_col.amount_value=math.random(val_1,val_2)
            elseif (val_1>val_2) then
              eff_col.amount_value=math.random(val_2,val_1)
            end
          end
        end
      end
    end
  end
end



--menu entry
renoise.tool():add_menu_entry{
  name=("Pattern Editor:Selection:Randomize Notes (Range Track)"),
  invoke=function() random_range_track_notes() end
}
renoise.tool():add_menu_entry{
  name=("Pattern Editor:Selection:Randomize Effects (Range Track)"),
  invoke=function() random_range_track_effect() end
}

This tool is also able to randomize ranges of notes through the selection, in addition to the effect values. As soon as I have time I will upload it as an official tool on renoise.com.

Cool, thank you… please let me know how I can use it!

Thanks, I’m having trouble finding this !

@midierror if you are talking about sequencer tool, here is a reposted link without default forum formatting (the quote box at bottom of previous post)

Link repost

If you mean @Raul 's tool, that’s just the source he posted, and he needs to package it up and upload when he has the time.

The new Random Range Track tool can be discussed here:

The two randomization functions could still be more aggressive, preventing more than repeated values being repeated. Test the tool thoroughly. I should do exactly what you ask for. It is valid for any volume, panning, delay and sfx subcolumns and effect columns. In addition, a range of notes can be randomized separately.

It is limited to working within a pattern-track on purpose. Try to be precise in the selection (top line and bottom line).

Try using the maYbe command in mutually exclusive mode within a phrase. You can spread different notes and/or effect values over the 12 available note columns, so that the maYbe command will play a random column each time the note is triggered. Tip: You can also weight each note column differently to give more or less importance to certain values.

Example: 2019-01-30-maybe-sample-attack.xrns (166.7 KB)

3 Likes

The new Random Range Track tool has been updated to version 2.0. Download the new version and delete the old one.

AWSOME!!! thanks so much this is why I love the renoise community!!

I just had an even better idea… could it be locked it to a certain number of steps in the range (eg 10s) ??

Then it’ll work brilliantly as a randomised beat make using the S command!

EG

“Randomise between 00 and F0 in steps of 16” would result in

10 20 30 40 50 60 70 80 A0 B0 C0 D0 E0 OR F0

It is possible to create a table of specific numerical values and return randomly for each line only the values that are within this table.
For example
table={00,10, 20, 30, 40, 50, 60, 70, 80, 90, A0, B0, C0, D0, E0, F0}

Result:
Line1=70
Line2=00
Line3=D0
Line4=20
Line5=30
Line6=B0
Line7=80
Line8=D0
Line9=10
Line10=20
Line11=A0
Line12=90
Line13=00
Line14=60
Line15=C0
Line16=C0

It would only be valid for effects that accept 256 values. The volume or the panning only accept 128. We are spinning very fine already.

The pattern editor has a basic randomize function that works like this.

You can randomize the selected blocked, the current track, current column, and so on.

  • ALT + F7 : Randomize block selection
  • LSHIFT + F7 : Randomize track
  • CTRL + F7 : Randomize pattern
  • Etc.

Search for “randomize” in the key preferences :slight_smile:

Thats good, and it does work. But i dont think it randomises within a range…?

having used this tool for a while, I’d recommend two changes…

It would work better if we could apply the values to all notes in the selection, with the ability to select your Effect Value.

EG

I want S Command between ranges of 00-50 for all notes in this sequence.

is this possible?

Of course! I have been implementing this capability within the PRE tool.

It is only necessary to check if there is a note in the same line to change the effect, but not to do anything. The cursor must be in the effect column, where the effect and reference quantity are.

Okay, if thats possible it will improve it.

If we can select notes, then apply a specific command within a range without having to write blank fx commands for all nots, that would be ideal!

Yes, that’s how it works. It is only necessary to set the initial value (line 0) and the final value, (line 511, for example), if you have selected all the pattern of 512 lines. The remains of effect rows may be empty. They would be filled if there are notes in each line.

1 Like

Here is an example:
z
The initial amount is the one entered by the sliding bar (B4 or 89). The final amount, in this case, is 0 or 0, taken from the last line of the pattern of the selected sub-column.

For each effect to be randomized, it will only be necessary to enter the type of effect and only 2 quantities, the initial (selection of the cursor) and the final (the last line of the pattern).

1 Like

MATE!! thats amazing, you’ll be rewarded in the new years honours by HM Queen Elizabeth for this