Can you help me script my new "Origins" range?

Hey all,

This post is in reference to the instrument based here: https://www.pianobook.co.uk/packs/found-strings/

Here’s where you can help though. In order to create a truly workhorse set of samples built according to all the secret gems I’ve used to blag may way through a fairly successful career as a media composers I’ve started learning how to script. Even with these old samples I’m figuring out ways of creating a whole series of templates that make the sampling process simpler where the end results are consistent and give me what I need, nothing more, nothing less.

This is only my second attempt at scripting. I want to know if I’m doing the assignment of front GUI and CC#01 right?

Starter for 10 is the amount I’m getting both the GUI and CC001 to modulate the sound. Ideally I’d like it not to go all the way to nothing? Here’s my script as it currently stands, please let me know how to improve… and if you can, explain to me what any tweaks you make are doing.

on init

make_perfview
set_ui_height_px (603)
set_ui_width_px (1000)

set_control_par_str ($INST_WALLPAPER_ID,$CONTROL_PAR_PICTURE, “CH-Archive_Found-Strings-001″)

declare ui_slider $Hpf (0,700000)
$Hpf := 1000000
declare $Hpf_ID
$Hpf_ID := get_ui_id ($Hpf)
make_persistent ($Hpf)
read_persistent_var($Hpf)

move_control_px ($Hpf,390,272)
set_control_par_str ($Hpf_ID,$CONTROL_PAR_PICTURE,”KSP_RnD_Fader-Sprite-v5″)
set_control_par ($Hpf_ID,$CONTROL_PAR_MOUSE_BEHAVIOUR,1500)

declare ui_slider $Trim (0,1000000)
$Trim := 1000000
declare $Trim_ID
$Trim_ID := get_ui_id ($Trim)
make_persistent ($Trim)
read_persistent_var($Trim)

move_control_px ($Trim,156,200)
set_control_par_str ($Trim_ID,$CONTROL_PAR_PICTURE,”KSP_RnD_Encoder-Sprite-v2”)
set_control_par ($Trim_ID,$CONTROL_PAR_MOUSE_BEHAVIOUR,-1500)

end on

on ui_control ($Trim)

set_engine_par ($ENGINE_PAR_VOLUME,$Trim,0,-1,-1)
set_engine_par ($ENGINE_PAR_CUTOFF,$Hpf,-1,0,1)

end on

on controller

if ($CC_NUM=1)
$Trim := %CC[1] * 7874
set_engine_par ($ENGINE_PAR_VOLUME,$Trim,0,-1,-1)
set_engine_par ($ENGINE_PAR_CUTOFF,$Hpf,-1,0,1)
end if

end on

on ui_control ($Hpf)

set_engine_par ($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,$Hpf,-1,0,1)

end on

I don’t have any experience in Kontact programming, or a full copy of Kontact to test this on, but apparently that’s not enough to stop me weighing in - so this might be wrong in part or whole.

I’m not completely clear what the goal is here - it looks like this code declares two sliders in the UI

  • $Trim, linked to volume.
  • $Hpf, linked to both filter cutoff and send effect output gain.
    I’m not sure whether this second choice is deliberate.

In the UI, the sliders are labelled “Timbre” and “Splosh”. If I have understood the coordinate system correctly (0,0 in the upper left) then $Trim is linked to the “Timbre” knob, and $Hpf to the “Splosh” slider.

At the moment, the CC1 value is being mapped to $Trim, and from there to volume:

  if ($CC_NUM=1)
    $Trim := %CC[1] * 7874
    set_engine_par ($ENGINE_PAR_VOLUME,$Trim,0,-1,-1)
    set_engine_par ($ENGINE_PAR_CUTOFF,$Hpf,-1,0,1)
  end if

I’ve guessed in the version below that the goal is to have the UI act as the controls are labelled, and that “timbre” should control both volume and filter cutoff. Apologies if I’ve misunderstood.
I’ve added comments where I’ve made changes, as well as some indentation.

on init

  make_perfview
  set_ui_height_px (603)
  set_ui_width_px (1000)
  
  set_control_par_str ($INST_WALLPAPER_ID,$CONTROL_PAR_PICTURE, “CH-Archive_Found-Strings-001″)
  
  declare ui_slider $Hpf (0,700000)
  $Hpf := 700000 {this was originally higher than the max value of the slider}
  declare $Hpf_ID
  $Hpf_ID := get_ui_id ($Hpf)
  make_persistent ($Hpf)
  read_persistent_var($Hpf)
  
  move_control_px ($Hpf,390,272)
  set_control_par_str ($Hpf_ID,$CONTROL_PAR_PICTURE,"KSP_RnD_Fader-Sprite-v5")
  set_control_par ($Hpf_ID,$CONTROL_PAR_MOUSE_BEHAVIOUR,1500)
  
  declare ui_slider $Trim (7874,1000000)  {changed min to 7874 (so it won't go to 0)}
  $Trim := 1000000
  declare $Trim_ID
  $Trim_ID := get_ui_id ($Trim)
  make_persistent ($Trim)
  read_persistent_var($Trim)
  
  move_control_px ($Trim,156,200)
  set_control_par_str ($Trim_ID,$CONTROL_PAR_PICTURE,"KSP_RnD_Encoder-Sprite-v2")
  set_control_par ($Trim_ID,$CONTROL_PAR_MOUSE_BEHAVIOUR,-1500)

end on

on ui_control ($Trim)

  set_engine_par ($ENGINE_PAR_VOLUME,$Trim,0,-1,-1)
  set_engine_par ($ENGINE_PAR_CUTOFF,$Trim,-1,0,1)

end on

on controller

  if ($CC_NUM=1)
    $Trim := (%CC[1] * 7812) + 7874 {changed calculation - can go no lower than 7874.}
    {if you want this to be higher, the calculation is <step size> =  (1000000 - <lowest desired value>) / 127}
    {then update the formula to $Trim := (%CC[1] * <step size> ) + <lowest desired value> }
    set_engine_par ($ENGINE_PAR_VOLUME,$Trim,0,-1,-1)
    set_engine_par ($ENGINE_PAR_CUTOFF,$Trim,-1,0,1)
  end if

end on

on ui_control ($Hpf)

    set_engine_par ($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,$Hpf,-1,0,1)

end on
3 Likes

im not too versed in kontakt but i did script all my instruments and i programmed some intricate midi stuff, a way that i used in decent sampler to ensure nothing goes all the way to zero is set a range minimum like:

cc number=“23”
<binding level=“ui” type=“control” parameter=“VALUE” position=“4” translation=“linear” translationOutputMin="1" translationOutputMax=“25”/> "

you can program kontakt so that cc1 only goes down to 1% (i did that with all my spitfire libraries because i didnt want cc11 going down to 0) im not sure how to script such a thing but i know it can be done within kontakt to avoid hitting 0% so if you can just program the midi i believe there has to be a way to script the programming in.

hope this helps

here’s a screenshot of some programming i did for albion one with the darwin percussion ensamble, this allows a mic signal to go down to 1% cause i didnt want to turn it off and offload the samples.

I know nothing about Script. But I know I do like your new Found Strings library. Any chance of making a version for DS? :sunglasses:

THANK-You for the Decent Sampler version :+1: :+1: :+1:

1 Like