midi mapping a knob to a specific thing

Hi, I’m attempting to figure out how to modify this:

renoise.song().patterns[currPatt].tracks[currTrak].lines[currLine].effect_columns[1].number_value = math.max(0, math.min(255, columns[thing] + chg))

into receiving midi 0-127 knob data, and so that the incoming midi slider data 0-127 is made to work between 0-255.

Hi, I’m attempting to figure out how to modify this:

renoise.song().patterns[currPatt].tracks[currTrak].lines[currLine].effect_columns[1].number_value = math.max(0, math.min(255, columns[thing] + chg)) 
else end
if thing == 5 then --effect amount column
renoise.song().patterns[currPatt].tracks[currTrak].lines[currLine].effect_columns[1].amount_value = math.max(0, math.min(255, columns[thing] + chg))

into receiving instead of math.max, midi 0-127 knob data, and so that the 255 is mapped to 0-127.

uhh.

I do not understand this.I mean, I do not know what you want to do here.

I do not understand this.I mean, I do not know what you want to do here.

Hi. So, I’ve got keyboard shortcuts that allow for controlling of Effect Column content, which is really nice. But now I am attempting to go from a simple script that does +1/-1/+10/-10 (depending on the amount specific when calling the function via shortcuts or buttons) to “use a slider on this”. So I’m hoping to make it so that I have, say, a couple of midicontroller sliders, and those output, to Renoise, data 0…127 and that is mapped to the effect column space 0-FF (in the case of amount_column). so i’m wondering how to use this math so that a slider can be, functionally, mapped to this method of writing.

this is what the shortcut looks like:

function effectamount(amount,effectname)
-- massive thanks to pandabot for the optimization tricks!
local s=renoise.song()
local counter=nil
for i=s.selection_in_pattern.start_line,s.selection_in_pattern.end_line 
do 
s:pattern(s.selected_pattern_index):track(s.selected_track_index):line(i):effect_column(1).number_string=effectname
counter=s:pattern(s.selected_pattern_index):track(s.selected_track_index):line(i):effect_column(1).amount_value+amount 
if counter > 255 then counter=255 end
if counter < 1 then counter=0 end
s:pattern(s.selected_pattern_index):track(s.selected_track_index):line(i):effect_column(1).amount_value=counter 
  end
end

A slider (viewbuilder) can have a custom range. So you could configure your slider to accept the MIDI input range (0-127) and then scale the result before applying it to the parameter.

But - be aware that you’ll need to instantiate your own MIDI port connections if you want to roam freely around and control parameters.

(I know, it’s not part of the code you posted - but wanted to point this out in any case. The MIDI mapping dialog in Renoise (CTRL+M) binds to a single, specific parameter)…

Hi. So, I’ve got keyboard shortcuts that allow for controlling of Effect Column content, which is really nice. But now I am attempting to go from a simple script that does +1/-1/+10/-10 (depending on the amount specific when calling the function via shortcuts or buttons) to “use a slider on this”. So I’m hoping to make it so that I have, say, a couple of midicontroller sliders, and those output, to Renoise, data 0…127 and that is mapped to the effect column space 0-FF (in the case of amount_column). so i’m wondering how to use this math so that a slider can be, functionally, mapped to this method of writing.

this is what the shortcut looks like:

function effectamount(amount,effectname)
-- massive thanks to pandabot for the optimization tricks!
local counter=nil
for i=renoise.song().selection_in_pattern.start_line,renoise.song().selection_in_pattern.end_line 
do 
renoise.song():pattern(renoise.song().selected_pattern_index):track(renoise.song().selected_track_index):line(i):effect_column(1).number_string=effectname
counter=renoise.song():pattern(renoise.song().selected_pattern_index):track(renoise.song().selected_track_index):line(i):effect_column(1).amount_value+amount 
if counter > 255 then counter=255 end
if counter < 1 then counter=0 end
renoise.song():pattern(renoise.song().selected_pattern_index):track(renoise.song().selected_track_index):line(i):effect_column(1).amount_value=counter 
end
end

PS : I’m waiting for Raul to point out that you really should avoid all those renoise.song() statements :slight_smile:

A slider (viewbuilder) can have a custom range. So you could configure your slider to accept the MIDI input range (0-127) and then scale the result before applying it to the parameter.

But - be aware that you’ll need to instantiate your own MIDI port connections if you want to roam freely around and control parameters.

(I know, it’s not part of the code you posted - but wanted to point this out in any case. The MIDI mapping dialog in Renoise (CTRL+M) binds to a single, specific parameter)…

Well, thankfully I’m not using the LUI GUA viewbuilder at all for now, just direct CMD-M -bindable midimapping and keymapping, for now. I do have some eventual plans, once I figure out how to use for-loops to build GUI Viewbuilder buttons - as making them all by hand was really slow 5 years ago - considering i hardly knew what i was doing then - even now…

Anyway, I would be using external midi controller sliders to send 0…127 and am just trying to see how much I’d have to change to be able to directly write to selection_in_effect_column (even tho I’d mostly be in note_column) and, if no selection, then “current_row_effect_column”.

PS : I’m waiting for Raul to point out that you really should avoid all those renoise.song() statements :slight_smile:

Who me? You must’ve quoted me with a previous, older edit :wink: check now