Post by ki on May 30, 2019 20:22:30 GMT
The 8 drum notes output by Rozeta X0X or Rhythm are split onto separate midi output channels and remapped to new notes with GUI.
This script is an update to my previous „Split Rozeta XoX/Rhythm to separate midi channels“ script.
There are two main differences:
Saving a preset or the hosts session persists the current setting.
The script showcases many of the new StreamByter features: defines, aliases, subroutines, a while loop and plugin naming.
This script is an update to my previous „Split Rozeta XoX/Rhythm to separate midi channels“ script.
There are two main differences:
- The old script supported two output notes for ‚normal‘ and ‚accented‘ input notes, now only one note can be specified.
- The updated script uses the new slider gui and is therefore a lot simpler to use:
- No more editing of hex values - you can interactively tweak until the correct note is output.
- Two edit modes: Using note numbers or note names - select the current mode on the second UI page.
Saving a preset or the hosts session persists the current setting.
The script showcases many of the new StreamByter features: defines, aliases, subroutines, a while loop and plugin naming.
# Channel Split & Remap XOX/Rhythm using UI
#
# Version: 8 / 30.05.2019
# Author: -ki https://forum.audiob.us/profile/_ki
#
# Instructions:
# Use Ruismaker template in Roezta XOX/Rhythm settings.
#
# Use the GUI for remap-setup and then store/recall
# the settings together with the hosts session.
#
#
# The notes/SLIDERS button on the second widget page
# allows to toggle the input GUI.
# In case of slider GUI, the Sliders: min/max allow
# to adjust the range of the note output sliders.
# Interacting with the sliders will show the current
# note name in the right label.
#
# ——— No need to modify anything in the script itself ——-
#
# Version history
# v8 / 30.05.2019 Added back button
# v7 / 20.05.2019 Added longer Title
# v6 / 09.05.2019 Added toggle to use sliders or notes as GUI
# v5 / 07.05.2019 Applied capitalization programming style
# v4 / 05.05.2019 Hide unused sliders, reshow name after using sliders
# v3 / 27.04.2019 Set name, open sliders, refactored with alias and define
# v2 / 25.04.2019 Added min/max note and slider rescaling
# v1 / 24.04.2019 Inital version
# ———————-———————-———————————————————————- Alias & Define
if LOAD
alias L0 xoxNotes # 8 xox notes
alias Q0 outNotes # 8 output notes
alias K0 notesSend # 8 send notes
alias I0 idx
alias I1 cmd
alias I2 minUpperRange
alias I3 maxLowerRange
alias I4 sysexKey
alias LI0 xoxNotes[idx]
alias QI0 outNotes[idx]
alias KI0 notesSend[idx]
alias Q8 useSliders
alias Q9 minSlider
alias QA maxSlider
alias MT midiCmd
alias M0 midiData
alias M1 midiNote
alias M2 midiNoteVelocity
alias M3 midiSliderId
alias M3 midiSysexKey
define NOTE_ON_MSG 90
define NOTE_OFF_MSG 80
define SYSEX_SLIDER_MSG F0 7D 01
define SYSEX_SHOW_NAME_MSG F0 7D 02
define SYSEX_END_INJECT F7 +INJECT
sub ReDisplayScriptName
math sysexKey = sysexKey + 1
math sysexKey = sysexKey & 7F
send SYSEX_SHOW_NAME_MSG sysexKey SYSEX_END_INJECT +D1500
end
sub ShowNoteName num
set LB1 num +NOTE
ReDisplayScriptName
end
end
# ———————-———————-———————————————————————- NoteOn & NoteOff
assign idx = 0
while idx < 8
if midiNote == xoxNotes[idx]
# //—— NoteOn
if midiCmd == NOTE_ON_MSG
math cmd = NOTE_ON_MSG + idx
send cmd outNotes[idx] midiNoteVelocity
assign notesSend[idx] = outNotes[idx]
end
# //—- NoteOff
if midiCmd == NOTE_OFF_MSG
math cmd = NOTE_OFF_MSG + idx
send cmd notesSend[idx] midiNoteVelocity
end
block
exit
end
math idx = idx + 1
end
# ———————-———————-———————————————————————- Sysex Slider
if midiData == SYSEX_SLIDER_MSG
if midiSliderId < 8
assign idx = midiSliderId
if useSliders == 1
set LB0 SMap_to
ShowNoteName outNotes[idx]
end
end
if midiSliderId == 9
set LB0 SMin
ShowNoteName minSlider
end
if midiSliderId == A
set LB0 SMax
ShowNoteName maxSlider
end
if midiSliderId == F
set SLIDER_DISPLAY 1
end
# Label and rescale the sliders
if useSliders == 1
set Q0 Ch1_out_:_BD minSlider maxSlider
set Q1 Ch2_out_:_SD minSlider maxSlider
set Q2 Ch3_out_:_CP minSlider maxSlider
set Q3 Ch4_out_:_LT minSlider maxSlider
set Q4 Ch5_out_:_MT minSlider maxSlider
set Q5 Ch6_out_:_HT minSlider maxSlider
set Q6 Ch7_out_:_CH minSlider maxSlider
set Q7 Ch8_out_:_OH minSlider maxSlider
set Q8 notes/SLIDERS 0 1 +BUTTON
else
set Q0 Ch1_out_:_BD 0 7F +NOTES
set Q1 Ch2_out_:_SD 0 7F +NOTES
set Q2 Ch3_out_:_CP 0 7F +NOTES
set Q3 Ch4_out_:_LT 0 7F +NOTES
set Q4 Ch5_out_:_MT 0 7F +NOTES
set Q5 Ch6_out_:_HT 0 7F +NOTES
set Q6 Ch7_out_:_CH 0 7F +NOTES
set Q7 Ch8_out_:_OH 0 7F +NOTES
set Q8 NOTES/sliders 0 1 +BUTTON
end
math minUpperRange = maxSlider - 9
math maxLowerRange = minSlider + 9
set Q9 Sliders:_Min 0 minUpperRange
set QA Sliders:_Max maxLowerRange 7F
set QB +HIDE
set QC +HIDE
set QD +HIDE
set QE +HIDE
set QF Back +BUTTON
end
# ———————-———————-———————————————————————- ShowName Sysex
if midiData == SYSEX_SHOW_NAME_MSG
if midiSysexKey == sysexKey
# only the last delayed sysex has the correct key
set LB0 SSplit_X0X
set LB1 S-
end
end
# ———————-———————-———————————————————————- Initialization
if LOAD
# BD SD CP LT MT HT CH OH
assign xoxNotes = $49 $51 $54 $56 $58 $61 $63 $66
assign outNotes = $49 $51 $54 $56 $58 $61 $63 $66 +P # persistant
assign notesSend = 0 0 0 0 0 0 0 0
assign useSliders = 1 +P
assign minSlider = $36 +P
assign maxSlider = $96 +P
send SYSEX_SLIDER_MSG 7F SYSEX_END_INJECT
set LB0 SSplit_X0X
set NAME SR-X0X_Split&RemapX0X
set SLIDER_DISPLAY 1
end