Simple code question for Urs

Official support for: u-he.com
Post Reply New Topic
RELATED
PRODUCTS

Post

If it's not a big secret, could you please share the pseudocode for "make unipolar" and "soften" functions in your modmappers? I'm trying to implement something similar in a Kontakt script, but to no avail so far.


Thank you very much! :hug: :oops:

Post

As a side-question, is "make unipolar" even working correctly?

Currently if we have the whole modmapper set to -100, it never changes any values when you select "make unipolar". Isn't the point of "make unipolar" to move all values to positive side of the modmapper?

Post

you should just PM him?
:borg:

Post

Oh well, somehow didn't think of that. :D

Post

EvilDragon wrote:As a side-question, is "make unipolar" even working correctly?
Currently if we have the whole modmapper set to -100, it never changes any values when you select "make unipolar". Isn't the point of "make unipolar" to move all values to positive side of the modmapper?
1) The current function name is misleading - it should read "normalize unipolar" (and "normalize" should read "normalize bipolar").
2) In your example case, "normalize unipolar" should actually set all values to zero. Bug-ette ;-)

Post

That makes sense, Howard. :)

I have managed to figure out the "make unipolar" thing. It's just normalizing everything to 50% and adding 50 to it.

Code: Select all

{ find maximum absolute value }
for i := 0 to Steps - 1
	if max < abs(Table[i])
		max := abs(Table[i])
	end if
end for
{ scale to 50% and offset by 50 to move everything to positive range }
for i := 0 to Steps - 1
	Table[i] := ((Table[i] * 50) / max) + 50
end for

I'd say that "make unipolar" function definitely behaves weirdly. At least it seems it doesn't follow the code above...

Post

make unipolar:

Code: Select all

float min = 1.f;
float max = -1.f;
														
for ( int i = 0; i < NumSteps; i++ )
{
	if ( steps[ i ] < min ) min = steps[ i ];
	if ( steps[ i ] > max ) max = steps[ i ];
}
							
							
if ( min != max )
{
	float add = ( max + min ) * 0.5f;
	float mul = 1.f / ( max - min );
	
	for ( int i = 0; i < NumSteps; i++ )
	{
		steps[ i ] -= add;
		steps[ i ] *= mul;
		steps[ i ] += 0.5f;
	}
}

soften (simple lowpass filter):

Code: Select all

float tmp = steps[ 0 ];

for ( int i = 1; i < NumSteps-1; i++ )
{
	float v = steps[ i ] * 0.6f + 0.2f * ( tmp + steps[ i + 1 ] );
	tmp = steps[ i ];
	steps[ i ] = v;
}

Post

Thanks a million! :)

Simple lowpass, duuuuh I'm stupid. -_-


My "make unipolar" works nicely though (code from previous post)! Sorry for not PMing you instead :oops:

Post

EvilDragon wrote:Sorry for not PMing you instead :oops:
Actually, I appreciate the open question and answer! Super interesting and informative with no drama ... I thought I woke up in a parallel universe with a different internet there for a sec.
If you have to ask, you can't afford the answer

Post Reply

Return to “u-he”