Simple code question for Urs
- KVRAF
- Topic Starter
- 23103 posts since 7 Jan, 2009 from Croatia
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!
Thank you very much!
- KVRAF
- Topic Starter
- 23103 posts since 7 Jan, 2009 from Croatia
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?
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?
- KVRAF
- Topic Starter
- 23103 posts since 7 Jan, 2009 from Croatia
Oh well, somehow didn't think of that.
- KVRAF
- 4123 posts since 23 May, 2004 from Bad Vilbel, Germany
1) The current function name is misleading - it should read "normalize unipolar" (and "normalize" should read "normalize bipolar").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?
2) In your example case, "normalize unipolar" should actually set all values to zero. Bug-ette
- KVRAF
- Topic Starter
- 23103 posts since 7 Jan, 2009 from Croatia
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.
I'd say that "make unipolar" function definitely behaves weirdly. At least it seems it doesn't follow the code above...
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...
- u-he
- 28065 posts since 8 Aug, 2002 from Berlin
make unipolar:
soften (simple lowpass filter):
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;
}
- KVRAF
- Topic Starter
- 23103 posts since 7 Jan, 2009 from Croatia
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
Simple lowpass, duuuuh I'm stupid. -_-
My "make unipolar" works nicely though (code from previous post)! Sorry for not PMing you instead
- KVRAF
- 6095 posts since 5 Jul, 2001 from Just about .... there
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.EvilDragon wrote:Sorry for not PMing you instead
If you have to ask, you can't afford the answer