From the original SynthMaker forum (2004–2014), with its members’ names and dates.
MichaelBenjamin ·
i made a small tutorial for beginners, how to put a basic math operation into a code expression and then into an asm module. basically you should atleast do this with all sm math primitives in your schematic before you release it to the public. this easily saves ~50% of cpu processing time and makes the processing more stable, less spikey.
if you want to learn more about asm, a good next step would be exonerates asm tutorial at the wiki:
[old link]
note, that you can usually save much more cpu the bigger the code modules and the bigger your dedication to puzzling around with 8 xmm registers is.
Nu Audio Science ·
When you say all math do you mean just stream math right ?
Not green math
I'm a little confused on that
Oh and thanks for the tutorial 😉
NAS
hansdump ·
Nice Tutorial. Newbies will be happy!!
H.
AlexT ·
Thanks for that. It's a nice tutorial and certainly helps those of us that no nothing or very little about ASM. 🙂
Neptune ·
hansdump wrote: Nice Tutorial. Newbies will be happy!!
H.
Yes, i'm really happy about it
Thanks a lot!!
But how about a little complexer example like this
I tried to do it in code but failed as expected 🙂
MichaelBenjamin ·
yes this is a bit harder.
look at the end - something gets added to left and substracted to right (its the result of the multiplication)
so lets say the result of the multiplication is x
out1=in1+x;
out2=in2-x;
so what is x?
x is something multiplied with the dezipper, so x=y*dezip
now y:
y is left input minus something,
so y=in1-z
almost there, now its easy, because z is (left+right)/5 - note that you need the parentheses because first left and right needs to be aded, then the result is divided.
now you can write: y: in1-((in1+in2)/5)
and x: (in1-((in1+in2)/5))*dezip
and now as code:
streamin in1;
streamin in2;
streamin amount; //was dezip, but amount makes more sense
streamout out1;
streamout out2;
float mix;//temp variable to store the number that gets added and substracted
as an additional optimisation you can exchange divisions with constants by a multiplication with 1/constant, this saves cpu time
so instead of /5, write *0.2
just used this to shave some CPU out of one of my schematics, only simple stuff
I combined a balance and auto balancer and converted to ASM then converted my stereo wet/dry to ASM
cheers for this MB has given me a tiny understanding of ASM
NAS
Nu Audio Science ·
You know what i just done some heavy duty tests and to be honest i wish i had kept the coded versions over the ASM versions for some of my plugs because compiled the ASM is using significantly more CPU than the ASM
And that is a straight 1:1 code to ASM comparison
If i can find the coded versions in an older save on my drive i will put together a comparison OSM but i have to be honest at this point i dont think the 1:1 code to ASM thing is of any use at all
I would guess you need to heavily optomise the ASM once copied to even get close to the straight code in these examples
NAS
aliasant ·
Nu Audio Science wrote: You know what i just done some heavy duty tests and to be honest i wish i had kept the coded versions over the ASM versions for some of my plugs because compiled the ASM is using significantly more CPU than the ASM
And that is a straight 1:1 code to ASM comparison
If i can find the coded versions in an older save on my drive i will put together a comparison OSM but i have to be honest at this point i dont think the 1:1 code to ASM thing is of any use at all
I would guess you need to heavily optomise the ASM once copied to even get close to the straight code in these examples
NAS
Hmm. SOmething is wrong.
When I take a code block, convert it to asm and optimize it I at least save 40%. Often more. If I can combine several code blocks into one before optimizing it I will save even more.
Edit: I read you ENTIRE post now 😉. Yes. Code to ASm 1:1 doesnt do anything. Not that I know of. Its not until you start optimizing it that you see the gains.
Update: Heres an example of what I did today.
I had the original RMS code that someone made. Sorry. Cant remember who.
It uses 78.2 on my machine. It is 4 channels and 2 blocks of code. Not very efficient.
Now I only needed 1 channel since Im using it for mono so I converted it to asm, ripped out 3 channels, optimized some
+ added the squareroot part in the same asm block.
The new one now uses 43 cycles so I gained 35 cycles on that.
And as others have mentioned, it makes the code run more stable.
Im planning to combine this part with several other parts and I think that will save me even more on this project 🙂
Here is the Mono RMS code. Maybe someone can optimize it even further?