Script Remape CC´s - Is there this script for an Instrument?

TomArrow
TomArrow Member Posts: 10 Member
edited October 2024 in Scripting Workshop

Hi,

I want to set an CC Signal on 0 to 127. With the script Remape CC´s it is possible on the KSP. Is there this script for an instrument.

Thanks for helping

Thomas

Comments

  • TomArrow
    TomArrow Member Posts: 10 Member

    Sorry I´ve forgotten to tell why I need such a script:

    I had build in to every instrument the script transpose. The Octave Knob is conected with a CC. The CC is from 0 to 50%. So I can stop and open the midi in notes to surch the instruments while i play with. On my Akai LPD 8 I can not programm den Pads to send 0 or 127. So I have to juse the KSP Remap CC - it works fine - but there are only 5 slots for this script. Copy the script in the instrument does´nt work.

    If someone knows a script where i can stop the notes (but not the cc) it would be also helpfull

    Thanks

  • TomArrow
    TomArrow Member Posts: 10 Member

    Why does´nt work this script not on the instrument script slot?

    on init

       set_script_title("Remap CCs")

       set_ui_height(3)


       declare ui_value_edit $CCNum (0, 127, 1)

       declare ui_table %EditMap[128] (5, 4, 127)

       declare ui_switch $Reset

       declare ui_switch $Invert

       declare ui_menu $Channel

       declare ui_label $In (1, 1)

       declare ui_label $Out (1, 1)


       set_control_par(get_ui_id(%EditMap), $CONTROL_PAR_WIDTH, 518)

       set_control_par(get_ui_id(%EditMap), $CONTROL_PAR_HEIGHT, 102)


       declare $i

       declare $j

       declare %last_CC[128] := (-1)

       declare %maps[128 * 128]

       declare %temp[128]

       declare !port[4]

       !port[0] := "A"

       !port[1] := "B"

       !port[2] := "C"

       !port[3] := "D"


       $i := 0

       while ($i < 128)

          if ($i < 64)

             add_menu_item($Channel,"Port: [" & !port[$i / 16] & "] Ch: " & ($i mod 16) + 1,$i)

          end if


          $j := 0

          while ($j < 128)

             %maps[($i * 128) + $j] := $j

             inc($j)

          end while


          %EditMap[$i] := $i


          inc($i)

       end while


       $CCNum := 1


       set_text($CCNum, "CC#")

       set_text($In, "In:")

       set_text($Out, "Out:")


       set_control_help($Channel, "MIDI Port/Channel: Selects the MIDI port and MIDI channel for which Control Change value remapping will be carried out.")

       set_control_help($CCNum, "Control Change Number: Selects which Control Change number will be displayed in the above table for editing the value mapping.")

       set_control_help($Reset, "Reset Mapping: Resets the mapping for the currently selected Control Change number to the default linear curve.")

       set_control_help($Invert, "Invert Mapping: Inverts the mapping for the currently selected Control Change number.")

       set_control_help(%EditMap, "Mapping Editor: Table which modifies the input-to-output mapping for the currently selected Control Change number.")


       set_control_par(get_ui_id($Reset), $CONTROL_PAR_TEXT_ALIGNMENT, 1)

       set_control_par(get_ui_id($Invert), $CONTROL_PAR_TEXT_ALIGNMENT, 1)

       set_control_par(get_ui_id($In), $CONTROL_PAR_WIDTH, 48)

       set_control_par(get_ui_id($Out), $CONTROL_PAR_WIDTH, 48)


       make_persistent($CCNum)

       make_persistent(%maps)


       read_persistent_var($CCNum)

       read_persistent_var(%maps)


       $i := 0

       while ($i < 128)

          %EditMap[$i] := %maps[($CCnum * 128) + $i]

          inc($i)

       end while


       move_control_px(%EditMap, 90, 2)

       move_control_px($Channel, 90, 107)

       move_control_px($CCNum, 182, 107)

       move_control_px($Reset, 520, 107)

       move_control_px($Invert, 428, 107)

       move_control_px($In, 298, 107)

       move_control_px($Out, 350, 107)


       message("")

    end on



    on ui_control (%EditMap)

       $i := 0

       while ($i < 128)

          %maps[($CCNum * 128) + $i] := %EditMap[$i]

          inc($i)

       end while

    end on


    on ui_control ($CCnum)

       $i := 0

       while ($i < 128)

          %EditMap[$i] := %maps[($CCNum * 128) + $i]

          inc($i)

       end while


       if (%last_CC[$CCNum] # -1)

          set_text($In, "In: " & %last_CC[$CCNum])

          set_text($Out, "Out: " & %maps[($CCNum * 128) + %last_CC[$CCNum]])

       else

          set_text($In, "In: ")

          set_text($Out, "Out: ")

       end if

    end on


    on ui_control ($Reset)

       $i := 0

       while ($i < 128)

          %EditMap[$i] := $i

          %maps[($CCNum * 128) + $i] := %EditMap[$i]

          inc($i)

       end while


       wait(150000)


       $Reset := 0

    end on


    on ui_control ($Invert)

       $i := 0

       while ($i < 128)

          %temp[$i] := %EditMap[$i]

          inc($i)

       end while


       $i := 0

       while ($i < 128)

          %EditMap[$i] := %temp[127 - $i]

          %maps[($CCNum * 128) + $i] := %EditMap[$i]

          inc($i)

       end while


       wait(150000)


       $Invert := 0

    end on



    on midi_in

       if ($MIDI_CHANNEL = $Channel and $MIDI_COMMAND = $MIDI_COMMAND_CC)

          %last_CC[$MIDI_BYTE_1] := $MIDI_BYTE_2

          set_event_par($EVENT_ID, $EVENT_PAR_MIDI_BYTE_2, %maps[($MIDI_BYTE_1 * 128) + $MIDI_BYTE_2])


          if (%last_CC[$MIDI_BYTE_1] # -1 and $CCNum = $MIDI_BYTE_1)

             set_text($In, "In: " & $MIDI_BYTE_2)

             set_text($Out, "Out: " & %maps[($MIDI_BYTE_1 * 128) + $MIDI_BYTE_2])

          end if

       end if

    end on

This discussion has been closed.
Back To Top