Session Horns Pro - Doits/Falls on Sustain Release

Harlan
Harlan Member Posts: 5 Newcomer
edited October 22 in Scripting Workshop

Hi Community,

I play keyboards in a Caribbean/Latin band and for me that means playing lots of horns parts combined with many other instruments. I have configured my Session Horns Pro so that the doits/falls play on key release. Thing is I often find myself needing to sustain a note (or harmony) for some time while playing some other sound and then ending the section with either a doit or fall. I don't want to repress the key(s) and let go again to trigger a key release MIDI message.

Is there any way to make the horns play doits/falls on sustain release as well?

I'm not familiar at all (yet) with editing Kontakt instruments "under the wrench". All my tweaking I usually do in the instrument's user friendly interface itself.

Any help with achieving "playing doits/falls on sustain release" will be greatly appreciated.

Thanks in advance!

Harlan

Comments

  • stephen24
    stephen24 Member Posts: 417 Pro

    Not sure what you mean by "sustain release". If you mean releasing the sustain pedal, it should play your release samples. Make sure it's enabled in Instrument Options/Controller/MIDI controller#64.

  • Harlan
    Harlan Member Posts: 5 Newcomer

    Hi @stephen24 thanks a lot for your reply.

    Yes, sorry for the confusion, I mean when releasing the sustain pedal I would like Session Horns Pro to play doits/falls if I have the pitch wheel engaged. Currently it only does so when I release a note when releasing the key.

    So, I would love to be able to have it do so as well when I play a note / engage pitch wheel / hold note with my sustain pedal / release the key (no doit/fall yet) / release the sustain pedal (doit/fall samples play). Currently when I release the sustain pedal the note just stops playing.

    I do have MIDI Controller #64 configured as "Pedal with CC". Should it be set to a different value?

  • stephen24
    stephen24 Member Posts: 417 Pro

    If a group is programmed as "Release Trigger" (in the Source module - you can check this if you can find the doit group) its samples should be triggered by a note-off message, or by a cc#64 = 0 message (i.e pedal release) for any playing notes whose key has been released. (The pitchbend wheel has no bearing.) If as seems the case this doesn't happen, it's being overridden by a script, so it's unlikely you can do anything about it.

    An instrument script to send the appropriate note-off messages when the sustain pedal is released could be done, but it would be quite tricky to write. In general messing with these (often inadequately) heavily scripted instruments is not recommended. You could suggest an update to the authors.

  • Harlan
    Harlan Member Posts: 5 Newcomer

    Thanks a bunch @stephen24!

    My first thought was to indeed suggest the change, but I still hoped that there was a way, something I was overlooking. Looks like I'm gonna have to take the long route after all. 😉

    Thanks!

  • stephen24
    stephen24 Member Posts: 417 Pro

    You could try this multiscript. KSP button at top rh corner of Kontakt window>Edit. Paste this code and click Apply (yellow light should go out.) I'd love to know if it works.

    on init
    declare $sustain :=0
    declare %notes[128] :=(-1)
    declare $notes
    end on
    
    on midi_in
    
    if (($MIDI_COMMAND = $MIDI_COMMAND_CC) and ($MIDI_BYTE_1 = 64))
     $sustain := $MIDI_BYTE_2
    
    if ($MIDI_BYTE_2 = 0)
     $notes :=127
     while ($notes >= 0)
      if (%notes[$notes] =1)
       set_midi ($MIDI_CHANNEL,$MIDI_COMMAND_NOTE_OFF, $notes, 0)
      end if
      %notes[$notes] := -1
      dec ($notes)
     end while
     end if
    end if
    
    if (($sustain >0) and ($MIDI_COMMAND = $MIDI_COMMAND_NOTE_OFF))
    %notes[$EVENT_PAR_MIDI_BYTE_1] := 1
    end if
    
    if (($sustain >0) and ($MIDI_COMMAND = $MIDI_COMMAND_NOTE_ON))
    %notes[$EVENT_PAR_MIDI_BYTE_1] := -1
    end if
    
    end on
    


  • Harlan
    Harlan Member Posts: 5 Newcomer

    @stephen24 unfortunately that didn't work, but I really liked the idea! If you happen to have more scripts like that, I'd love to try them out.

    Thanks again!

  • stephen24
    stephen24 Member Posts: 417 Pro

    Sorry, should have tested it. Error corrected. Try again!

    on init
    declare $sustain :=0
    declare %notes[128] :=(-1)
    declare $notes
    end on
    
    on midi_in
    
    if (($MIDI_COMMAND = $MIDI_COMMAND_CC) and ($MIDI_BYTE_1 = 64))
     $sustain := $MIDI_BYTE_2
    
    if ($MIDI_BYTE_2 = 0)
     $notes :=127
     while ($notes >= 0)
     if (%notes[$notes] =1)
      set_midi ($MIDI_CHANNEL,$MIDI_COMMAND_NOTE_OFF, $notes, 0)
     end if
     %notes[$notes] := -1
     dec ($notes)
     end while
     end if
    end if
    
    if (($sustain >0) and ($MIDI_COMMAND = $MIDI_COMMAND_NOTE_OFF))
    %notes[$MIDI_BYTE_1] := 1
    end if
    
    if (($sustain >0) and ($MIDI_COMMAND = $MIDI_COMMAND_NOTE_ON))
    %notes[$MIDI_BYTE_1] := -1
    end if
    
    end on
    


  • stephen24
    stephen24 Member Posts: 417 Pro

    Found another potential error. (in case they use Note_on = 0 for Note_off)

    on init
    declare $sustain :=0
    declare %notes[128] :=(-1)
    declare $notes
    end on
    
    on midi_in
    
    if (($MIDI_COMMAND = $MIDI_COMMAND_CC) and ($MIDI_BYTE_1 = 64))
     $sustain := $MIDI_BYTE_2
    
    if ($MIDI_BYTE_2 = 0)
     $notes :=127
     while ($notes >= 0)
     if (%notes[$notes] =1)
      set_midi ($MIDI_CHANNEL,$MIDI_COMMAND_NOTE_OFF, $notes, 0)
     end if
     %notes[$notes] := -1
     dec ($notes)
     end while
     end if
    end if
    
    if (($sustain >0) and ($MIDI_COMMAND = $MIDI_COMMAND_NOTE_OFF))
    %notes[$MIDI_BYTE_1] := 1
    end if
    
    if (($sustain >0) and ($MIDI_COMMAND = $MIDI_COMMAND_NOTE_ON))
     if ($MIDI_BYTE_2 = 0)
     %notes[$MIDI_BYTE_1] := 1
     else
     %notes[$MIDI_BYTE_1] := -1
     end if
    end if
    end on
    
    
    


  • Harlan
    Harlan Member Posts: 5 Newcomer

    I'll try this one, because the previous one did nothing either.

    Btw, I'm a software developer by day, so I can follow the logic. 😊

    However, I don't know this scripting language, so I'm not entirely sure what everything is doing.

    Thanks again and a happy weekend with lots of music!

  • stephen24
    stephen24 Member Posts: 417 Pro

    Good.

    It just stores all the notes_off (note releases) that occur while the pedal is down, in an array, yes = 1, no = -1, then plays them all again when the pedal is released. It works as intended - the latest update was in case your keyboard or whatever sends note_on = 0 instead of note_off, as some do. You can help debugging by opening another multiscript to the right of our custom script, Preset>Factory>Utilities>Midi Monitor, switch off everything except Note-on Note-off and Verbose Mode, then experimenting with your keyboard and sustain pedal.

    The only other possibility I can think of is that the instrument's script doesn't like note_off without a previous note_on. In that case you could suppress the pedal-down note_off. Just insert a line of text "ignore_midi" immediately after the two instances of

    %notes[$MIDI_BYTE_1] := 1
    

    near the end

This discussion has been closed.
Back To Top