SynthMaker

Alternative clipper

Archive · 2009 18 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

MegaHurtz ·

I had a little spur of the moment.. Since i dont have a direct use for it, i thougt i`d post it here. Maybe someone would like a hack at it.

Cheers!

infuzion ·

Not sure how many cycles saved; the CPU Cycle Analyzer is a bit wonky on my Core2. I'm guessing 5-8 cycles, up to half. // Dynamic clipper by Mhz, re8 redux streamin in; streamin thresh; streamin angle; streamout out; float F1=1; float FN1=-1; //float F0P1=0.999985;float F0P2=-0.999985; //final min/max clip handled by angle GUI; set max angle to 0.999985 movaps xmm0,thresh; movaps xmm1,xmm0; //movaps xmm6,in; minps xmm0,in; mulps xmm1,FN1; movaps xmm2,F1; maxps xmm1,xmm0; movaps xmm3,angle; subps xmm2,xmm3; mulps xmm1,xmm2; mulps xmm3,in; addps xmm1,xmm3;//(clipping dac) //minps xmm1,F0P1; //maxps xmm1,F0P2; movaps out,xmm1;//(clipped)

//float maxn,minn,sub,clip; maxn=min(in,thresh); minn=max(maxn,(thresh*-1)); sub=(minn*(1-angle))+(angle*in); clip=min(sub,0.999984741); out=max(clip,-0.999984741); A bit of re-arranging; preloading all variables can be counter-productive sometimes. I also shrunk slightly the max range for the Angle knob to simulate a min/max instead of clipping it at the end of the ASM. I guess one can do that in the Threshhold knob also.

I noticed some DC offset? I guess it's a "tube" emulator. 😉

sunsynth ·

Thanks MegaHurtz!

I like ur Valve type 'Clipper' 🙂

MyCo ·

for this line:

mulps xmm1,FN1;

you could use this:

int mask=-2147483648; orps xmm1,mask;

because thresh is always positive.

MegaHurtz ·

Not exactly shure what this is supposed to be.. Risky naming these things 🙂 Im having trouble measuring this aswell, especcially with the added changes, here it runs at -3/2 cycles. So atleast it`s hardly noticed. Didn`t have a hard look at the code yet, but I fully agree with the clipper removed. Thanks for the update, much appreciated!

infuzion ·

MegaHurtz wrote: Not exactly sure what this is supposed to be.. Risky naming these things

My first impression: "Linear Waveshaper".

Thanks MyCo for the reminder!

MegaHurtz ·

would be nice to do a soft satturating version one of these days.

btw.. why or "-2147483648" ?

nix ·

ASM is so hard to understand, and where does that number come from MyCo 🙂 ?

stw ·

nix wrote: ASM is so hard to understand, and where does that number come from MyCo 🙂 ?

2147483648= 2^31 and one bit for the sign. Makes a 32 bit integer with all bits set. The same number without the sign bit is used for he "absmask" IIRC.

EDIT: oops, obviously it's the other way round (see MyCo post) 😊 . It actaually wouldn't make any sense the way i said. 😀

MyCo ·

The bitmask is a 1 followed by 31 zeros. So an orps with this always sets the most significand bit in a value which for float is the sign bit.

BTW: you can use a more readable version for the same mask effect:

float mask= -0;

yeah you see it right, it's a negative zero....

sunsynth ·

ASM brains must be... different 😉

...no offense - dudes

MegaHurtz ·

so.. the msb portion of a float is the sign bit.

infuzion ·

sunsynth wrote: ASM brains must be... different 😉

ASM is just like playing Legos; you have to figure out how they snap together & in what order.

I'm not sure if the "int mask=-2147483648;orps xmm1,mask;" works for this particular app though.

MegaHurtz ·

There is one thing bugging me though, To me, it seems that xmm0 tm xmm7 can be thought of as paralel. While processing these pairs serially. But howcome using it in it`s most paralel form, isn`t beneficial to cycles at all. Is this becouse it`s still a serial method of processing ??

Dell ·

Thank you for the "Alternative Clipper."

It sounds really nice. 🙂

infuzion ·

MegaHurtz wrote: To me, it seems that xmm0 t0 xmm7 can be thought of as parallel. While processing these pairs serially. But how come using it in it`s most parallel form, isn`t beneficial to cycles at all. Is this because it`s still a serial method of processing ??

xmm0-7 has nothing to do with parallel processing really, it is just several memory addresses that are easier to get to. For the most part, ASM is sequential, but most modern CPUs can be thought of having 2-3 pipelines that may be able to process at the same time if their destinations are different & there is no dependencies on the 2.

MegaHurtz ·

tx.. So a quadcore might do a little of that for you, but probbably not..?

infuzion ·

MegaHurtz wrote: tx.. So a quadcore might do a little of that for you, but probbably not..?

Intel Core2 self-optimize well, but I can always do better by hand. 😉

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.