SynthMaker

Bypassing code/asm

Archive · 2011 8 old posts

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

mwvdlee ·

Hi everybody,

I'm no longer actively developing for S|M since the product is badly broken, but I still use my own synth for my own playing, because, in my (somewhat biased) opinion, it still beats most

00+ VST's due to simply being able to keep up with a reasonable playing speed (most care about recording, I care about live playing). So I still occasionally run into issues with S|M. In particular this one that I'm sure somebody has already solved or atleast many people have wondered about:

How to you bypass code/asm?

I don't mean "how to get 0 output", I mean; how to not run the code for an effect if that effect is disabled by the user? All for performance benefits; I don't want to waste cycles calculating things I'm not using. Selector, Multiplexor, some code/asm trickery? What are the quickest, most reliable or easiest solutions?

kind regards, Martijn

MegaHurtz ·

use jz or jnz.

heres an example.. Btw it came from the slimpower module i hopped from shifs power module, if you want it i can post.

//--- Logical IfTrue For Exp/Bas... movaps xmm0,fExp; movaps xmm6,fBas; // these two are the power and base functions from your input addps xmm0,xmm6; movaps xmm6,xmm0; cmpps xmm0,late,4; movaps late,xmm6; //V sync is there movaps sync,xmm0; // ^^ this part creates a trigger of 1 sample every time input changes values else no trigger. But basicly you only need a boolean of 0-1 for the rest to work. //--- base^exponent [0]... mov eax,sync[0]; //so.. you move sync to eax[0] << has to be done per sse chanel cmp eax,0; //compare it to 0 jz end0; //and use jump if zero to create the open if true hop fld fExp[0]; fld fBas[0]; fyl2x; fld st(0); fld fHlf[0]; fsub; frndint; fxch; fld st(1); //SOME code 🙂 fsub; // Note its single channel all round for good function f2xm1; fld1; fadd; fxch; fld1; fscale; fstp st(1); fmul; fstp out[0]; end0: // Here you define the end of your hopping effect //--- base^exponent [1]...

Also note the difference between [0] wich means sse chanel zero (of 4 chanels) And the zero after the cmp, this one means compare to 0 And the zero after jz and end also mean sse chanel zero besides not being in brackets 😕

MegaHurtz ·

Wth.. 🙂 note this is set to 2^in, changing float fBas to streamin fBas will make the base a setting again.

//--- Ins/Outs... streamin fExp; //powerr float fBas=2;//base :) streamout out; //--- Some vars... float sync=0; float late=0; //--- Logical IfTrue For Exp/Bas... movaps xmm0,fExp; movaps xmm6,fBas; addps xmm0,xmm6; movaps xmm6,xmm0; cmpps xmm0,late,4; movaps late,xmm6; movaps sync,xmm0; //--- base^exponent [0]... mov eax,sync[0];cmp eax,0; jz end0; fld fExp[0]; fld fBas[0]; fyl2x; fld st(0); fld fHlf[0]; fsub; frndint; fxch; fld st(1); fsub; f2xm1; fld1; fadd; fxch; fld1; fscale; fstp st(1); fmul; fstp out[0]; end0: //--- base^exponent [1]... mov eax,sync[1];cmp eax,0; jz end1; fld fExp[1]; fld fBas[1]; fyl2x; fld st(0); fld fHlf[1]; fsub; frndint; fxch; fld st(1); fsub; f2xm1; fld1; fadd; fxch; fld1; fscale; fstp st(1); fmul; fstp out[1]; end1: //--- base^exponent [2]... mov eax,sync[2];cmp eax,0; jz end2; fld fExp[2]; fld fBas[2]; fyl2x; fld st(0); fld fHlf[2]; fsub; frndint; fxch; fld st(1); fsub; f2xm1; fld1; fadd; fxch; fld1; fscale; fstp st(1); fmul; fstp out[2]; end2: //--- base^exponent [3]... mov eax,sync[3];cmp eax,0; jz end3; fld fExp[3]; fld fBas[3]; fyl2x; fld st(0); fld fHlf[3]; fsub; frndint; fxch; fld st(1); fsub; f2xm1; fld1; fadd; fxch; fld1; fscale; fstp st(1); fmul; fstp out[3]; end3:

Slimpowerr Created By Shifrin, Optimised By Mhz,

infuzion ·

mwvdlee wrote: how to not run the code for an effect if that effect is disabled by the user? All for performance benefits; I don't want to waste cycles calculating things I'm not using. Selector, Multiplexor, some code/asm trickery? What are the quickest, most reliable or easiest solutions?

You answered it yourself; Selectors & Multiplexors can (depends on your layout) isolate any audio coding when there is no clear route to the final VST Out. So if you switch to another routing, this forces SM to re-compile all the ASM audio code according to the new route.

If you don't want the recompile (which may cause an audio click due the the audio stream resetting), then you need to do MH's ASM branching. But that would require the entire audio segment to be an entire ASM block.

more for the FAQ

trogluddite ·

There's more discussion and tips on 'compile-free' switching and assembly bypassing in this thread.

Leslie147 ·

[quote="MegaHurtz"] heres an example...

-- snip --

fld st(0); fld fHlf[0]; fsub;

-- snip -- [/quote]

Very mysterious! fHlf isn't defined in the assembly language presented here, which works as intended when copied into SM. It obviously has a value because the power function fails if I comment it out and, by substitution, it appears that its value is 0.5 (as the name might suggest!). So I wonder how fHlf is defined. Is it one of a list of 'internal' constants documented somewhere? Advice on this would be greatly appreciated.

infuzion ·

Leslie147 wrote: MegaHurtz wrote: -- snip -- fld st(0); fld fHlf[0]; fsub; -- snip --

Very mysterious! fHlf isn't defined in the assembly language presented here, which works as intended when copied into SM. It obviously has a value because the power function fails if I comment it out and, by substitution, it appears that its value is 0.5 (as the name might suggest!). So I wonder how fHlf is defined. Is it one of a list of 'internal' constants documented somewhere?

I never thought of it before, but I guess it is an SM interpreter alias.

Leslie147 ·

My mistake. fHlf simply isn't defined so SM takes it to be zero and the same end result is obtained by commenting out fld fHlf[0];fsub; It could be that fHlf was defined in an earlier version but that line has become 'lost in transit' as it were. It looks as though the purpose of the part involving fHlf (with it defined as 0.5) was to be specific about how the following frndint should work when presented with a value near x.5. I haven't found an input value, with the base left at 2, that yields an obviously incorrect result with fld fHlf[0];fsub; removed, but there might be some combinations for which it would go wrong.

No mystery then!

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.