What's new

Whats wrong with this code for IR size?

Tod

Senior Member
I've got convolution verb setup in the send effects and would like to know what's wrong with this code. It works in one of my K5 instruments but not in another.

c1 is the index of the knob ID, and I've got the parameter values setup in an array "%EP_Nm" which has an index that coincides with the knob ID.

Code:
          c3 := %Knb_ID[c1]->value mod 10
          set_engine_par(%EP_Nm[c1],%Knb_ID[c1]->value*1000,-1,5,0)
          %KnbVal_ID[c1]->text:=""&(%Knb_ID[c1]->value/10)+50&"."&c3
 
So which engine parameter does it actually point to? If it's convolution size, LPF and HPF, those parameters are not refreshed in realtime.
 
Thanks as usual Mario, actually this is not for real time, I've got a knob tied to it. I think it was you that gave me the idea for the code that I used and posted.
 
So which engine parameter does it actually point to? If it's convolution size, LPF and HPF, those parameters are not refreshed in realtime.
Yup, those take a few miliseconds to refresh which makes them seem broken in the UI.
 
Thanks as usual Mario, actually this is not for real time, I've got a knob tied to it. I think it was you that gave me the idea for the code that I used and posted.

If you have a knob tied to it, that is considered realtime adjustment. Some convolution parameters need recalculation, hence their value reporting is slower.
 
Okay, thanks guys, I decided to eliminate it.

Funny it works great in another instrument I made.
 
It depends on the lenght of IRs how long the processing would take. But in general, the way I sort this problem is (at least for convolution Size) to just manually calculate the percentage from the knob value itself.
 
It depends on the lenght of IRs how long the processing would take. But in general, the way I sort this problem is (at least for convolution Size) to just manually calculate the percentage from the knob value itself.
Assuming this is not in a note callback (where time is critical), would another option be to add a wait statement, and then read the value? (Personally, I'd also be inclined to do the "calculate percentage manually" method, but I'm just wondering in general if the wait method has problems I'm not aware of.)
 
No because the wait time can be different depending on a couple of factors. Kontakt is already doing the wait for you, that's why the value display lags for those parameters. This is why it makes more sense to just calculate the percentage instead (because wherever you set that knob, it IS going to be at that value after Kontakt recalculates the IR, so your calculated display is going to be correct).
 
So essentially just divide the EP# by 10,000 and add 50, right?
 
Yes, but can also add decimal point as well :)

Aah, that's right, forgot about that, and I'm using K5.5 so I'll have to work around that. I think K6 does calculate to decimals, right? Is there a K5 version that does that too?
 
Just use string concatenation and modulo, easy.

Code:
50 + (value / 10000) & "." & (value / 1000) mod 10) & " %"
 
Yeah, I did it slightly different but it gets the same results. :)

Code:
((value/10000)+50)&"."&(value/1000)-((value/10000)*10)

I don't need the "%" because I have a picture overlay for the label with "%" on it.
 
Top Bottom