1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

[Kontakt 5] Optimal setup for RR with multiple microphones

Discussion in 'Scripting Workshop' started by Mordi, Dec 21, 2018.

  1. Mordi

    Mordi NI Product Owner

    Messages:
    22
    I'm new to creating a Kontakt instrument, and I want to create my own percussion library. I am wondering if I am on the right track, or if any of you (probably EvilDragon :p) can show me more efficient ways to map this out. Here's my current solution:

    Mapping
    - Six velocity layers
    - 12 x RR
    - Samples for close mics and far mics are stacked on top of each other on the same note.
    [​IMG]
    [​IMG]

    Groups
    - One group for every RR per mic.
    - I use "group start option" for RR (sequentially, to make sure close/far-mics play samples that correspond with each other).
    [​IMG]

    To enable the ability to balance the mics, I then route all the "far"-groups to one bus, and all the "close" groups to another bus.

    This seems to work quite well with just one key. However, I see some problems for when more are added:
    - When playing multiple notes, the round robins will increment for any note played. This means that if you were to play 12 keys at the same time, you might hear the same sample over and over for all of them. This is most probably possible to circumvent with scripting.
    - There isn't much in terms of flexibility. For example if I wanted to add a way to volume balance every percussion-instrument. Maybe it is possible to do this directly on the Zones using scripting?
    - There is a bit of an uncertainty when it comes to round-robins. Maybe they could become desynced at some point? Might be better to make a script that handles this.

    Am I doing this right, or is there anything I could do better/differently?
     
  2. Mordi

    Mordi NI Product Owner

    Messages:
    22
    I think I've got the basics figured out now.

    - I have an array with 127 integers which keeps track of the round-robin index for each key.
    - There is a button for toggling random-RR on and off
    - I also have an array for checking what round-robin was previously played, to avoid the machine-gun effect when using random-RR.

    Here's my note callback:
    Code:
    on note
        if rr_random = 0
            %rr_index[$EVENT_NOTE] := %rr_index[$EVENT_NOTE] + 1
            if %rr_index[$EVENT_NOTE] >= $MAX_RR
                %rr_index[$EVENT_NOTE] := 0
            end if
        else
            %rr_index_prev[$EVENT_NOTE] := %rr_index[$EVENT_NOTE]
            while %rr_index[$EVENT_NOTE] = %rr_index_prev[$EVENT_NOTE]
                %rr_index[$EVENT_NOTE] := random(0, $MAX_RR-1)
            end while
        end if
    
        disallow_group($ALL_GROUPS)
        allow_group(%rr_index[$EVENT_NOTE]) { Close }
        allow_group(%rr_index[$EVENT_NOTE] + 12) { Far }
    
        message("note -> " & $EVENT_NOTE & " / vel = " & $EVENT_VELOCITY & " / rr = " & rr_index[$EVENT_NOTE])
    end on
    
    - Maybe randomizing completely is a bad idea. Maybe it would be better to have the randomizer do random increments between 1 and 4, for example. This would ensure that any repeats would not happen within at least 3 notes played consecutively.

    To make this work with two microphone positions, I allow two groups after disallowing all. I had to reorder my groups consecutively in order for the samples to correspond to the same drum hit on both mics.
    [​IMG]
     
  3. medusa

    medusa NI Product Owner

    Messages:
    239
    This is a good basic method and keeps your robins + mic positions in sync. I would imagine since you have 12 robins, you're really not going to run into randomly repeated notes very often at all so this method is sufficient.

    If you wanted to get really anal you could "shuffle sort" the 12 so as to use them all up before repeating ... but that's overkill really.
     
  4. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Even more efficient way would be placing all 12 RRs chromatically in a single group, then use change_note() to trigger the correct RR. Saves up on groups in the instrument.
     
  5. medusa

    medusa NI Product Owner

    Messages:
    239
    That's definitely true if it's drums or something that doesn't use up very many notes.
     
  6. EvilDragon

    EvilDragon Well-Known Member

    Messages:
    19,938
    Seeing the image in first post, I only see a single key mapped, hence the suggestion :)
     
  7. Mordi

    Mordi NI Product Owner

    Messages:
    22
    After discovering these three functions:
    change_vol()
    change_pan()
    change_tune()

    I managed to implement controls for each individual key. I have three arrays, each with 128 values.

    [​IMG]

    The next step was to make variables persistent when you save the instrument.
    make_persistent()

    It was quite easy to do. I use the function above for any control or variable I want to make persistent. Then, I use the "on persistence_changed" callback, which is called either when an instrument is loaded or when a snapshot is loaded, to update any UI-elements that needed to be updated.
     
  8. Mordi

    Mordi NI Product Owner

    Messages:
    22
    I had some trouble figuring out how to actually make this instrument shareable. This article helped.
    It's a bit of a process, but I think this is how you're supposed to do it.

    - Do a "save as" on your instrument to a new folder, with "Patch + Samples" selected. Tick the "Compress samples" box as well.
    [​IMG]

    - Copy the "Resources" folder into this new folder.
    [​IMG]

    - Load the instrument into Kontakt. Edit instrument > Instrument Options. In the "Instrument" tab click "Create" next to where it says "Resource Container". Save it in the same folder as the instrument.
    [​IMG]

    - Delete the "Resources" folder that you copied earlier.

    Let me know if I forgot something.