Schmitt triggers

Post any examples or modules that you want to share here
RJHollins
Posts: 1573
Joined: Thu Mar 08, 2012 7:58 pm

Re: Schmitt triggers

Post by RJHollins »

:lol:

Straight to the toolbox.
Tepeix
Posts: 361
Joined: Sat Oct 16, 2021 3:11 pm

Re: Schmitt triggers

Post by Tepeix »

Here's a Tulamide Switch in asm !)

Interesting sound ;) Act as distortion, gate, and a sort of sequencer.. With ton of aliasing !)
Maybe other's use are possible !)

This one is more hard to do.
Maybe it's possible to optimize it further.
This solution need 4 comparison.
Comparing the in and the last in value 2 time.


Also a new Schmith Trigger.
I think this one is the most optimized but not so sure.
It use 1 comparison, 2 andps, and a boolean output.
If you need a boolean this is better.
(in asm seams that it's not possible to declare boolean variable ?)
Attachments
Tulamide switch.fsm
(44.13 KiB) Downloaded 736 times
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Schmitt triggers

Post by tulamide »

Cool! Thanks a lot. I have no knowledge of Assembler, so I will just assume it's the fastest. But honestly I wouldn't use it for manipulating audio. I could rather think of some transient detection or stuff like that. But there sure are better algorithms for those purposes already. :lol:
"There lies the dog buried" (German saying translated literally)
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: Schmitt triggers

Post by Spogg »

Tepeix wrote:Here's a Tulamide Switch in asm !)

... Also a new Schmith Trigger ...


Clever stuff Tepeix!
Tepeix
Posts: 361
Joined: Sat Oct 16, 2021 3:11 pm

Re: Schmitt triggers

Post by Tepeix »

That's a very interesting thing to do in asm !)
Maybe specially because i'm just in the learn of how to compare efficiently in complex logic.

If using only one or some Tulamide Switch, there's not much gain to find optimization.
But i like to imagine a very big amount of switch feeding some neural network that detect pitch or peak...
Héhé maybe that's not possible and there's no utility for large amount..

I find another code but it take just a little more cpu..
But it was interesting..

This one use no classic comparison. But abs and sign.
If y >= x, then sign of y-x is positive.
also max (x,0) could be replaced by x+abs(x) (but it double the result..)
also the output of this one is -0.5 to 0.5..

Code: Select all

streamin in; streamout out;
streamin t; streamin u;
int abs=2147483647;
int sgn=-2147483648;
float n5=0.5;
float a=0; float b=0;
movaps xmm5,n5;
movaps xmm6,sgn;
movaps xmm7,abs;

movaps xmm0,in;
movaps xmm4,xmm0;
subps xmm0,t;
//sign(in-t)//
andps xmm0,xmm6;
orps xmm0,xmm5;
//sign - last sign  > positive if last one negative
movaps xmm1,a;
movaps a,xmm0;
subps xmm0,xmm1;
movaps xmm1,xmm0;
//+abs could not be negative
andps xmm1,xmm7;
addps xmm0,xmm1;

addps xmm0,out;
//sign(in-u)//
subps xmm4,u;
andps xmm4,xmm6;
orps xmm4,xmm5;
//sign - last sign
movaps xmm1,b;
movaps b,xmm4;
subps xmm4,xmm1;
//-abs could not be positive
movaps xmm1,xmm4;
andps xmm1,xmm7;
subps xmm4,xmm1;
//
addps xmm0,xmm4;

// "min+max" >  x<0.5 or x>0.5  => x=-0.5 or 0.5
subps xmm0,xmm5;
andps xmm0,xmm6;
orps xmm0,xmm5;

movaps out,xmm0;

I'm happy that this work.. But it take more cpu..
Post Reply