StreamByter: Channel Filter with GUI

Here’s a StreamByter script that allows to filter for a specific input channel range, only midi events that are inside this range will be echoed to the output of the script.

# === Midi Channel Filter with GUI ===
# Version:  1 / 01.03.2020
# Author: -ki   https://forum.audiob.us/profile/_ki 
#
# Instructions:
#    Use the sliders for channel setup and then store/recall
#    the settings together with the hosts session.
#
# ——— No need to modify anything in the script itself ——-

# ———————-———————-———————————————————————- Alias & Define
alias F0 SYSEX_MSG

alias MT MIDI_CMD
alias MC MIDI_CHANNEL
alias M0 MIDI_DATA
alias M3 MIDI_SL_NUM

alias Q1 beg_channel
alias Q2 end_channel
alias I0 tmp

define SYSEX_SLIDER_MSG F0 7D 01
define SYSEX_END_INJECT F7 +I

# ———————-———————-———————————————————————- All except sysex
if MIDI_CMD < SYSEX_MSG
  math tmp = MIDI_CHANNEL + 1
  if tmp < beg_channel
    block
  end
  if tmp > end_channel
    block
  end
end

# ———————-———————-———————————————————————- Slider Sysex 
if MIDI_DATA == SYSEX_SLIDER_MSG
  if MIDI_SL_NUM == 1
    if end_channel < beg_channel
      assign end_channel = beg_channel
    end
  end
  
  if MIDI_SL_NUM == 2
    if beg_channel > end_channel
      assign beg_channel = end_channel
    end
  end
  
  set LB0 beg_channel +D
  set LB1 end_channel +D
end

# ———————-———————-———————————————————————- Initialization
if LOAD
  # Persistant slider vars
  assign beg_channel = 1 +P
  assign end_channel = $16 +P
  
  # Label and scale the sliders
  set Q0 Channel_Filter +BUTTON
  set Q1 First_CH 1 $16
  set Q2 Last_CH 1 $16
  set Q3 +HIDE
  set Q4 +HIDE
  set Q5 +HIDE
  set Q6 +HIDE
  set Q7 +HIDE
  
  set SLIDER_DISPLAY 1
  
  set LB0 beg_channel +D
  set LB1 end_channel +D
end
  • streambyter_channel_filter.txt
  • Last modified: 2020/03/01 20:48
  • by _ki