Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Double Gate?

DSP related issues, mathematics, processing and techniques

Double Gate?

Postby tulamide » Sun Mar 08, 2020 9:08 pm

Would it be possible?

What I'm thinking of is a gate that closes when a signal is higher than threshold A, but then stays closed until the signal is lower than threshold B. Since I wouldn't want to use it directly, it should somehow output false for closed and true for opened.

Any examples would be appreciated. And please remember that I am not able to build it myself from scratch. So any advice that's just describing things as text, is well-meant but useless for me. So don't waste your time, if you don't plan to also add a schematic.

Thank you anyway!
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Double Gate?

Postby trogluddite » Sun Mar 08, 2020 10:20 pm

Sounds like what you need is a "Schmitt Trigger" (a gate with hysteresis). Unfortunately I seem have hit the dreaded "attachment quota" (I said I would jinx myself last time I mentioned it!). Here's a DropBox Link instead (it's the "inverse" version that fits what you described).
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Double Gate?

Postby tulamide » Mon Mar 09, 2020 11:39 am

trogluddite wrote:Sounds like what you need is a "Schmitt Trigger" (a gate with hysteresis). Unfortunately I seem have hit the dreaded "attachment quota" (I said I would jinx myself last time I mentioned it!). Here's a DropBox Link instead (it's the "inverse" version that fits what you described).

Thank you very much! Yes, this inverted Schmitt Trigger was exactly what I was looking for! Of course, it's a black box for me, but it doesn't matter, because it works. Awesome!
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Double Gate?

Postby adamszabo » Mon Mar 09, 2020 1:11 pm

tulamide wrote:Of course, it's a black box for me


I converted the assembly to Ruby I hope it helps to understand better ;)

Code: Select all
#green float inputs: @in, @lo, @hi

def init
   @gate = false
end

def event(i,v,t)
   @gate = ( @gate || (@in >= @hi) ) && (@in >= @lo)
   output 0, @gate == false
end
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Double Gate?

Postby tulamide » Mon Mar 09, 2020 2:01 pm

adamszabo wrote:I converted the assembly to Ruby I hope it helps to understand better ;)

Code: Select all
#green float inputs: @in, @lo, @hi

def init
   @gate = false
end

def event(i,v,t)
   @gate = ( @gate || (@in >= @hi) ) && (@in >= @lo)
   output 0, @gate == false
end

It does! You just need to pass the output in parentheses: output 0, (@gate == false)

And it brings up a question :P
The Schmitt Trigger uses only 8 instructions (wow!), while the inverted one uses 11. In the Ruby version, I can make an inverted Schmitt Trigger just by using 'not': output 0, !(@gate == false)

Is that not possible in fewer than 3 instructions?
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Double Gate?

Postby adamszabo » Mon Mar 09, 2020 3:00 pm

tulamide wrote:Is that not possible in fewer than 3 instructions?


I believe you can use the "andnps" (and not) instruction on the normal Schmitt trigger, I dont know how to apply it from the top of my head right now.
adamszabo
 
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Double Gate?

Postby trogluddite » Mon Mar 09, 2020 4:14 pm

I think Adam's probably right about the inversion. It's a module I made years ago, and the assembler didn't used to recognise any inverting logic opcodes, so a compare with zero may have been the only way to do it (the pslld get you a zero by bit-shifting all the 1s out of a register - much quicker than loading a zero constant from memory). It might even be possible to refactor it so that the inversion isn't a separate step these days.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Double Gate?

Postby tulamide » Tue Mar 10, 2020 8:16 am

I understand. And it's totally fine. It was no criticism, I was just curious after I understood what's going on, thanks to Adam's Ruby translation.

I'm totally fine with the versions!

Thanks guys :)
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Double Gate?

Postby wlangfor@uoguelph.ca » Wed Mar 11, 2020 2:26 pm

I've used schmidt, but have you tried doing it in blue?

You can convert the linear to db using a logarithm and then you output the db you wish to reduce by and send to a Sam Mungall VCA linear db ASM code optimized by Barak.
It saves a percent or two in CPU and is often faster.

Here's a link to My new tools that should help you get there:
http://dsprobotics.com/support/viewtopic.php?f=3&t=38514

Take a look at how I optimized a limiter for ideas?

And BTW, instead of release, why not just use Trog's ASM slide to reduce the db? It's the same as release in most ways. A good idea maybe, anyways, GL.
My youtube channel: DSPplug
My Websites: www.dspplug.com KVRaudio flowstone products
User avatar
wlangfor@uoguelph.ca
 
Posts: 912
Joined: Tue Apr 03, 2018 5:50 pm
Location: North Bay, Ontario, Canada

Re: Double Gate?

Postby tiffy » Wed May 20, 2020 1:25 pm

tulamide wrote:
adamszabo wrote:I converted the assembly to Ruby I hope it helps to understand better ;)

Code: Select all
#green float inputs: @in, @lo, @hi

def init
   @gate = false
end

def event(i,v,t)
   @gate = ( @gate || (@in >= @hi) ) && (@in >= @lo)
   output 0, @gate == false
end

It does! You just need to pass the output in parentheses: output 0, (@gate == false)

And it brings up a question :P
The Schmitt Trigger uses only 8 instructions (wow!), while the inverted one uses 11. In the Ruby version, I can make an inverted Schmitt Trigger just by using 'not': output 0, !(@gate == false)

Is that not possible in fewer than 3 instructions?


Hi guys, I wanted to use this Ruby version of the Inverted Schmidt-Trigger connected to a knob as input, however apart from the required Bool pulse it provides at its output it also let through unwanted triggers from the knob. Is there a method in Ruby to completely stop those unwanted triggers coming from the knob to appear at the output of the Schmidt-Trigger? Thanks.
User avatar
tiffy
 
Posts: 400
Joined: Wed May 08, 2013 12:14 pm

Next

Return to DSP

Who is online

Users browsing this forum: No registered users and 72 guests