What's new

Different Volume Controls for Samples in 1 Group

Hi there, is it possible if I have a sample in my main group and use the drag and drop function to add another sample (which then ends up in my main group) to regulate the different volumes?

Lets say the Main sample is "XYZ" and the sample I loaded in is "ABC" both are loaded in GROUP "MAIN".
What I want is change the Volume of both separate in my Volume Menu. Is this possible?
 
First of all, don't get me wrong, but it'd be preferable to create a single thread for all of your questions instead of initiating separate ones (given that this question is related to the previous one).

As I mentioned earlier, the KSP Reference Manual is your best companion during this journey. Every sample you import into Kontakt, whether it's a user zone or a normal sample, is referred to as a 'zone' and is assigned a unique ID number. It's important to note that each time you add a new sample in Kontakt, the zone ID increases. Since your instrument features a waveform display, it means that you have the relevant code to retrieve the zone ID of each sample so that the correct waveform is displayed whenever you press a key. Take that zone ID and use it with set_zone_par and $ZONE_PAR_VOLUME.
 
Ok got it!

I tried this a couple times already now it works BUT when I mute the volume of the Main group the sound of the dropped sample "ABC" is gone even when I try to change the volume of this sample on its own. When I use the volume knob on "ABC" it blows my speakers. so where should I put the volume range? there is no example for this in the Reference Manual.

should it be like this?

set_zone_par(%NI_USER_ZONE_IDS[0], $ZONE_PAR_VOLUME, (-3600, 600))
 
Last edited:
ZONE_PAR_VOLUME has a range of -3600 to 3600.

Method #1: You will need to scale the values of your ui_slider so they give you values ranging from -3600 to 3600

Method #2 (aka the Lazy Method): You will need to create an array and input all the values ranging from -36 to 36. Then, read that array using the slider's value and a little bit of scaling and then multiply it by 100.


Code:
on init
  declare ui_slider $volume(0,1000000)
  make_persistent($volume)
  declare %values[73] := (-36, -35, -34, -33, -32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, ...
  5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36)
end on

on ui_control($volume)
  message(%values[$volume/13750]*100)
end on

The lazy method might not be everyone's favorite, but hey, it gets the job done, right? :)
 
still doesn't work.

I have 1 slider for all my groups and I wanna use only this one slider.
I change the groups in my volume menu.
As soon as I open (volume_menu = 7) and I only use the volume slider a lil bit its like the volume goes to 5000db

declare ui_slider $VOLUME(0,795000)
make_persistent($VOLUME)
declare $k_VOLUME
$k_VOLUME := get_ui_id($VOLUME)
set_control_par_str($k_VOLUME,$CONTROL_PAR_PICTURE,"w-3333")
set_control_par($k_VOLUME,$CONTROL_PAR_POS_X,306)
set_control_par($k_VOLUME,$CONTROL_PAR_POS_Y,31)
set_control_par($k_VOLUME,$CONTROL_PAR_MOUSE_BEHAVIOUR,$mouse_resp)
on ui_control($mainvolume)
if ($volume_menu = 0)
set_engine_par($ENGINE_PAR_VOLUME,$MAINVOLUME,$volume_menu,$VOLUME_SLOT,-1)
end if
......
if ($volume_menu = 7)
set_zone_par($ZONE_PAR_VOLUME, %NI_USER_ZONE_IDS[0],$MAINVOLUME)
end if
end on
 
Mainvolume's callback is incorrect.

Set_engine_par info -> click here

set_zone_par(%NI_USER_ZONE_IDS[0], $ZONE_PAR_VOLUME, <your controller with the scaled values as shown in my example>)

Literally, the answer has already been given in the previous responses.

Cheers!
 
OK the callback works now but is there a way to separate the Main Volume from the "Sample" volume?
When I turn the Main Volume up the Sample Volume goes up too. When I change it on volume_menu 7 then I could change it but as soon as I use the Main volume again the sample volume is the same as the main volume again that's so weird.

Is there a way to block the Main Volume function for the Sample?
 
it must be something like
if ($volume_menu = 0)
set_engine_par($ENGINE_PAR_VOLUME,$MAINVOLUME,$volume_menu,$VOLUME_SLOT,-1)
don't allow set_zone_par($ZONE_PAR_VOLUME, %NI_USER_ZONE_IDS[0],%values[$mainvolume/13750]*100)
end if

or not? I only know how disallow and allow works with groups or with
if ($ashfk = 0) then ...
end if
if (ashfk = 1) then ...
end if
end on

but I don't know how I could bypass or disallow this function
 
it must be something like
if ($volume_menu = 0)
set_engine_par($ENGINE_PAR_VOLUME,$MAINVOLUME,$volume_menu,$VOLUME_SLOT,-1)
don't allow set_zone_par($ZONE_PAR_VOLUME, %NI_USER_ZONE_IDS[0],%values[$mainvolume/13750]*100)
end if

or not? I only know how disallow and allow works with groups or with
if ($ashfk = 0) then ...
end if
if (ashfk = 1) then ...
end if
end on

but I don't know how I could bypass or disallow this function
@theodorech please help me with this it's the last piece I need for my library I'm really desperate
 
But I did help you! Literally, the answers you’re looking for are already available in this thread :)

I’m a bit confused with the extra code and how it’s related to “allow” and “disallow”.

If you switch between groups using the volume_menu then you don’t need the if clauses (unless you do something else).

In other words:

Code:
 set_engine_par($ENGINE_PAR_VOLUME, $volume_knob, <group>, -1, -1)

Control the volume of the user zone (the slider’s range on my example is 0 to 1 million). In case you wanna have a different range, then you’ll need to scale the value accordingly:

Code:
set_zone_par(%NI_USER_ZONE_IDS[0], $ZONE_PAR_VOLUME, %values[$mainvolume/13750]*100)

The journey is what truly matters, including the enjoyment you find in the process (such as studying code). Requesting ready-made code doesn’t facilitate learning.
 
But I did help you! Literally, the answers you’re looking for are already available in this thread :)

I’m a bit confused with the extra code and how it’s related to “allow” and “disallow”.

If you switch between groups using the volume_menu then you don’t need the if clauses (unless you do something else).

In other words:

Code:
 set_engine_par($ENGINE_PAR_VOLUME, $volume_knob, <group>, -1, -1)

Control the volume of the user zone (the slider’s range on my example is 0 to 1 million). In case you wanna have a different range, then you’ll need to scale the value accordingly:

Code:
set_zone_par(%NI_USER_ZONE_IDS[0], $ZONE_PAR_VOLUME, %values[$mainvolume/13750]*100)

The journey is what truly matters, including the enjoyment you find in the process (such as studying code). Requesting ready-made code doesn’t facilitate learning.
@theodorech check your messages I've sent you a Video of the problem
 
Top Bottom