What's new

How do I transpose individual groups and control via GUI?

The Darris

Senior Member
I am working on a private project for myself and a client. We have a set of staccato samples for Flutes, Oboes, and Clarinets. I want to create an "orchestrated" patch wherein we can transpose the individual groups (instruments) up or down from the played note, thus creating chords.

I'm not very versed at KSP so please treat me like a beginner. I've done a few things in the past but it's been so long, I'm out of practice in using the scripting language.

Basically, I just want to set labels on a plain GUI with a transpose display allowing me to go up or down (+/- 12 steps). It would be great if we could add a second voice to each instrument giving those groups a polyphony of 2 voice but I don't know if you can transpose two voices within a single group. If I need to, I can always duplicate the groups into six to be able to control their transposition as well.

In the past, we've simply created Kontakt multis and transposed the individual instruments accordingly but this takes up more resources than we'd like, especially if we could streamline this function into one patch. Any ideas on where I can start?

Best,

Chris
 

tonaliszt

Active Member
Hey Chris,
I'd start by looking through the code in the factory Kontakt scripts (something in the Harmonize folder - depending on your specific needs.)
It should be fairly easy to modify to only apply to selected groups by going into the on note section and putting an if section and making sure it only affects a certain group number.
Hope this helps, I'm sure others can chime in with other ideas.
 
OP
The Darris

The Darris

Senior Member
Hey Chris,
I'd start by looking through the code in the factory Kontakt scripts (something in the Harmonize folder - depending on your specific needs.)
It should be fairly easy to modify to only apply to selected groups by going into the on note section and putting an if section and making sure it only affects a certain group number.
Hope this helps, I'm sure others can chime in with other ideas.
I would if I could but I totally deleted that content ages ago. I never really used it or found use for it but I do appreciate the help either way.
 

EvilDragon

KSP Wizard
Ah gotcha. :)

At any rate, just the transposing part is not too complicated to do. I am assuming you have one group per sound?
 
OP
The Darris

The Darris

Senior Member
Ah gotcha. :)

At any rate, just the transposing part is not too complicated to do. I am assuming you have one group per sound?
Yes. My groups are: FLUTES, OBOES, and CLARINETS. All staccato samples are mapped accordingly. One dynamic layer.
 

EvilDragon

KSP Wizard
It'd be something like:

Code:
on init
    declare const $TRANSPOSE_RANGE := 24

    declare $i
    declare $transpose

    declare ui_knob $Flutes (-$TRANSPOSE_RANGE, $TRANSPOSE_RANGE, 1)
    declare ui_knob $Oboes (-$TRANSPOSE_RANGE, $TRANSPOSE_RANGE, 1)
    declare ui_knob $Clarinets (-$TRANSPOSE_RANGE, $TRANSPOSE_RANGE, 1)

    declare $eventID
    declare $ID
    $ID := get_ui_id($Flutes)

    $Flutes := 0
    $Oboes:= 0
    $Clarinets:= 0

    set_knob_defval($Flutes, 0)
    set_knob_defval($Oboes, 0)
    set_knob_defval($Clarinets, 0)

    set_knob_unit($Flutes, $KNOB_UNIT_ST)
    set_knob_unit($Oboes, $KNOB_UNIT_ST)
    set_knob_unit($Clarinets, $KNOB_UNIT_ST)

    make_persistent($Flutes)
    make_persistent($Oboes)
    make_persistent($Clarinets)

end on

on note
    ignore_event($EVENT_ID)u

    $i := 0
    while ($i < 3)
        $transpose := $EVENT_NOTE + get_control_par($ID + $i, $CONTROL_PAR_VALUE)

        if (in_range($transpose, 0, 127))
            $eventID := play_note($transpose, $EVENT_VELOCITY, 0, -1)
            set_event_par_arr($eventID, $EVENT_PAR_ALLOW_GROUP, 0, $ALL_GROUPS)
            set_event_par_arr($eventID, $EVENT_PAR_ALLOW_GROUP, 1, $i)
        end if

        inc($i)
    end while
end on
 
Top Bottom