Help on my script

Lucio argentina
Lucio argentina Member Posts: 1 Newcomer
edited December 2022 in Scripting Workshop

on init

on midi_in

select($MIDI_BYTE_1)

case 04

message("Prog A")

$prog_num := 0

set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PROGRAM_CHANGE,$prog_num,0)

case 06

message("Prog B")

$prog_num := 1

set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PROGRAM_CHANGE,$prog_num,0)

case 08

message("Prog C")

$prog_num := 2

set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PROGRAM_CHANGE,$prog_num,0)

case 09

message("Prog D")

$prog_num := 3

set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PROGRAM_CHANGE,$prog_num,0)

end select

end if

end on

Comments

  • Paule
    Paule Member Posts: 1,328 Expert

    This isn't JAVA what you wrote. Hm mystery. Is it a s-c-r-i-p-t for Kontakt?

    There is too less information by you. Or is it BASIC programming?

  • stephen24
    stephen24 Member Posts: 276 Pro

    What MIDI messages are you sending to Kontakt to implement your Program Change? You haven't specified the command byte, so any aftertouch message or cc# which has one of your values in the 2nd byte will trigger the script. Your script is riddled with errors, which are specified for you in the syntax checker at the bottom of the script window each time you click Apply. You must declare any variables in an init callback before you start. And where did "end if" come from?

    If you just want to change the number of the PC perhaps you don't need any variables - try

    on midi_in

     if ($MIDI_COMMAND = $MIDI_COMMAND_PROGRAM_CHANGE)

      select($MIDI_BYTE_1)

       case 04

        message("Prog A")

        set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PROGRAM_CHANGE,0,0)

       case 06

        message("Prog B")

        set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PROGRAM_CHANGE,1,0)

       case 08

        message("Prog C")

        set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PROGRAM_CHANGE,2,0)

       case 09

        message("Prog D")

        set_midi($MIDI_CHANNEL,$MIDI_COMMAND_PROGRAM_CHANGE,3,0)

      end select

     end if

    end on

  • Jeremy_NI
    Jeremy_NI Customer Care Posts: 9,321 mod

    Hey @Lucio argentina Some more info would be nice, as well as a more specific title. The more information you give, the easiest it is for other users to help you out.

  • Gablux
    Gablux Member Posts: 71 Member

    yeap, without a specific request on what you need help with, there's no way people will just try to guess what you want or need @Lucio argentina .

Back To Top