Variable RR Script

  • This is the script that uses the new API calls to determine multiple Round Robin amounts.

    The onInit Callback:

    var thisLimit = 1;
    var rrIndex = 1;
    // Disable the default RR handling
    // New API call, this scans all existing sounds and writes a map of all RR group amounts

    The onNoteOn callback:

    // Returns the number of existing RRGroups for the note number / velocity combination
    thisLimit = Synth.getRRGroupsForMessage(Message.getNoteNumber(), Message.getVelocity());
    // This is a default RR logic, but you can implement other stuff here (eg. random, legato...)
       if(rrIndex > thisLimit)
          rrIndex = 1;
       // Changes the round robin index
       // Debugging stuff
       Console.print("Limit: " + thisLimit + ", Index: " + rrIndex);

    You will need the version 0.981 for it (coming soon…)

  • With this little script snippet, all groups in the sampler will be handled? There's no per-group stuff that needs to be done? That's what it looks like. If so, I am very pleased.

    Edit: How will this work when you are using group-per-legato-start(or end)-note as well, will it still work just like this?

  • Yeah, this should be all you need.

    Synth.refreshRRMap() creates a two dimensional map with 128 * 128 entries (for notenumber and velocity) which contains the maximal RR group for each entry (a little bit like Minesweeper).

    So a stripped down example (4x4) looks like this:

    1 1 2 1
    0 1 1 2
    1 2 3 1
    2 1 1 1

    and calling Synth.getRRGroupsAmount(2, 3) would return 2 in this case (second column, third row)

    It doesn't support gaps in the RR groups tough (only the maximal amount), so legato group handling wouldn't work with this.

  • Questions!

    1. Does the Sampler Settings / RR Groups number input box contol how many round robin will be cycled or is it just to control how many groups show up in the group listing?

    2. If the RR Groups number controls how many round robins will be cycled, does it also affect the RR Handling scripting API?

  • 1. The RR Groups input box controls both number of shown groups as well as number of cycles - if the default RR logic is used.

    2. As soon as you disable the default RR group behaviour with 'Synth.enableRoundRobin(false)', it will only control the number of shown groups, because then you need to set the used group manually with 'Synth.setRRGroup(x)' in every onNoteOn callback - otherwise only the first group is used.

  • Cool stuff–currently handling variable RR in Kontakt is a bit of a nuisance. Right now it usually involves "blipping" a zone to see if it exists first. This can always be cached into a lookup table (that's what I did when scripting CineBrass, for example), but the problem is that the only way you can see if a zone exists in a group/velocity/pitch is by actually playing it. If the zone ID returns "-1", then you know there's no sample. It's inefficient because ideally you should be able to check mapping-related data directly through scripting.

Log in to reply