This is an old revision of the document!
StreamByter: CC High Range Remap with GUI
The following script allows to remap the values of a specific CC. Values higher than a threshold are remapped to a new range.
# === CC High Range Remap ===
# Remaps the range of a single CC. Values higher than
# a threshold are remapped to a new range.
#
# Input Output
# 0 to Threshold 0
# Threshold to 127 0 to Output Range
#
# One of its use-cases is to remap an XY CC controller
# to output its vibrato CC-1 only on the right half of
# the XY controller and at the same time limit the
# vibrato to a specific range
#
# Author: -ki https://forum.audiob.us/profile/_ki
#
# ——— No need to modify anything in the script itself ——-
#
# Version history
# v1 / 14.05.2021 Initial version
alias Q0 input_cc
alias Q5 threshold
alias Q6 output_range
alias I4 curr_val
alias I5 last_output
alias I6 last_M0
alias I7 last_M1
alias I8 last_M2
alias I9 out_M2
if LOAD
subroutine remap value
if value < threshold
assign curr_val = 0
else
math I0 = $127 - threshold
math I1 = value - threshold
math I2 = I1 * output_range
math curr_val = I2 / I0
end
end
set NAME CC_High_Range_Remap
# Default values
assign threshold = $64 +P
assign output_range = $127 +P
assign input_cc = $1 +P
assign last_output = FF
# Set slider values
assign Q0 = input_cc
assign Q5 = threshold
assign Q6 = output_range
# Set slider UI names
set Q0 Input_CC# 1 $120
set Q1 +hide
set Q2 +hide
set Q3 +hide
set Q4 +hide
set Q5 Threshold 0 $126
set Q6 Output_Range 0 $127
set Q7 +hide
set slider_display 1
end
if MT == B0
if M1 == input_cc
remap M2
assign last_M0 = M0
assign last_M1 = M1
assign last_M2 = M2
# Check if CC update is needed
if last_output != curr_val
assign last_output = curr_val
assign M2 = curr_val
else
block
end
end
end
# Slide Output_Range change, update CC if needed
if M0 == F0 7D 01 06
remap last_M2
if last_output != curr_val
assign last_output = curr_val
send last_M0 last_M1 curr_val
end
end