This script creates a new phrase, copies the selected notes in the arrangement editor to the new phrase, and adds the new phrase to the song. After running this script, you will have a new phrase in the phrases list that contains the selected notes.
Feel free to test at will…
– Create phrase from selected area in arrangement editor
local function create_phrase()
local selected_start, selected_end = renoise.song().selected_range
local phrase = renoise.Phrase.new()
local phrase_line_index = 1
– Iterate through the selected lines
for line_index = selected_start.line, selected_end.line do
local line = renoise.song().patterns[renoise.song().selected_pattern_index].lines[line_index]
-- Iterate through the selected columns in the line
for column_index = selected_start.column, selected_end.column do
local note_column = line.note_columns[column_index]
local phrase_line = phrase:line(phrase_line_index)
-- Copy note data to the new phrase
phrase_line.note = note_column.note_value
phrase_line.instrument = note_column.instrument_value
phrase_line.volume = note_column.volume_value
phrase_line.panning = note_column.panning_value
-- Increment phrase line index
phrase_line_index = phrase_line_index + 1
end
end
– Add the new phrase to the song
renoise.song().phrases:insert(phrase)
end
Here’s a script to drag and drop modulation routing:
– Drag and Drop Modulation Routing Script for Renoise
local renoise = require ‘renoise’
local function drag_modulation_routing(src_track,dest_track)
-- retrieve the selected source track and its modulation sources
local source_track = renoise.song().tracks[src_track]
local dest_track = renoise.song().tracks[dest_track]
local mod_sources = source_find_all_modulators()
-- check each modulator
for i,source in ipairs(mod_sources) do
-- create a new modulator and clone the settings
local modulator = dest_track:create_modulator()
modulator:copy_from(source)
end
end
– bind drag and drop handler to this script
renoise.tool():add_keybinding{name=“Global:Tools:Drag Modulation Routing”, invoke=drag_modulation_routing}
local fill_length = 16
for i=1,fill_length do
local note_value = math.random(1,4)
if note_value == 1 then
renoise.song().patterns[1].tracks[DRUMS.SYNTH_BASS].lines[i].note_columns[1].note_value=math.random(24,36)
elseif note_value == 2 then
renoise.song().patterns[1].tracks[DRUMS.SNARE].lines[i].note_columns[1].note_value=math.random(48,60)
elseif note_value == 3 then
renoise.song().patterns[1].tracks[DRUMS.HIHAT_CLOSED].lines[i].note_columns[1].note_value=math.random(24,36)
– Create a table to store the variations of patterns
local pattern_variations = {}
– Loop through each pattern in the song
for p = 1, #song.patterns do
– Create an empty table to hold each variation of the pattern
pattern_variations[p] = {}
– Loop through each track in the pattern
for t = 1, song.patterns[p].number_of_tracks do
– Copy the pattern and save it in our table
pattern_variations[p][t] = song.patterns[p]:track(t):copy()
-- Loop through each column in the current track
for c = 1, song.patterns[p].number_of_lines do
-- Get the note and instrument at this position
local note = pattern_variations[p][t]:line(c).note_columns[1]:note_value()
local instr = pattern_variations[p][t]:line(c).instrument_columns[1].instrument_value
-- If note is