change_tune (KSP) question

AdamFulara
AdamFulara Member Posts: 3 Newcomer
edited October 22 in Scripting Workshop

I have problem with change_tune events - it works with some Kontakt instruments (for example it works perfectly with Mark I Rhodes) and doesn't work with another (for example Orchestral - Trombone).


I did some investigation, and this function works with Trombone inside "on note" event, but doesn't work with "on controller" with proper note id.


The idea is to change the tunning after CC messages.

Here is a code without "CC information" just change a tune with any CC. We talk about single-note-playing 1 MIDI-voice polyphony.


on init

declare $n:=0


on note

$n:=$EVENT_ID

{   change_tune($n,20000,0) -THIS WOKRS PERFECTLY}

end on


on controller

   change_tune($n,7*20000,0)

{this DOESN"T WORK AT ALL IN TROMBONE, but works perfectly in Mark I}

end on

Comments

  • EvilDragon
    EvilDragon Moderator Posts: 1,031 mod

    You should probably try and use event marks. For example:

    on note
        set_event_mark($EVENT_ID, $MARK_28)
    end on
    
    on controller
        change_tune(by_marks($MARK_28)...
    end on
    
  • AdamFulara
    AdamFulara Member Posts: 3 Newcomer
    edited August 2022

    It doesn't work either, but I had figure it out.


    What happends is: some instruments during playing are creating new note events. After you play a note, there is some work in background and the same note receives some new event number. In case of "trombone" is old+1.


    If it would be another one, you have to check all active events in CC event and write it on the output - it's in Kontakt doc, part of it (you need declare vars)

    get_event_ids(%test_array)
    $a := 0
    $note_count := 0
    @events_no := ""
    while($a < $ARRAY_SIZE and %test_array[$a] # 0)
     if( $a = 0)
    {you can put change_tune here for changing all of active events}
      @text := @text & "found"& %test_array[$a]
       set_text($tekst, @text)
     end if
    
     inc($note_count)
     inc($a)
    end while
    

    Then check out which event is "change_tune" sensitive, and that's it.


    Thanks for trying helping me.

  • medusa
    medusa Member Posts: 98 Helper

    you can also change_tune($ALL_EVENTS) if that's simpler

  • AdamFulara
    AdamFulara Member Posts: 3 Newcomer

    For test, yes, but there is a lot of things going on (chords with change pitch of one note in it), so I had to track this particular event.

This discussion has been closed.
Back To Top